Use subquery in pl/sql block
SQL> create table myTable
2 as
3 select rownum id, a.*
4 from all_objects a
5 where 1=0
6 /
SQL>
SQL> create or replace procedure dw_style
2 as
3 i number;
4 begin
5 select count(*) into i
6 from (
7 select
8 t1.data_object_id, myTable2.data_object_id
9 from myTable t1, myTable myTable2
10 where t1.id = myTable2.id
11 );
12 end;
13 /
SQL>
SQL> drop table myTable;
Related examples in the same category