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

What is a database trigger?

0 Answers  


What is range partitioning?

0 Answers  


What is difference between function and trigger?

0 Answers  


Main diff between varray and nested tablea

3 Answers   Polaris, TCS,


Table A Table B 1 1 2 1 3 1. Union & union all --> A Union B , A Union all B 2. Minus , Intersect --> A minus B , B Minus A , A Intersect B 3. Joins A join B , A Left Join B A Right Join B , A full Join B 4. %Type - Uses & Benifit 5. Truncate & Delete 6. Pragma Autonomus Transaction 7. how to Perform DDL from function or procedure 8. Can we have DML inside Function 9. Rank & Dense Rank diffrence 10. Water Mark in Oracle 11. Index , Can we have index in all column of table if no then why ?

0 Answers  






Table 1: col1 Timestamp ---------------- 01-mar-2012 11:12:46 Table 2: col2 Timestamp -------------------- 01-mar-2012 11:12:10 01-mar-2012 11:11:23 Write a query to display a row with table2 col2 value less than tabl1 col1 value. Maximum timestamp value previous to table1 col1 value. Display a result as: Col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10

0 Answers  


Explain two easy sql optimizations.

0 Answers  


What is trigger types of trigger?

0 Answers  


difference between SQL and C

1 Answers   Indus Software Technologies,


How do we accept inputs from user during runtime?

0 Answers  


How can i insert data inro a table with 3 columns using FORALL?

2 Answers   Oracle,


define sql insert statement ? : Sql dba

0 Answers  


Categories