Re: [cx-oracle-users] Can't get nextval
Brought to you by:
atuining
From: Jon a. C. B. <jc....@bi...> - 2004-02-27 07:57:18
|
Hi Antonio, If you want to treat your sequence like a "table", you must "SELECT users_seq.nextval FROM DUAL". You'll see the next sequence value if you execute this statement from an SQL*Plus prompt. What you seem to be attempting to do, only makes sence from a PL/SQL block. Try something like: CREATE OR REPLACE PROCEDURE myproc IS nval NUMBER; BEGIN SELECT users_seq.nextval INTO nval FROM DUAL; INSERT INTO xxx VALUES(nval,...); ... END; Then use cx_Oracle's callproc method to execute procedure myproc. Hope this helps. Regards, Jon ----- Original Message ----- From: "Antonio Beamud Montero" <ant...@li...> To: <cx-...@li...> Sent: Thursday, February 26, 2004 10:56 PM Subject: [cx-oracle-users] Can't get nextval Hi all: I've a big problem because I neet to get the nextval in a sequence, and the query returns an empty sequence. If I make a query like : INSERT INTO XXXX VALUES (users_seq.nextval, ...) All works perfectly, but If I try to do this query in two steps: SELECT users_seq.nextval FROM XXXX INSERT INTO XXXX VALUES (new_id, ...) the SELECT returns []. (This query works with sqlplus) What I'm doin wrong? ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id56&alloc_id438&op=ick _______________________________________________ cx-oracle-users mailing list cx-...@li... https://lists.sourceforge.net/lists/listinfo/cx-oracle-users |