no output shown [message #614777] |
Tue, 27 May 2014 02:35 |
|
mist598
Messages: 1195 Registered: February 2013 Location: Hyderabad
|
Senior Member |
|
|
Hi,
why it is not displayed any output's ?
SQL> set serveroutput on
SQL> DECLARE
2 CURSOR c1 (dpno emp.deptno%TYPE)
3 IS
4 SELECT *
5 FROM emp
6 WHERE deptno = dpno;
7 i c1%ROWTYPE;
8 dpno emp.deptno%TYPE;
9 BEGIN
10 OPEN c1(dpno);
11 LOOP
12 FETCH c1
13 INTO i;
14 EXIT WHEN c1%NOTFOUND;
15 DBMS_OUTPUT.put_line (c1%ROWCOUNT);
16 END LOOP;
17 CLOSE c1;
18 END;
19 /
PL/SQL procedure successfully completed.
SQL>
|
|
|
|
|
|
Re: no output shown [message #614783 is a reply to message #614780] |
Tue, 27 May 2014 02:52 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
mist598 wrote on Tue, 27 May 2014 13:15i added below line in,then why i am not getting Hai on the output..
FETCH c1 INTO i;
EXIT WHEN c1%NOTFOUND;
DBMS_OUTPUT.put_line (c1%ROWCOUNT);
DBMS_OUTPUT.put_line ('Hai'); --->This!
END LOOP;
There are no records to fetch. Hence, it comes out of loop when %NOTFOUND is true. So, it never goes to dbms_output line.
|
|
|