Problem with a parameter in a cursor
I have a problem with a cursor.
I use a like clause with a parameter in my cursor and the cursor doesn't works, no records are retrieved. It is something like this:
CREATE OR REPLACE PROCEDURE My_Proc(p_Param IN VARCHAR2) IS
CURSOR c_Cursor IS
WHERE NAME LIKE v_String;
v_String := '''' || p_Param || '%' || '''';
FOR cur_Cursor IN c_Cursor LOOP;
DBMS_OUTPUT.PUT_LINE('id_cod = ' || cur_Cursor.Id_Cod);
The dbms_output show me nothing.
If somebody knows how to do this, please, help me.
Change your v_string = line to
If you use quotes in the actual column content then just remove the last set of quotes on the v_string definition.
v_String := p_Param || '%';
At the moment you searching for something like 'A_Word%' what you should be searching for is A_Word%
Oracle Certified Professional
"Build your reputation by helping other people build theirs."
"Sarcasm may be the lowest form of wit but its still funny"
Click HERE to vist my website!
Your solution is perfect.
Thanks to it my procedure is now ok.
Thank you very much.
Click Here to Expand Forum to Full Width