1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Execute Immediate in Stored Procedure

Discussion in 'SQL PL/SQL' started by SomnathG, Jan 12, 2011.

  1. SomnathG

    SomnathG Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    Hi,

    I am using execute emmidiate in one of my stored procedure. Following is the line I am using :
    execute immediate 'TRUNCATE TABLE CALC_RESIDUAL_FORMULA REUSE STORAGE';

    Before this statement I have some insert queries. My question is - will execute immediate truncate statement will commit all previously inserted data after execution. In normal scenario, a truncate statement commits previous database changes. Is it behave same as for 'execute immediate' truncate staement also?

    Thanks in advance.
    Somnath Guha
     
  2. SBH

    SBH Forum Expert

    Messages:
    99
    Likes Received:
    6
    Trophy Points:
    160
    Location:
    Bangalore
    Yes, it will commit all your previous transactions. TRUNCATE in EXECUTE IMMEDIATE is same as instructing Oracle server to execute the given command.
     
  3. SomnathG

    SomnathG Active Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    55
    Thanks SBH for Quick reply.