SQL>
SQL> CREATE or replace PROCEDURE delete_rows (table_name IN VARCHAR2,condition IN VARCHAR2 DEFAULT NULL) AS
2 where_clause VARCHAR2(100) := ' WHERE ' || condition;
3 BEGIN
4 IF condition IS NULL THEN
5 where_clause := NULL;
6 END IF;
7 EXECUTE IMMEDIATE 'DELETE FROM ' || table_name || where_clause;
8 END;
9 /
Procedure created.
SQL>
|