Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

TRUNCATE TABLE does not work in PL/SQL - Why?

531621Feb 19 2007 — edited Feb 26 2007
Hey there!

Is there any issue with truncate table not working inside an PL/SQL package?

For example this function:

PROCEDURE FLUSH_TABLE(vi_table_name VARCHAR2) IS
vn_table_name VARCHAR2(30);
BEGIN
vn_table_name := UPPER(LTRIM(RTRIM(vi_table_name)));
TRUNCATE TABLE vn_table_name;
END FLUSH_TABLE;

returns the following error msg:



Error: PLS-00103: Encountered the symbol "TABLE" when expecting one of the following:

:= . ( @ % ;
The symbol ":= was inserted before "TABLE" to continue.
Line: 5926
Text: TRUNCATE TABLE VN_TABLE_NAME;

Can somebody explain me the problem here? In my point of view, the error msg is not quite right ;)

Regards,
Thomas
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 26 2007
Added on Feb 19 2007
11 comments
16,930 views