Re: [SQL] substring

From: Nuchanard Chiannilkulchai <nuch(at)valigene(dot)com>
To: pgsql-sql(at)hub(dot)org
Subject: Re: [SQL] substring
Date: 1999-04-28 12:02:32
Message-ID: 3726F8D8.85E9B69A@valigene.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tom Lane wrote:

> Nuchanard Chiannilkulchai <nuch(at)valigene(dot)com> writes:
> > The problem is : select position ('_' in a ) from table_a does not
> > work.
> > ERROR: No such function 'strpos' with the specified attributes
>
> Hmm, I don't see that under either 6.4.2 or current sources.
>
> What data type is your column a? I tried text and char(n) and neither
> one gave an error...
>
> regards, tom lane

the datatype of a is char(8).

select a, substring(a from 1 for position('_' in a) - 1) as part from
test;
This solution from José works great, THANX.

Nuch

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Herouth Maoz 1999-04-28 15:58:14 Re: [SQL] OUTER JOINS
Previous Message Christophe Labouisse 1999-04-28 05:22:43 Re: [SQL] Strange behavior