0

My idea is to filter rows using % and an IN Variable, I am calling this procedure but it doesn't filter the rows. For example: if user types 09 the all the rows with the 09... should appear. I have also tried to use concat but also can't filter. I would appreciate any help you can give me.

This is the procedure

delimiter //
create procedure p (in cedula1 varchar(10))
begin
    select * from view_pacientes
-- THIS PART IS WRONG BUT I DONT KNOW HOW TO CORRECT IT TO WORK PROPERLY.
    where cedula1+"%" like cedula;

end//
1
  • This is clearly MySQL so I removed the sql-server tag. Commented Mar 11, 2015 at 0:10

1 Answer 1

2

It think this is the syntax you want in MySQL:

select *
from view_pacientes
where cedula like concat(cedula1, '%') ;

When you are defining a stored procedure in MySQL, I would recommend that you prefix your arguments with something that makes them special. My preference is in_ and out_ for "in" and "out" parameters.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.