How can you create Cursor with parametres ?

Answers were Sorted based on User's Feedback



How can you create Cursor with parametres ?..

Answer / 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

How can you create Cursor with parametres ?..

Answer / madhuri

We can create cursor with parameters using parameterized
cursors.We declare the cursor in the deceleration section
with parameters.
Syntax: cursor <cursor_name>(parameters) is <select_stmt>

We pass values to these cursors while opening it.
open c1(100,'Computers');

Is This Answer Correct ?    1 Yes 0 No

How can you create Cursor with parametres ?..

Answer / amar_kondla

HI SWAPNA, I WAS C UR EXAMPLE, BUT IN PARAMETELIZED
CURSORS PARAMETERS ALWAYS IN MODE;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

Write the alter statement to enable all the triggers on the t.students table.

0 Answers  


what is bcp? When is it used?

0 Answers  


Explain isolation levels. : Transact sql

0 Answers  


What is sql keyword?

0 Answers  


How to select 10 records from a table?

0 Answers  






What are types of indexes in sql?

0 Answers  


What is Primary Key?

4 Answers   Ramco,


What is pl sql in dbms?

0 Answers  


What is an oracle stored procedure?

0 Answers  


Mention what does the hierarchical profiler does?

0 Answers  


Dear All, Question for this Week Find out possible error(s) (either at compile time or at runtime) in the following PL/SQL block. State the reason(s) and correct the errors. Declare Cursor C1 is select ename, sal, comm from emp; Begin For i in C1 Loop If i.comm between 299 and 999 then Dbms_output.put_line(i.Ename || ‘ ** Good Commission’); Elsif i.comm > 999 then Dbms_output.put_line(i.Empno || ‘ ** Very Good Commission’); close C1; Else Dbms_output.put_line(i.Ename || ‘ ** ’ ||nvl(i.comm,‘O’)); End if; End Loop; End;

7 Answers   Accenture,


Is there a 64 bit version of ssms?

0 Answers  


Categories