Skip to Main Content

Oracle Database Discussions

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!

Cursor -- Urgent help needed

443614May 26 2005 — edited May 27 2005
I have to check the validity of the input parameter(whether the input value is in the table or not)
I'm fetching all the values of a column from a table using CURSOR;I have to check whether a particular value say 'A' is present in the fetched values.When I tried to do as below its printing value does not exist even if the input value is in the table.How can I do this?
Can anyone pls help me? Thanks in advance.



CREATE OR REPLACE PROCEDURE v(a_c_name VARCHAR2)IS
CURSOR a_cur(a_name VARCHAR2) IS
SELECT afield
FROM atable;
aname VARCHAR2(10);
OPEN a_cur(a_c_name);
LOOP
FETCH a_cur into aname;
EXIT WHEN a_cur%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘’||a_c_name||aname);
IF gv_city_name != cname
THEN
DBMS_OUTPUT.PUT_LINE(‘’||a_c_name ||’ does not exist!’);
EXIT;
END IF;
END LOOP;
CLOSE city_cur;
COMMIT;
END v;
/




Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 24 2005
Added on May 26 2005
21 comments
302 views