Hello Experts,
I have created a global temporary tample using dynamic query in the procedure.
But i have included it in the procedure - BEGIN part.
Please tell me which will be feasible place to create a global temporary table?
Can we create in the package spec?
CREATE OR REPLACE PROCEDURE p_purge
IS
l_sys_time_stamp TIMESTAMP;
l_tmp_high_value TIMESTAMP;
--Fetching information from staging tables
CURSOR c_stg_info
IS
SELECT
....
FROM
.....
WHERE
.....
BEGIN
DBMS_OUTPUT.put_line ('Beginning of Procedure p_purge');
OPEN c_stg_info;
LOOP
FETCH c_stg_info INTO local var;
--Creating the global temporary table to use the HIGH_VALUE conversion with CLOB datatype
EXECUTE IMMEDIATE 'CREATE GLOBAL TEMPORARY TABLE temp_dba_tab_part
(
tmp_high_value CLOB,
tmp_partition_name dba_tab_partitions.partition_name%TYPE
) ON COMMIT DELETE ROWS';