Jump to content
ChetanaSforum
Sign in to follow this  
Rijesh

'like' operator!!!

Recommended Posts

Hello friends.Hope you can help me.....I just want to work with parameters in the "like" operator.This is a simple stored procedureI want to retrieve the "names " from the 'employee' table starting with the "passed parameter".-----------------------------------------create procedure sp_proc1@name as varcharasbeginselect emp_name from employee where emp_name like '"@name"%'endgo-----------------------------------------The issue is that the above procedure cannot retrieve the values!!!Am I doing right??? Is there any other solution???Can the LIKE operator used with parametric values??help me...........waiting & thanks in advance ......Rijesh

Share this post


Link to post
Share on other sites

Hello friends.Hope you can help me.....I just want to work with parameters in the "like" operator.This is a simple stored procedureI want to retrieve the "names " from the 'employee' table starting with the "passed parameter".-----------------------------------------create procedure sp_proc1@name as varcharasbeginselect emp_name from employee where emp_name like '"@name"%'endgo-----------------------------------------The issue is that the above procedure cannot retrieve the values!!!Am I doing right??? Is there any other solution???Can the LIKE operator used with parametric values??help me...........waiting & thanks in advance ......Rijesh

create or replace procedure sp_get_name(p_name in varchar2,p_o_val out sys_refcursor)isbeginopen p_o_val forselect *from empwhere lower(e_name) like '%p_name%';end sp_get_name;/To execute the procedure follow the steps:sql>set autoprint onsql>variable name refcursor;sql>execute sp_get_name('arpan',:name);

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×