Temporary tables - Page 2
DBAsupport.com Forums - Powered by vBulletin
Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Temporary tables

  1. #11
    Join Date
    Mar 2001
    Posts
    17

    Cool

    hi shiva,

    If u want to create global temp table at runtime then while inserting also u have to use dynamic sql. e. g. if u r creating global temp table as
    a := 'create global temporary table shiva(customer_cd varchar2(20) NULL,
    contact_type VARCHAR2(20) NULL,
    seq_no INTEGER NULL)';
    execute IMMEDIATE a;

    then while inserting u should write insert statement as
    a:= 'INSERT INTO shiva(customer_cd,contact_type,seq_no) VALUES ('||'1,'||'cust,'||1||')';
    execute IMMEDIATE a;

    The better solution on this is u create global temp table at sql prompt and use it where ever u want just like normal fisical table. Yes, it is session specific. Only thing is it would exist in ur schema with no records.

    Kancha



    [Edited by Kancha on 03-15-2001 at 06:18 PM]

  2. #12
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598
    declare
    a varchar2(200);
    begin
    a := 'create global temporary table jegan(a number,c number) on commit preserve rows';
    execute immediate a;
    end;
    /
    jegan
    Cheers!
    OraKid.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width