Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: TRUNCATE from a stored procedure?
On Sun, 25 May 1997 15:15:12 -0400, "Panther" <rollman_at_one.net> wrote:
>If anyone can tell me how this might be accomplished, I'd appreciate it.
This function should do the trick for you:
CREATE OR REPLACE
FUNCTION Truncate_Table (vTableName IN varchar2)
RETURN integer
IS
iCursorID integer; vCommand varchar2 (80); iReturned integer; xNO_TABLE_NAMED EXCEPTION;
BEGIN
IF (vTableName IS NULL) THEN
RAISE xNO_TABLE_NAMED;
END IF;
vCommand := 'TRUNCATE TABLE ' ||
vTableName;
iCursorID := DBMS_SQL.Open_Cursor;
DBMS_SQL.Parse (iCursorID,
vCommand, DBMS_SQL.v7);
iReturned := DBMS_SQL.Execute (iCursorID); DBMS_SQL.Close_Cursor (iCursorID);
RETURN 1;
EXCEPTION
WHEN OTHERS THEN
RETURN 0;
END Truncate_Table;
/
If not, let me know and we'll try something else.
Jonathan Ingram Received on Sun May 25 1997 - 00:00:00 CDT
![]() |
![]() |