Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use Cursor's Fetch to return multiple column Data

793919Oct 14 2010 — edited Oct 15 2010
Hi ,

This is my Table :

SQL> select * from Login;

USERNAME PASSWORD CONFIRMPASSWORD
--------------- --------------- ---------------
RAvi SAI SAI
Kiran Keyboard Keyboard
VARNU JAINA JAINA

This is my stored Procedure , for that Table , this is working fine , where he Cursor's Fetch is returning only a Single column of Data .

CREATE OR REPLACE PROCEDURE getEmpName(EMP_ID IN VARCHAR2)
IS
EMPNAME VARCHAR2(50);
CURSOR MYCUR
IS
SELECT USERNAME from login where USERNAME=EMP_ID;
BEGIN
OPEN MYCUR ;
LOOP
FETCH MYCUR INTO EMPNAME;
DBMS_OUTPUT.PUT_LINE(EMPNAME);

EXIT WHEN MYCUR%NOTFOUND;
END LOOP;

close MYCUR ;
END;




Now , I have a requirement as , i need to get the Password also along with Username ,
Please tell me how can i use FETCH of Cursor to populate Details into the Declared Variables
FETCH MYCUR INTO EMPNAME;













CREATE OR REPLACE PROCEDURE getEmpName(EMP_ID IN VARCHAR2)
IS
EMPNAME VARCHAR2(50);
PASSWORD VARCHAR2(50);
CURSOR MYCUR
IS
SELECT USERNAME , PASSWORD from login where USERNAME=EMP_ID;
BEGIN
OPEN MYCUR ;
LOOP
FETCH MYCUR INTO EMPNAME; // Help needed here**
DBMS_OUTPUT.PUT_LINE(EMPNAME);

EXIT WHEN MYCUR%NOTFOUND;
END LOOP;

close MYCUR ;
END;

Edited by: user10503747 on Oct 14, 2010 11:51 AM

Edited by: user10503747 on Oct 14, 2010 11:52 AM
This post has been answered by Solomon Yakobson on Oct 14 2010
Jump to Answer

Comments

Sue-user640655

Refer to the 2nd URL listed in the answer  above.

This is a known issue  Oracle as a bug 168376554 from at least a year ago.

Gouranga Tarafder

I was facing same issue. I got a quick fix and it's working.
For latest version of  Android SDK location of aapt.exe got changed. It's not any more in platform-tools. Try this:

Go to Preferences ----- > ADF Mobile --------> Platforms
Select Android.
Now Change value for Android Build Tools Location = <SDK Location>\build-tools\<SDK Build Tool Version Like :17.0.0>
Like: D:\adt-bundle-windows\sdk\build-tools\17.0.0
Enjoy

1007702
1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Nov 12 2010
Added on Oct 14 2010
3 comments
23,731 views