我正在尝试按照该指南创建pl/sql块,并且在上出现ORA-00922:missing或invalid选项SET orderNumberSEQ...。我究竟做错了什么?
pl/sql
SET orderNumberSEQ...
declare orderNumberSEQ number(5); userid varchar(20); begin insert into bs_orders (userid, ono, timepurchased) values('lilith', orderNum_seq.NEXTVAL,(SELECT current_timestamp FROM dual)); SET orderNumberSEQ := orderNum_seq.CURRVAL; SELECT userid FROM bs_orders where ono = orderNumberSEQ; end; /
您无需使用SET。只是
SET
SELECT orderNum_seq.CURRVAL INTO orderNumberSEQ FROM DUAL;
会成功的 或者,如果您使用oracle11:
oracle11
orderNumberSEQ := orderNum_seq.CURRVAL;