declare variables in a pl/sql block
declare, plsql, sql, variables
Solution
You don't need to use `SET`. Just
SELECT orderNum_seq.CURRVAL INTO orderNumberSEQ FROM DUAL;
will do the trick. Or if you use `oracle11`:
orderNumberSEQ := orderNum_seq.CURRVAL;
Problem
I am trying to follow this guide for creating `pl/sql` blocks and I am getting an ORA-00922:missing or invalid option on the `SET orderNumberSEQ...`. What am I doing wrong? ``` 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; / ```