How do you handle exceptions. Give the syntax for it?



How do you handle exceptions. Give the syntax for it?..

Answer / guest

declare
khali exception;
a number(8);
b number(8);
begin
select count(*) into b from &table_name;
dbms_output.put_line('value of b is '||b);
if b = 0 then
raise khali;
end if;
exception
when khali then
dbms_output.put_line('are ye table to khali
nikali');
when others then
select NUM into a from furzi2;
dbms_output.put_line('Others');
end;
/

Is This Answer Correct ?    10 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

Any attempt to navigate programmatically to disabled form in a call_form stack is allowed?

0 Answers  


Hello All, Could any well write a query for the following scenario. Account(table name) No Name Amount 1 ABCD 2000.00 2 DEFG -2000.00 3 GHIJ 3000.50 4 JKLM 4000.00 5 MNOP 6000.00 O/p Should be in this format No Name Credit Debit 1 ABCD 2000.00 0 2 DEFG 0 -2000.00 3 GHIJ 3000.50 4 JKLM 0 -4000.00 5 MNOP 6000.00 o could any one give appropriate query for this Thnks in Advance Suneel Reddy

6 Answers   Target,


Is primary key is clustered index?

0 Answers  


How to select all records from the table?

0 Answers  


What is cursor and its types?

0 Answers  






what are set operators in sql? : Sql dba

0 Answers  


Do stored procedures prevent sql injection?

0 Answers  


if a table is getting updated what happens if a function is called from sql query?

2 Answers   RBS,


Explain alias in sql?

0 Answers  


what is the difference difference between procedure and packages

2 Answers   3i Infotech, Oracle,


Explain foreign key in sql?

0 Answers  


what is text? : Sql dba

0 Answers  


Categories