|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Like query problems
Hi, Im new in the forum and new using Firebird too.
I hope someone can help me how do I use the statement "like", Im been looking in the web but can't find anything. I try to do something like select from where [Attribute] like ' % :NAME % ' Assuming that the parameter :NAME is the input value. Im using a Store Procedure as follow: SET TERM ^ ; PROCEDURE CONSULTAR_ARTISTAS_NACIONALES ( NOMBRE_ARTISTA Varchar(150), RESIDENCIA Varchar(100) ) RETURNS ( NOMBRE Varchar(150), RESIDEN Varchar(100), AS BEGIN FOR SELECT NOMBRE_ARTISTA, LUGAR_RESIDENCIA FROM ARTISTAS_NACIONALES WHERE LUGAR_RESIDENCIA like '%:RESIDENCIA%' INTO :NOMBRE, :RESIDEN DO SUSPEND; END^ SET TERM ; ^ But it seems that the variable between '%%' is not get it by the firebird instead take it like a common string but with : , is there something Im missing? Please help and sorry for my english ![]() |
|
#2
|
|||
|
|||
|
Quote:
WHERE LUGAR_RESIDENCIA like :RESIDENCIA Note: 1. No quotes round the parameter. 2. Pass in the % sign as part of your parameter value. Also, you do not need to pass in NOMBRE_ARTISTA, you are not using it in your where clause. Code:
SELECT NOMBER, RESIDEN
FROM CONSULTAR_ARTISTAS_NACIONALES('%RESIDENCIA%')
Also, passing in the % as part of the parameter allows you to determine whether you will put it at the start, the end or both. Clive Last edited by clivew : October 27th, 2006 at 04:45 PM. |
|
#3
|
|||
|
|||
|
you should not put the :NAME between quotation marks
make the select like: Quote:
and in the parameter send your string " '%whatever%' ". and that is all. |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Like query problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|