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
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
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'
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
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
>
>
~~~
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.
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
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
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
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
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
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
12 matches
Mail list logo