Cursor -- Urgent help needed
443614May 26 2005 — edited May 27 2005I 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;
/