Welcome Guest, Not a member yet? Register   Sign In
Oracle Next Id
#11

[eluser]kgill[/eluser]
I don't think there's an elegant way to do it in the driver (I can think of a couple ways but they're overly complicated hacks) but this should be entirely possible in a model. Use a combination of a bind variable, the returning clause and the name of the ID column.
Code:
insert into talblename (ID_column_name, col2_name, col3_name...) values (sequence.nextval, value2, value3...) returning ID_column_name into :boundvar
That way your insert will return the sequence number it used for the insert statement in the bound variable and you don't have to contend with the possibility of select max(ID_column_name) being wrong due to another insert taking place.

- K
#12

[eluser]Druidor[/eluser]
I tried the returning clause but I cannot get the bound variable. How do you think we could do that ?




Theme © iAndrew 2016 - Forum software by © MyBB