Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: using LIKE in a Stored procedure...

Re: using LIKE in a Stored procedure...

From: Thomas Muller <ttm_at_online.no>
Date: Sun, 20 Aug 2000 23:17:53 +0200
Message-ID: <nZXn5.6923$By6.121272@news1.online.no>

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 || '%'

--

Thomas
Received on Sun Aug 20 2000 - 16:17:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US