Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


I have a small PL/SQL Block
assume in this way
begin
select * from emp where empno=100;
exception
when others then
<Some Messages>
when no_data_found then
<Some Messages>
when too_many_rows then
<Some Messages>
end;

The question which he asked was whether this block will get
executed normally or it will throw error ?


If errored out then what is the reason for the error ?

Could anybody please help me ?
Regards
Nakul Venkataraman

Answers were Sorted based on User's Feedback



I have a small PL/SQL Block assume in this way begin select * from emp where empno=100; except..

Answer / kavitha nedigunta

yes this will give error,
1.need to include the into clause.
(PLS-00428: an INTO clause is expected in this SELECT
statement)
2.as in exception block when others
should be at the bottom of the exception block.
(PLS-00370: OTHERS handler must be last among the exception
handlers of a block)

Is This Answer Correct ?    20 Yes 0 No

I have a small PL/SQL Block assume in this way begin select * from emp where empno=100; except..

Answer / virendra

yes this will give error, as in exception block when others
should be at the bottom of the exception block.

ex.

exception
when no_data_found then
<Some Messages>
when too_many_rows then
<Some Messages>
when others then
<Some Messages>
end;

Is This Answer Correct ?    19 Yes 3 No

I have a small PL/SQL Block assume in this way begin select * from emp where empno=100; except..

Answer / sdp

Yes , it will give an error as for single row queries we
need to include the into clause also
the query would be

declare
v_emp emp%rowtype%;
begin
select * into v_emp from emp where empno=100;
exception
---
---
end;

Is This Answer Correct ?    5 Yes 8 No

Post New Answer



More SQL PLSQL Interview Questions

How to find 3rd highest salary of an employee from the employee table in sql?

0 Answers  


tell us something about heap tables. : Sql dba

0 Answers  


what is a database transaction? : Sql dba

0 Answers  


if a string is there like s1,s2,s3,s4.How to find count of commas in this.

4 Answers  


7. Where would you look for errors from the database design?

1 Answers   Fintellix,






Q1.all the depts which has more then 10 empls? Q2.all the dept which does not have any emply? Q3 all the emp which does not have any dept? Q4 get all the emply detais with the dept details it dept is exit otherwise any emp details? Q5 how to debugg the dynamic sql and packages?

2 Answers  


What is normalization sql?

0 Answers  


What does joining a thread mean?

0 Answers  


Which one is better subquery or joins?

0 Answers  


how to shutdown mysql server? : Sql dba

0 Answers  


What is the difference between function and procedure in pl/sql?

0 Answers  


what is External tables? explain with examples

2 Answers   TCS,






Categories