Home » SQL & PL/SQL » SQL & PL/SQL » How to delete all the rows from a table?
How to delete all the rows from a table? [message #39466] Thu, 18 July 2002 07:11 Go to next message
figen
Messages: 10
Registered: July 2002
Junior Member
Truncate or Delete? I know Delete might cause a lot of rollback and fire all the delete triggers. But I cannot use "Truncate" command from a procedure, because it is DDL command.
I am writng a Java script which will call Procedure and take the "table_name" as an argument and delete all the rows in that table.

Is there any way doing this from a Java Script other than Procedure or how should be the procedure?

Thanks in advance
Re: How to delete all the rows from a table? [message #39468 is a reply to message #39466] Thu, 18 July 2002 07:57 Go to previous messageGo to next message
MS
Messages: 11
Registered: September 2000
Junior Member
try this out

execute immediate 'TRUNCATE TABLE tablename';

-- MS
Re: How to delete all the rows from a table? [message #39481 is a reply to message #39466] Thu, 18 July 2002 14:06 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
Just remember that TRUNCATE is a DDL command and DDL does an implicit commit. Also look at global temporary tables - see the documentation.
Previous Topic: sql*loader Create a field in loading
Next Topic: SQL DateTime
Goto Forum:
  


Current Time: Thu Apr 18 09:49:24 CDT 2024