RE: new next primary key value in Oracle

2005-11-03 Thread Nick Han
Use DUAL. Step 1 Select WIDGETS_PKSEQ.NEXTVAL from dual Step 2 Insert into WIDGETS using WIDGETS_PKSEQ.NEXTVAL Step 3 Insert into child table of WIDGETS using value from step 1. -Original Message- From: Cornillon, Matthieu (Consultant) [mailto:[EMAIL PROTECTED] Sent: Thursday, Novemb

Re: new next primary key value in Oracle

2005-11-03 Thread Aaron Rouse
That has never worked for me within a cfquery. I have seen some on here say it worked for them so guessing it is some sort of driver issue between versions. On 11/3/05, Adrocknaphobia <[EMAIL PROTECTED]> wrote: > > What about: > > INSERT INTO Widgets() > RETURNING key AS newID > > I've never t

Re: new next primary key value in Oracle

2005-11-03 Thread Adrocknaphobia
What about: INSERT INTO Widgets() RETURNING key AS newID I've never tried to use it within a , but it works fine in storedProcs. (Which, btw, I recommend you use over inline queries) -Adam On 11/3/05, Cornillon, Matthieu (Consultant) <[EMAIL PROTECTED]> wrote: > I LOVE DUAL! > > Thanks! I'

RE: new next primary key value in Oracle

2005-11-03 Thread Cornillon, Matthieu \(Consultant\)
I LOVE DUAL! Thanks! I'll be doing more research on this. Matthieu Deanna Schneider wrote: You're new to dual? Dual is just a wonderful little "widget" that acts like a one row "table," but the column is arbitrary. You can do all sorts of stuff with it: select sysdate from dual; select 1 + 1

Re: new next primary key value in Oracle

2005-11-03 Thread Aaron Rouse
It was more of a quick solution, I'd probably do the SP route and not like that would be a long and dirty solution or anything. On 11/3/05, Cornillon, Matthieu (Consultant) <[EMAIL PROTECTED]> wrote: > > Aaron, > > This is another good solution. > > Thanks, > Matthieu > > ~~~

RE: new next primary key value in Oracle

2005-11-03 Thread Cornillon, Matthieu \(Consultant\)
Yet another good answer. Thanks, gang, for sending these in. At least one will do the trick. Matthieu Matt Small wrote: One idea, if it's possible - pass all of this information at once into a stored procedure, which would know the newly created row id know what number to use.

Re: new next primary key value in Oracle

2005-11-03 Thread Deanna Schneider
You're new to dual? Dual is just a wonderful little "widget" that acts like a one row "table," but the column is arbitrary. You can do all sorts of stuff with it: select sysdate from dual; select 1 + 1 from dual; select 'I am not a crook' from dual; select ucase('malkjdflajldjflajdlfj') from du

RE: new next primary key value in Oracle

2005-11-03 Thread Cornillon, Matthieu \(Consultant\)
Aaron, This is another good solution. Thanks, Matthieu -Original Message- From: Aaron Rouse [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005 2:08 PM To: CF-Talk Subject: Re: new next primary key value in Oracle You could just run the insert on one table, then select out

RE: new next primary key value in Oracle

2005-11-03 Thread Matthew Small
One idea, if it's possible - pass all of this information at once into a stored procedure, which would know the newly created row id know what number to use. - Matt Small -Original Message- From: Cornillon, Matthieu (Consultant) [mailto:[EMAIL PROTECTED] Sent: Thursday, November 03, 2005

RE: new next primary key value in Oracle

2005-11-03 Thread Cornillon, Matthieu \(Consultant\)
DUAL?!?!!? That works, and is magic, but, again: ?!?!? I'll have to research this. I am sure there is a good reason for it being called DUAL. If not, and if this is truly arbitrary, then I am disappointed that the folks at Oracle didn't come up with some more colorful name, like SPAGHETTIFLASHL

Re: new next primary key value in Oracle

2005-11-03 Thread Aaron Rouse
You could just run the insert on one table, then select out that new ID then use it for the other inserts. Something like: INSERT INTO BLAH (COLA) VALUES ('YES') SELECT MAX(ID) AS NEWID FROM BLAH INSERT INTO BLAH2 (COLA, COLB) VALUES ('NO', #QueryName.NewID#) With that I assume a trigger is

RE: new next primary key value in Oracle

2005-11-03 Thread Ian Skinner
Hi, everyone. I have been doing something for years that works, but feels darned silly. I have a table called WIDGETS. I have a sequence set to increment by 1 up to some ridiculous number called WIDGETS_PKSEQ. When I add a new row to WIDGETS, I put WIDGETS_PKSEQ.NEXTVAL into WIDGETS.pkWIDG, t