Wednesday, September 30, 2020

RDBMS PLSQL Program 27 Program to handle oracle named exception

 set serveroutput on

DECLARE 

   veno emp.eno%type; 

   vename emp.ename%type; 

   vesalary emp.esalary%type; 

BEGIN 

   veno := '&veno';

   SELECT  ename, esalary INTO  vename, vesalary 

   FROM emp

   WHERE eno = veno;  

   DBMS_OUTPUT.PUT_LINE ('Name: '||  vename); 

   DBMS_OUTPUT.PUT_LINE ('Salary: ' || vesalary); 

EXCEPTION 

   WHEN no_data_found THEN 

      dbms_output.put_line('No such employee!'); 

END; 

/

No comments:

Post a Comment

Thanks for showing your interest
I will shortly get back to you