Gabriel,

If you defined column "code" as a CHAR(n), you will need to have a "%"
wildcard at the end of your search string to allow for padding.

select code from codes where code like '(4)%' ;

Example:
business=> create table foo ( mytext char(10) );
CREATE
business=> insert into foo values ('4');
INSERT 120479 1
business=> insert into foo values ('(4)');
INSERT 120480 1
business=> select * from foo;
mytext    
----------
4         
(4)       
(2 rows)

business=> select * from foo where mytext like '(4)';
mytext
------
(0 rows)

business=> select * from foo where mytext like '(4)%';
mytext    
----------
(4)       
(1 row)


Phil Culberson
DAT Services

-----Original Message-----
From: Gabriel Fernandez [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 21, 2000 4:47 AM
To: PostgreSQL-general
Subject: [GENERAL] Problem with LIKE operator 


Hi,

I have some problems using LIKE within strings which have brackets.

For example if i do:

select code from codes where code like '(4)' ;

i do not obtain nothing. But in the DB indeed there is a row whose code
is '(4)'.

I have tried to escape the brackets with '\\(4\\)' or with ' \(4\)' but
it doesn't work.

How can i do it ?

Gabi :-)

Reply via email to