CREATE OR REPLACE PROCEDURE "DEPARTMENT_DELETE" (
"P_ID" IN NVARCHAR2) IS
BEGIN
DELETE FROM DEPARTMENT WHERE ID IN P_ID;
END;
想批量删除ID为1~5的记录,传入参数1,2,3,4,5无法实现。
请问sql语句应该怎么写?
------解决方案--------------------
CREATE OR REPLACE PROCEDURE DEPARTMENT_DELETE
( "P_ID" IN NVARCHAR2) IS
v_sql varcha2(2000);
BEGIN
v_sql:='DELETE FROM DEPARTMENT WHERE ID IN ('
------解决方案--------------------
P_ID
------解决方案--------------------
')';
Execute Immediate v_sql;
END;