Re: How Do I truncate All Tbls in a Schema?

From: Rod Corderey <Lane_Associates_at_Compuserve.com>
Date: Fri, 26 Mar 1999 08:44:19 +0000
Message-ID: <36FB48E3.F20C4CD0_at_Compuserve.com>


Hi Jobi,

you can't in a single command but you can in a script like the one below,

SET ECHO OFF
SET HEADING OFF
SET FEEDBACK OFF
SET VERIFY OFF
ACCEPT OBJECT_NAME prompt "Enter name of table to be truncated [ %=all] :- "
SPOOL TRUNCTAB.TRN
SELECT 'TRUNCATE TABLE '||OBJECT_NAME||';' FROM USER_OBJECTS
WHERE OBJECT_TYPE = 'TABLE'
AND OBJECT_NAME LIKE UPPER('&OBJECT_NAME') ;
SPOOL OFF
SET HEADING ON
SET FEEDBACK ON
SET VERIFY ON
SET ECHO ON
_at_TRUNCTAB.TRN

hope it helps

regards

Rod Corderey
Lane_Associates_at_Compuserve.com
http://www.Lane-Associates.com

Jobi wrote:
>
> Hi,
>
> I just can seem to figure out the SQL to Truncate all the tables that
> belong to a specific Schema!
>
> IE I have one Schema : EricSchema with 50 Tables, How do I truncate them
> in one SQL Command?
Received on Fri Mar 26 1999 - 09:44:19 CET

Original text of this message