Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

writing a search function

ArunkumarGunasekaranJan 17 2013 — edited Jan 21 2013
Hello Folks,

I have written the below mentioned search() function which takes a 'one word' as an input parameter and searches a couple of CLOB datatype columns in my product table and returns the name and id of the corresponding product.
---  SEARCH FUNCTION ---- 
---  THE USER ENTERED KEYWORD IS SEARCHED IN THE PRODUCT DESCRIPTION COLUMN AND PRODUCT TAGS COLUMN
function search (search_string varchar) return datacursor as dataset datacursor;
begin
          open dataset for 
          select prod_key,prod_name from dim_product
          where contains (prod_keyword, concat(concat('%',search_string),'%')) >0 or contains (prod_desc, concat(concat('%',search_string),'%')) >0;     
return dataset;
end search;
note :
type datacursor is ref cursor;
The code is working fine. Now I want to expand this function from one word search to many words that the user passes into the function to search the table. How can I achieve that?

Thanks!
Arun
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 18 2013
Added on Jan 17 2013
7 comments
401 views