Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Truncate statement within PL/SQL procedure won't compile!
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