Reputation: 3514
I want to insert in a row in an Oracle table. I have limitation that I can not send mySeq.nextVal
in insert script. If I omit that ID field, application tries to insert NULL there. There is a solution of using triggers on before insert. But I don't want to use triggers.
Is there any other way to insert value in Sequence field of Oracle table? Can I alter DDL and place mySeq.nextVal
as default for the ID field? Or any other idea?
Upvotes: 0
Views: 826
Reputation: 52376
Unfortunately your inability to use nextval in an insert statement and your want to avoid triggers are at odds here. If you can't for some reason place a trigger on the table for this purpose you could create a view on the table and place an "instead of" trigger on the view to insert into the underlying table with the nextval in place. I wouldn't recommend it though.
Upvotes: 1