Jika Anda ingin mendefinisikan variabel lokal di PL/SQL, Anda memerlukan blok PL/SQL lengkap
DECLARE
id NUMBER;
BEGIN
SELECT 1000
INTO id
FROM dual;
END;
atau hanya
DECLARE
id NUMBER := 1000;
BEGIN
<<do something that uses the local variable>>
END;
Jika Anda ingin mendeklarasikan variabel dalam SQL*Plus
SQL> variable id number
SQL> begin
select 1000 into :id from dual;
end;
/
SQL> print id
ID
----------
1000
SQL> SELECT * FROM tbl_a WHERE id = :id