我正在尝试按照此guide创建pl/sql
块,并且在SET orderNumberSEQ...
上收到ORA-00922:missing或invalid选项。我究竟做错了什么?
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
。只是
SELECT orderNum_seq.CURRVAL INTO orderNumberSEQ FROM DUAL;
会成功的或者,如果您使用
oracle11
:orderNumberSEQ := orderNum_seq.CURRVAL;