Re: [SQL] plpgsql.. SELECT INTO ... WHERE FIELD LIKE

2004-12-16 Thread Christopher Browne
Oops! [EMAIL PROTECTED] ("Yudie") was seen spray-painting on a wall: > How in plpgsql use LIKE with a variable? > > let say I want to do this query: > SELECT INTO RS id FROM customer WHERE firstname LIKE keyword% LIMIT 1; > > keyword is a variable, in this case I want to find name like 'Jo%' >

Re: [SQL] plpgsql.. SELECT INTO ... WHERE FIELD LIKE

2004-12-16 Thread Christopher Browne
Try: SELECT INTO RS ID FROM CUSTOMER WHERE FIRSTNAME LIKE KEYWORD || ''%'' LIMIT 1; You append KEYWORD and a '%' together using ||. You need to use doubled quotes inside the quoted environment; one gets stripped off so that the stored procedure will contain the query SELECT INTO RS ID FRO

Re: [SQL] plpgsql.. SELECT INTO ... WHERE FIELD LIKE

2004-12-16 Thread Michael Fuhr
On Thu, Dec 16, 2004 at 05:53:43PM -0600, Yudie wrote: > How in plpgsql use LIKE with a variable? > > let say I want to do this query: > > SELECT INTO RS id FROM customer WHERE firstname LIKE keyword% LIMIT 1; > > keyword is a variable, in this case I want to find name like 'Jo%' Use the

[SQL] plpgsql.. SELECT INTO ... WHERE FIELD LIKE

2004-12-16 Thread Yudie
How in plpgsql use LIKE with a variable?   let say I want to do this query:   SELECT INTO RS id FROM customer WHERE firstname LIKE keyword% LIMIT 1;   keyword is a variable, in this case I want to find name like 'Jo%'     Full functio