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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Truncate statement within PL/SQL procedure won't compile!

Re: Truncate statement within PL/SQL procedure won't compile!

From: freek <freekdhooge_at_hotmail.com>
Date: Wed, 21 Feb 2001 22:20:00 GMT
Message-ID: <kaXk6.15549$Ut1.1455305@afrodite.telenet-ops.be>

create a procedure with the following code

procedure P_truncate_exec
(string_1 in varchar2)

is
Begin
declare

    cursor_name integer;
    probeersel integer;
begin

    cursor_name := dbms_sql.open_cursor;     dbms_sql.parse(cursor_name, string_1, dbms_sql.v7);     --set_sql_stm(string_1);
    probeersel := dbms_sql.execute(cursor_name);     dbms_sql.close_cursor(cursor_name);
end;
end p_truncate_exec;

after that you put in your original in your original PL/SQL something like

begin
declare

    sqlstring varchar2(50);
begin

sqlstring := 'truncate table yourtable'; p_truncate_exec(sqlstring);

greetings
Freek D'Hooge

"Dave Sutton" <dpsutton_at_marchsystems.co.uk> wrote in message news:970b4t$ej2$1_at_newsreaderg1.core.theplanet.net...
> Hi,
>
> Has anyone else experienced this?
>
> I'm logged on as the schema owner of the table in question and can
> successfully execute a truncate statement on that table outside of a
 PL/SQL
> procedure but as soon as I put the statement inside the procedure, the
> procedure will no longer compile!
>
> The procedure compiles if I change the TRUNCATE to a DELETE statement.
>
> What am I missing??
>
> Thanks in advance.
>
>
> Dave Sutton
>
>
Received on Wed Feb 21 2001 - 16:20:00 CST

Original text of this message

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