Working with an Oracle 9i database from an ASP.NET 2.0 (VB) application using OLEDB. Is there a way to have an insert statement return a value? I have a sequence set up to
Some possibilities:
1) Use the RETURNING clause:
INSERT INTO emp (empno, ename) VALUES (emp_seq.NEXTVAL, 'ANDREWS')
RETURNING empno INTO :variable;
2) Use the sequence CURRVAL:
INSERT INTO emp (empno, ename) VALUES (emp_seq.NEXTVAL, 'ANDREWS');
SELECT emp_seq.CURRVAL INTO :variable FROM DUAL;
CURRVAL returns the last sequence value generated by your session.