« Home | Sample cursors in PL/SQL » | SQL Queries » | RandomAccessFiles in Java » | Program to read excel sheet Using Java program » | Redirect output, error report to files instead of ... » | Assertions in java » | Program to copy a folder in java » | java.net.BindException: Address already in use: JV... » | java.lang.UnsupportedClassVersionError: » | Merge Sort » 

Tuesday, September 18, 2007 

Exception Handling in PL/SQL

DECLARE
MEMNAME EMP.ENAME%TYPE;
BEGIN
SELECT ENAME INTO MEMNAME FROM EMPKRIS
WHERE EMPNO = &INPUT_EMPNO;
DBMS_OUTPUT.PUT_LINE(MEMNAME);
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('No Such Employee');ed
END;
/
DECLARE
N number:=10;
Y number:=0;
i number;
begin
for i in -2..2
loop
y:=i;
begin
N:=10/y;
DBMS_output.put_line('value of N is after division is : ' || N);
Exception
When ZERO_Divide then
DBMS_output.put_line('value of Y is :: ' || Y || ' exception caught');
Y:=100;
N:=10/y;
DBMS_output.put_line('value of N is after division in exception block : ' || N);
end;
end loop;
end;

About me

  • I'm phanindra
  • From Hyderabad, Andhra Pradesh, India
  • An Alumini of JNTU Hyd into happening IT industry...
My profile

Visitors
Bloggeries Blog Directory BlogRankings.com singapore blog directory blog search directory
Google
 
Web conceptoftheday.blospot.com