The Oracle sequence and table problem!
Date: Mon, 5 Nov 2001 10:07:57 +0800
Message-ID: <9s4rsn$69f$1_at_news.is.net.tw>
Dear All,
I have a question about the Oracle sequence and I hope somebody can show me
Currently, I use the Oracle 9i be the database server for my project. With
the MS-SQL experience, I found that Oracle doesn't support the datatype
which will generate the serial number automatically. It support the object
called "Sequence" to generate the serial number. Then the question coming.
Assume I have a table called "User_List". It includes 2 fields -- "User_ID"
and " User_Name". I want the database server generate the "User_ID"
automatically, and I just need to fill the "User_Name". In the MS-SQL, I can
SQL statement --
INSERT INTO User_List VALUES(Sequence.NEXTVAL , 'Mark');
It is fine. However, my program uses ADO to add the data into the table, not the SQL statement. I need the database server can generate the serial number and fill into the filed automatically while my program inserts one record into the table. So, I want to know is it possible that I can setup the relationship between the "Sequence" and "Table/Filed" to finish this work. Or, I need to do such like create "Trigger" or something else. If anyone know the answer, please let me know. Thank you so much.
Mark Liao ^^* Received on Mon Nov 05 2001 - 03:07:57 CET