CREATE OR REPLACE PROCEDURE p1
IS
l_id NUMBER;
BEGIN
SELECT employee_id
INTO l_id
FROM employees
--WHERE employee_id IN (100,200);
WHERE employee_id IN (1);
DBMS_OUTPUT.put_line ('EMPLOYEE ID ==> ' || l_id);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
DECLARE
l_id NUMBER;
l_id1 NUMBER;
PROCEDURE p1
IS
l_id NUMBER;
BEGIN
l_id := 100;
DBMS_OUTPUT.put_line ('PRO ID VALUE ==> ' || l_id);
END p1;
BEGIN
l_id := 200;
l_id1 := 300;
DBMS_OUTPUT.put_line( 'VALUE ID VALUE ==> '
|| l_id
|| CHR (10)
|| 'SECOND ID VALUE ==> '
|| l_id1);
p1;
END;
DBMS_OUTPUT.put_line ('EMPLOYEE ID ==> NO_DATA_FOUND');
WHEN TOO_MANY_ROWS
THEN
DECLARE
l_id1 NUMBER;
BEGIN
SELECT employee_id
INTO l_id1
FROM employees
WHERE employee_id IN (100);
DBMS_OUTPUT.put_line ('EMPLOYEE ID TOO MANY ROWS ==> ' || l_id1);
END;
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('EMPLOYEE ID ==> OTHERS');
END;
Thanks
Sajal Agarwal
No comments:
Post a Comment