Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: using LIKE in a Stored procedure...
alan and Ingi <brownyen_at_pacbell.net> wrote in message
news:39a04523.912181_at_news-ituk.to...
| I am a relative newbie. Would appreciate being pointed to the right
| newsgroup if this is not it.
|
| I am trying to write a stored procedure which takes a parameter and
| returns all rows from a table where a specific column contains this
| string parameter.
|
| If that is as clear as mud then perhaps the code might help
|
|
| CREATE function search (searchString VARCHAR2(20))
| RETURN tablename%ROWTYPE
| IS
| BEGIN
| SELECT * FROM tablename
| WHERE columnName LIKE '%searchString%'
|
| END
|
| Please forgive the syntax errors. The key line is the last one.
| Obviously this will not work as is because the searchString is in
| quotes. So how can I achieve my aim. I tried a few different things
| that did not seem to work. Any help would be greatly appreciated!
Concatentation is your friend: '%' || searchString || '%'
-- ThomasReceived on Sun Aug 20 2000 - 16:17:53 CDT