> > But for minimal app code change I'd suggest a using a PL/SQL trigger
> > that implements the auto increment functionality and saves the last
> > value into a per-session package variable.
> >
> > If you, or anyone, does the latter then I'd be very interested in
> > having a copy as I'll need to do something like that soon myself.
>
> An insert trigger that sets the 'autoincrement' column from a sequence
> is something that I've done before:
>
> create or replace trigger
> mytable_ai_trigger
> before insert
> on mytable
> for each row
> begin
> :new.ai_column := mytable_ai_seq.nextval;
> end;
> /
>
> You can then get the value just inserted by selecting sequencename.currval
> (from dual, of course).
Sure, but the code emulating $h->{mysql_insertid} would need to know which sequence
was most recently used. It the trigger also copied the last id into a session variable
then you wouldn't have that issue. Migration from mysql would thus be simpler.
Tim.