On 1/25/06, Todd Hepler <[EMAIL PROTECTED]> wrote:
> John Siracusa wrote:
>> Either way, after the insert, I'll need a way to get the value that was
>> used--and do so in a concurrency-safe way.  What's The Oracle Way to do that?
>
> In my experience, it's best way is to select the nextval from the
> sequence before doing the insert, and then providing that value to the
> insert statement.

That's what I do for Pg, but that approach seems incompatible with the
trigger-based approach described earlier, which will overwrite that
value with a new one on insert.

> I would recommend, on the first pass at least, to not worry about BEFORE
> INSERT triggers.  Just get:
>
>      select <SEQUENCE_NAME>.nextval from dual;
>
> working before the insert statement, where SEQUENCE_NAME is specified by
> the user.

Yeah, that sounds the simplest.  But if the trigger-based approach is
really common, we're not doing Oracle users any favors by punting on
this...

(BTW, anyone know why dual is named dual?)
-John


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to