In the SQL Server, I can define local variables like this.
declare @id number := 1000
select * from tbl_A where id = @id;
select * from tbl_B where id = @id;
It is very convenient.
I tried to do same thing in PL/SQL but it doesn’t work.
DECLARE id number;
select 1000 into id from dual;
Do you know how to do something similar? The simplest method is my objective.
If you want to define a local variable in PL/SQL, you need a complete PL/SQL block
or just
If you want to declare a variable in SQL*Plus