Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Help with a truncate command in a procedure

Re: Help with a truncate command in a procedure

From: Mark Richard <mrichard_at_transurban.com.au>
Date: Thu, 06 Feb 2003 16:13:51 -0800
Message-ID: <F001.0054695D.20030206161351@fatcity.com>


Ron,

Trunacte is DDL not DML. The easiest was around this is to wrap it in an execute immediate command:

BEGIN
   EXECUTE IMMEDIATE 'TRUNCATE TABLE LOT837_GLOBAL_TBL_KMG'; END;
/

Note that the semi-colon is outside the quotes - don't place a semi-colon inside the quotes.

Regards,

     Mark.

                                                                                                                   
                    "Smith, Ron                                                                                    
                    L."                  To:     Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>       
                    <rlsmith_at_kmg.c       cc:                                                                       
                    om>                  Subject:     Help with a truncate command in a procedure                  
                    Sent by:                                                                                       
                    root_at_fatcity.c                                                                                 
                    om                                                                                             
                                                                                                                   
                                                                                                                   
                    07/02/2003                                                                                     
                    09:08                                                                                          
                    Please respond                                                                                 
                    to ORACLE-L                                                                                    
                                                                                                                   
                                                                                                                   




I am not a coder but I received this from one of our developers. I can't find anything about this anywhere. Can someone tell me how to make the truncate work?

Thanks!

R.Smith

In a DB procedure, I wanted to include the following SQL: BEGIN
 TRUNCATE TABLE LOT837_GLOBAL_TBL_KMG;
END; Error messages:
PLS-00103: Encountered the symbol "TABLE" when expecting one of the following:
  := . ( @ % ;
The symbol ":= was inserted before "TABLE" to continue. (It does not like it, if you take out TABLE, either.)

So, I had to settle for the following SQL:

BEGIN
 DELETE LOT837_GLOBAL_TBL_KMG;
END; Do you know why I can not use the TRUNCATE command?

If you are not the intended recipient of this e-mail message, any use, distribution or copying of the message is prohibited. Please let me know immediately by return e-mail if you have received this message by mistake, then delete the e-mail message. Thank you.

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

   Privileged/Confidential information may be contained in this message.

          If you are not the addressee indicated in this message
       (or responsible for delivery of the message to such person),
            you may not copy or deliver this message to anyone.
In such case, you should destroy this message and kindly notify the sender
           by reply e-mail or by telephone on (61 3) 9612-6999.
   Please advise immediately if you or your employer does not consent to
                Internet e-mail for messages of this kind.
        Opinions, conclusions and other information in this message
              that do not relate to the official business of
                         Transurban City Link Ltd
         shall be understood as neither given nor endorsed by it.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<---->>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Mark Richard
  INET: mrichard_at_transurban.com.au

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Thu Feb 06 2003 - 18:13:51 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US