-
Hey bright guys !! you sould know this
CURSOR report_cursor(v_namesearch VARCHAR2) IS
SELECT name, address
FROM emp AND name LIKE 'v_namesearch%';
There seems to be something wrong with the way I have defined the above cursor. Looks like, since v_namesearch is
a variable (& not a constant) , the singe quotes seems to be messing up with what I am trying to accomplish.
Shall appreciate any help.. as I seem to be stuck with this
issue >> >>
Thank you & Merry X'mas
-NK
-
CURSOR report_cursor(v_namesearch VARCHAR2) IS
SELECT name, address
FROM emp WHERE name LIKE 'v_namesearch%';
Pardon my typing the
the cursor declaration should read as above
thank,
nk
-
CURSOR report_cursor(v_namesearch VARCHAR2) IS
SELECT name, address
FROM emp WHERE name LIKE v_namesearch || '%';
Anything inside a quote is taken as a literal. Therefore, you cannot embed variables inside quotes.
Hope this helps,
- Chris
-
thanks
THANKS Chris..
But this doesn't seem to work at first glance. I will dig deeper!!
In the meanwhile let me share my views.
the clause
LIKE v_namesearch || '%';
seems to be the problem. May be because v_namesearch is a string variable, it also needs a single quotes. But how??
Any ideas.
nk
-
This should work:
LIKE ' '%'||v_namesearch||'%' ';
-
Try:
LIKE ''''|| '%'||v_namesearch||'%'||'''' OR
LIKE '''%'||v_namesearch||'%''';
Basically, '' represents " ' " .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|