Using SQL%FOUND
DROP TABLE dept_temp CASCADE CONSTRAINTS PURGE;
CREATE TABLE dept_temp
AS
SELECT *
FROM departments;
DECLARE
dept_no NUMBER(4) := 270;
BEGIN
DELETE FROM dept_temp
WHERE department_id = dept_no;
IF SQL%FOUND THEN -- delete succeeded
INSERT INTO dept_temp
VALUES (270,
'Personnel',
200,
1700);
END IF;
END;
/
0 comments:
Post a Comment