Callable Statement and Oracle Sequences

I'm trying to pass in the nextVal of a sequence to an argument of the Callable Statement, but am unable to find any references. Any tips? Cheers!
[160 byte] By [jlow09] at [2007-9-26 6:03:38]
# 1
Huh?What do you mean 'pass it in'?A small sample of code would help.
jschell at 2007-7-1 14:45:20 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
If you're using a CallableStatement I guess you have stored procedure somewhere. So whats wrong with just writing MY_SEQ.NEXTVAL in the insert/update SQL in your stored procedure?
Rijaos at 2007-7-1 14:45:20 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

Last time I checked you couldn't use sequence.nextval outside of a SQL statement (even in PL/SQL). You could do a:

select sequence.nextval from dual

to get the value into a Java variable and then bind it in your call. Or you could do as the previous poster suggested and get the nextval in your PL/SQL. If you need the value back in Java, then either return it as an OUT variable or do a:

select sequence.currval from dual

to get it after.

kent_haidl at 2007-7-1 14:45:20 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...