Use The Implicit cursor to Query The Department table information Where Deptno is 30.check,if no record was found then print "Record Was Not Found".Else Print Deptname And Ename.Dept table Have Dname Varchar2(20),Deptno Number,EnameVarchar2(20).Please Answer In 2 mins,with in Maximum 15 lines.

Answers were Sorted based on User's Feedback



Use The Implicit cursor to Query The Department table information Where Deptno is 30.check,if no rec..

Answer / vikas gupta

Declare
l_deptname dept.deptname%Type;
l_ename dept.ename%type;
Begin
select deptname,ename
into l_deptname,l_ename
from dept
where dept_no = 30;

if sql%notfound then
dbms_output.put_line("Record was not Found")
else
dbms_output.put_line("Deptname=" l_deptname);
dbms_output.put_line("Ename=" l_ename);
end if;

end;

Is This Answer Correct ?    10 Yes 8 No

Use The Implicit cursor to Query The Department table information Where Deptno is 30.check,if no rec..

Answer / debasis mohanty

If That dept 30 contains more than 1 employee then your answer is wrong
erorr:exact fetch returns more than 1 rows

Is This Answer Correct ?    3 Yes 1 No

Use The Implicit cursor to Query The Department table information Where Deptno is 30.check,if no rec..

Answer / swastik

declare
v_deptno number(2) := &gdeptno;
v_dname varchar2(20);
v_ename   varchar2(20);
begin
select deptno, dname, ename into v_deptno, v_dname, v_ename 
from dept
where deptno = v_deptno;
dbms_output.put_line(v_deptno|| ' '||v_dname||' '||v_ename);
exception
when no_data_found
then
dbms_output.put_line('record was not found');
end;
/

Is This Answer Correct ?    2 Yes 0 No

Use The Implicit cursor to Query The Department table information Where Deptno is 30.check,if no rec..

Answer / dmddebasismohanty183

Please Send Me The Answer





Thanks And Regards
Debasis Mohanty
dmdebasismohanty183@gmail.com
Contact:08722140827

Is This Answer Correct ?    0 Yes 0 No

Use The Implicit cursor to Query The Department table information Where Deptno is 30.check,if no rec..

Answer / xyz

declare
cursor mycursor is
select dname,ename from emp ,dept where emp.deptno=dept.deptno and dept.deptno=30;
v_dname dept.dname%type;
v_ename emp.ename%type;
begin
open mycursor;
loop
exit when mycursor%notfound;
fetch mycursor into v_dname,v_ename;
exception
when no_data_found then
dbms_output.put_line(v_dname||' '||v_ename);
end loop;
close mycursor;
end;

Is This Answer Correct ?    2 Yes 6 No

Post New Answer

More SQL PLSQL Interview Questions

If i can use sys.check_constraints to display my constraints from my database using sql server 2005, how can i display then if i am using sql server 2000????

0 Answers  


i have a table like this. i want to output like this c1 c2 c1 c2 1 10 1 10 2 20 2 30 3 30 3 60 4 40 4 100 5 5 5 105 c1 and c2 are columns in a table .i want output like this c2 values are 10,10+20,10+20+30,10+20+30+40.10+20+30+40+5. write a sql query.pls help this i want urgent.

2 Answers   IBM, Loginworks, OFSS,


how to retrieve the top 2 salaried persons from a database?

7 Answers   Orion Laboratories,


How does index help in query performance?

0 Answers  


Question: Below is the table city gender name delhi male a delhi female b mumbai male c mumbai female d delhi male e I want the o/p as follows: male female delhi 2 1 mumbai 1 1 Please help me in writing the query that can yield the o/p mentioned above?

2 Answers  






How do you exit in sql?

0 Answers  


what is Hash join?how it is different from inner join?what is the sign used for inner join?(eg: like the (+) sign used for outer join)?

3 Answers   TCS,


What is self-join and what is the requirement of self-join?

0 Answers  


What is the basic form of sql query?

0 Answers  


how to select first 5 records from a table? : Sql dba

0 Answers  


What is indexing oracle sql?

0 Answers  


what are pl/sql collections?

4 Answers   JPMorgan Chase, Oracle,


Categories