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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of the sql select top clause?

557


Can we use loop in sql?

537


What are all the different types of indexes?

625


What is mutating error?

511


a table has 2 classifications 1)liabilities 2)earnings this liabitity has 2 elements with 2 input values and the earnings have 2 elements with 2 input values i wrote a query so that my input is liability savings amount1 amount2 xxxx null xxxxxx 0 xxx1 null xxxxx1 0 null yyyy 0 yyyy null yyy1 0 yyy1 my problem is --when i developed a report(d2k) with this data my o/p is liabilities,amount1,savings,amount2 xxxx xxxxxx xxx1 xxxxx1 yyyy yyyy yyy1 yyy1 how could i move this savings,savings values 2 palces up. can any body provide me witha better solution

1778






Explain the difference between 'between' & 'and' operators in sql

531


Can there be more than one function with a similar name in a pl/sql block?

549


How does a self join work?

520


Write the order of precedence for validation of a column in a table? I. Done using database triggers. Ii. Done using integarity constraints

642


How do I copy a table in sql?

517


What is the usage of when clause in trigger?

571


How exception is different from error?

545


What is sql dialect?

531


What is the best free sql database?

572


What is the difference between database trigger and stored procedure?

557