Oracle delete row using sequence number -


my db knowledge quite limited , trying delete row following query:

delete table column in (select sequence.currval dual);

this used in .sql clean database after integration tests run in maven. have googled still haven't found answer delete statement work. appreciated!

you can't use currval in delete statement, can read here: http://www.orafaq.com/wiki/ora-02287

but since using sql scripts, can in sql*plus:

sql> create table t( id number);  table created.  sql> create sequence seq;  sequence created.  sql> insert t (id) values (seq.nextval);  1 row created.  sql> column new_value curseqval sql> select seq.currval dual;           ----------          1  1 row selected.  sql> delete t id = &curseqval; old   1: delete t id = &curseqval new   1: delete t id =          1  1 row deleted. 

regards,
rob.


Comments

Popular posts from this blog

Cursor error with postgresql, pgpool and php -

delphi - ESC/P programming! -

c++ - error: use of deleted function -