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

Home -> Community -> Usenet -> c.d.o.server -> Re: Truncate Table Not Allowed in PL/SQL?

Re: Truncate Table Not Allowed in PL/SQL?

From: AleX <korrozia_at_my-dejanews.com>
Date: Thu, 13 May 1999 22:43:31 GMT
Message-ID: <7hfkij$10l$1@nnrp1.deja.com>


In article <926455979.23362.0.pluto.d4ee154e_at_news.demon.nl>,   "Sybrand Bakker" <postbus_at_sybrandb.demon.nl> wrote:
> Truncate is a DDL statement. DDL needs to be done by using dbms_sql
(Oracle
> 7,8) or dbms_utility.execute_ddl_statement (Oracle 8).
> Example (v7)
> declare
> cur_handle integer;
> begin
> cur_handle := dbms_sql.open_cursor;
> dbms_sql.parse(cur_handle, 'truncate table tablex1', dbms_sql.v7);
Here there needs to be a line added:

num_rows:= dbms_sql.execute (cur_handle); -- num_rows needs to be declared as a number

> dbms_sql.close_cursor(cur_handle);
> end;
>
> Hth,
> Sybrand Bakker, Oracle DBA
>
> Hi wrote in message <7ha3gm$itb$1_at_nnrp1.deja.com>...
> >A one-line stored procedure:
> >
> >CREATE OR REPLACE PROCEDURE x1 as
> >begin
> >truncate table tablex1;
> >end;
> >
> >got this error, 'PLS-00103: Encountered the symbol "TABLE" when
> >expecting one of the following: := . ( @ % ;The symbol ":= was
> >inserted before "TABLE" to continue.'
> >
> >While connected as the same user, I have no problem to execute this
> >truncate command in SQL worksheet.
> >
> >
> >Hi Chan
> >
> >
> >--== Sent via Deja.com http://www.deja.com/ ==--
> >---Share what you know. Learn what you don't.---
>
>

--

                 Alex Shterenberg

"I hate people. I think they should suffer as much as  possible, and therefore I'm into those old communist

         dictatorships." - Euronymous, Mayhem

--== Sent via Deja.com http://www.deja.com/ ==-- ---Share what you know. Learn what you don't.--- Received on Thu May 13 1999 - 17:43:31 CDT

Original text of this message

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