Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Global Temporary Table creation

733880Sep 29 2010 — edited Sep 29 2010
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';
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 27 2010
Added on Sep 29 2010
4 comments
423 views