Unix Technical Forum

how to insert sequence value using prepared statement

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 ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-24-2008, 08:41 AM
db2group88@yahoo.com
 
Posts: n/a
Default how to insert sequence value using prepared statement

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-24-2008, 08:41 AM
Turkbear
 
Posts: n/a
Default Re: how to insert sequence value using prepared statement

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..


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-24-2008, 08:41 AM
Richard Kuhler
 
Posts: n/a
Default Re: how to insert sequence value using prepared statement

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 10:32 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com