Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Truncate Table in a Stored Procedure... 1

Status
Not open for further replies.

THoey

IS-IT--Management
Jun 21, 2000
2,142
US
I know I have seen this before, but the keyword search is still down.

I need to create a stored procedure with the following code:
Code:
CREATE PROCEDURE EHGRIFF.TRUNC_STATIC_TABLES IS 
BEGIN

TRUNCATE TABLE EHGRIFF.C_AGENT;

END;
When I run this, I get the following message:
Code:
MGR-00073: Warning: PROCEDURE EHGRIFF.TRUNC_STATIC_TABLES created with compilation errors.
The error shows up as:
Code:
Line # = 4 Column # = 10 Error Text = PLS-00103: Encountered the symbol "TABLE" when expecting one of the following:

   := . ( @ % ;
The symbol ":= was inserted before "TABLE" to continue.
There was something about another command you needed to be able to execute DDL statements in a stored procedure.

Any help would be greatly appreciated...
Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
I suspect that you need to execute the statement like this:

sql_trunc VARCHAR2(1000) :=NULL;

sql_trunc := 'TRUNCATE TABLE EHGRIFF.C_AGENT';
EXECUTE IMMEDIATE sql_trunc;
 
Thanks!!! Works great!!! Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top