Answer Posted / swapna
CREATE OR REPLACE procedure emp_disp1(DNO EMP.DEPTNO%TYPE)
is
CURSOR CN(DNO1 NUMBER) IS SELECT * FROM EMP WHERE DEPTNO =
DNO;
CV CN%ROWTYPE;
begin
IF CN%ISOPEN THEN
DBMS_OUTPUT.PUT_LINE('CURSOR ALREADY OPEN');
ELSE
OPEN CN(DNO);
DBMS_OUTPUT.PUT_LINE('CURSOR OPEN NOW');
END IF;
FETCH CN INTO CV;
WHILE CN%FOUND LOOP
dbms_output.put_line('employee
id'||' '||CV.EMPNO||'employee
name'||' '||CV.Ename||'employee
managerid'||' '||CV.mgr||'employee
salary'||' '||CV.sal||'eEMPLOYEE DEPT
ID'||CV.DEPTNO);
FETCH CN INTO CV;
END LOOP;
DBMS_OUTPUT.PUT_LINE('NUMBER OF FETCHES IS '||CN%ROWCOUNT);
CLOSE CN;
exception
when no_data_found then
dbms_output.put_line('record not existed');
when too_many_rows then
dbms_output.put_line('record not existed');
end;
/
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is a unique constraint?
what is the use of friend function? : Sql dba
What are the ways on commenting in a pl/sql code?
- Types of triggers - View - Dcl - Procedures, packages, functions - Metasolve - Can use Dcl in triggers - package case study - Cursor and its types - triggers schedule - Wrap - Why we are using fetch and for in cursor. difference?
how to increment dates by 1 in mysql? : Sql dba
What is the use of procedures?
How do you write a subquery?
what is commit? : Sql dba
Is sql a case sensitive language?
What is embedded sql in db2?
Which one is better subquery or joins?
What is the difference between join and natural join?
what is clause? : Sql dba
How to select random rows from a table?
how does a local variable is defined using t-sql? : Transact sql