This is a discussion on how to insert sequence value using prepared statement within the Oracle Database forums, part of the Database Server Software category; --> I am using oracle db server 10g on windows 2000 platform, the application use jdbc connection, all of the ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I am using oracle db server 10g on windows 2000 platform, the application use jdbc connection, all of the tables has a column named id, i would like to use sequence to insert the value to this column, as i know, you can insert sequence_name.nextvalu to this column for each insert row, but if our insert statement use prepared statement, how to prepare this column to insert sequence value? thanks |
| |||
| db2group88@yahoo.com wrote: >I am using oracle db server 10g on windows 2000 platform, the >application use jdbc connection, all of the tables has a column named >id, i would like to use sequence to insert the value to this column, >as i know, you can insert sequence_name.nextvalu to this column for >each insert row, but if our insert statement use prepared statement, >how to prepare this column to insert sequence value? thanks You could define an Insert ( Before or After) trigger to populate the column each time a new row is inserted.. |
| ||||
| db2group88@yahoo.com wrote: > I am using oracle db server 10g on windows 2000 platform, the > application use jdbc connection, all of the tables has a column named > id, i would like to use sequence to insert the value to this column, > as i know, you can insert sequence_name.nextvalu to this column for > each insert row, but if our insert statement use prepared statement, > how to prepare this column to insert sequence value? thanks Just put the sequence_name.nextval in the text portion of the sql statement, you don't need to do a setXXX() with it. -- Richard Kuhler |