CREATE OR REPLACE PROCEDURE BATCH_DELETE
(
P_TABLENAME IN VARCHAR2,
P_CONDITION IN VARCHAR2,
P_RESULT OUT NUMBER
)
AS
BEGIN
EXECUTE IMMEDIATE
‘DELETE FROM ‘ || P_TABLENAME || ‘ WHERE ‘ || P_CONDITION ;
IF SQL%NOTFOUND THEN
P_RESULT :=0;
--EXIT;
ELSE
P_RESULT :=SQL%ROWCOUNT;
END IF;
COMMIT;
DBMS_OUTPUT.PUT_LINE(‘FINISHED!‘);
DBMS_OUTPUT.PUT_LINE(‘TOTALLY ‘||TO_CHAR(P_RESULT)||‘ RECORDS DELETED!‘);
END;
时间: 2024-10-01 06:14:12