Anda mungkin memerlukan TABEL SEMENTARA GLOBAL.
Di Oracle, ini dibuat sekali dan kemudian ketika dipanggil, data bersifat pribadi untuk sesi Anda.
Tautan Dokumentasi Oracle
Coba sesuatu seperti ini...
CREATE GLOBAL TEMPORARY TABLE temp_number
( number_column NUMBER( 10, 0 )
)
ON COMMIT DELETE ROWS;
BEGIN
INSERT INTO temp_number
( number_column )
( select distinct sgbstdn_pidm
from sgbstdn
where sgbstdn_majr_code_1 = 'HS04'
and sgbstdn_program_1 = 'HSCOMPH'
);
FOR pidms_rec IN ( SELECT number_column FROM temp_number )
LOOP
-- Do something here
NULL;
END LOOP;
END;
/