Click here to Skip to main content
15,913,941 members
Home / Discussions / Database
   

Database

 
QuestionAccessing Multiple databases at runtime with ODBC Pin
param_joshi31-Mar-09 1:19
param_joshi31-Mar-09 1:19 
Questionplease How can I resolve this error........ Pin
Motajo Tolu31-Mar-09 1:15
professionalMotajo Tolu31-Mar-09 1:15 
AnswerRe: please How can I resolve this error........ Pin
Colin Angus Mackay31-Mar-09 1:39
Colin Angus Mackay31-Mar-09 1:39 
AnswerRe: please How can I resolve this error........ Pin
Blue_Boy31-Mar-09 2:01
Blue_Boy31-Mar-09 2:01 
Questionduplicating table data while handeling primary key column Pin
Muammar©30-Mar-09 22:02
Muammar©30-Mar-09 22:02 
AnswerRe: duplicating table data while handeling primary key column Pin
Blue_Boy30-Mar-09 22:13
Blue_Boy30-Mar-09 22:13 
GeneralRe: duplicating table data while handeling primary key column Pin
Muammar©30-Mar-09 22:44
Muammar©30-Mar-09 22:44 
GeneralRe: duplicating table data while handeling primary key column Pin
Muammar©31-Mar-09 6:35
Muammar©31-Mar-09 6:35 
Hi there, I found the answer and thought to let you know...
CREATE SEQUENCE SEQ_TEST
    MINVALUE 1
    START WITH 1
    INCREMENT BY 1
    CACHE 20
    ORDER
/

CREATE OR REPLACE TRIGGER TRG_TEST_AUTONUMBER 
BEFORE INSERT ON TEST
FOR EACH ROW
WHEN (NEW.ID IS NULL)
BEGIN
  SELECT SEQ_TEST.NEXTVAL
  INTO   :NEW.ID
  FROM   DUAL;
END;
/


Now I can insert values the way you suggested but it will still be problematic that the sequence generates values already in the table's ID column.. Any idea how to make the above sequence starts with the MAX(ID) FROM TEST??

Many thanks mate!


All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)

GeneralRe: duplicating table data while handeling primary key column Pin
Blue_Boy31-Mar-09 7:13
Blue_Boy31-Mar-09 7:13 
QuestionData Base Authication Mode Pin
Isaac Gordon30-Mar-09 21:12
Isaac Gordon30-Mar-09 21:12 
AnswerRe: Data Base Authication Mode Pin
Eddy Vluggen30-Mar-09 23:07
professionalEddy Vluggen30-Mar-09 23:07 
QuestionTemporary Table and Order By Pin
swjam30-Mar-09 18:26
swjam30-Mar-09 18:26 
AnswerRe: Temporary Table and Order By Pin
sam#30-Mar-09 20:55
sam#30-Mar-09 20:55 
GeneralRe: Temporary Table and Order By Pin
swjam30-Mar-09 21:09
swjam30-Mar-09 21:09 
GeneralRe: Temporary Table and Order By Pin
Mycroft Holmes30-Mar-09 21:35
professionalMycroft Holmes30-Mar-09 21:35 
GeneralRe: Temporary Table and Order By Pin
ButtonMoon31-Mar-09 11:36
ButtonMoon31-Mar-09 11:36 
GeneralRe: Temporary Table and Order By Pin
Mycroft Holmes31-Mar-09 13:58
professionalMycroft Holmes31-Mar-09 13:58 
AnswerRe: Temporary Table and Order By Pin
Ashfield31-Mar-09 1:30
Ashfield31-Mar-09 1:30 
QuestionReading Columns Pin
ffowler30-Mar-09 10:00
ffowler30-Mar-09 10:00 
AnswerRe: Reading Columns Pin
sam#30-Mar-09 20:52
sam#30-Mar-09 20:52 
AnswerRe: Reading Columns Pin
Mycroft Holmes30-Mar-09 21:42
professionalMycroft Holmes30-Mar-09 21:42 
GeneralRe: Reading Columns Pin
Jörgen Andersson30-Mar-09 23:37
professionalJörgen Andersson30-Mar-09 23:37 
AnswerRe: Reading Columns Pin
anup keshari30-Mar-09 21:47
anup keshari30-Mar-09 21:47 
GeneralRe: Reading Columns Pin
anup keshari30-Mar-09 22:02
anup keshari30-Mar-09 22:02 
AnswerRe: Reading Columns Pin
anup keshari30-Mar-09 22:33
anup keshari30-Mar-09 22:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.