GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Oracle  >  PL/SQL

 Print  |  
Question:  In PL/SQL if we write select statement with INTO clause it may return two exceptions NO_DATA_FOUND or TOO_MANY_ROW . To do you avoid these execeptions. How do you write SQL statement in alternative way?



March 03, 2007 01:08:58 #2
 Nikhil_4_Oracle   Member Since: Visitor    Total Comments: N/A 

RE: In PL/SQL if we write select statement with INTO c...
 
HI All,

There is no solution for NO_DATA_FOUND else you handle it using Exception block as i

do above...

well TOO_MANY_ROWS is programming fault, when
your select query

uses "=" operator then may be there is Too_many_rows exception, to avoid this

always use "IN" operator in u r select Query.


i.e

select empno, ename into eid, enam from emp

where deptno IN (select deptno from emp where sal>3000);

Thanks,

Nikhil.
     

 

Back To Question