From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Ramesh T <rameshparnanditech(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: postgres function |
Date: | 2015-10-15 15:03:58 |
Message-ID: | 561FC05E.3000509@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 10/15/2015 07:05 AM, Ramesh T wrote:
> '123-987-123' it is not fixed some times it may be '1233-9873-123-098'
> as you said it's fixed,
>
> changes the values in middle of the -
>
> sometimes times i need 1233 and 098 or 9873,first position i'll find
> direct for second variable we don't know where it's end with -
>
> i.e ,
> i need to find second postition of the variable between the '-'
Are you looking for the position or the actual variable? If you really
want the latter you can do:
select split_part('123-987-123','-',2);
select split_part('1233-9873-123-098','-',2);
Joe
--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2015-10-15 15:04:08 | Re: question |
Previous Message | Adrian Klaver | 2015-10-15 14:54:58 | Re: Installing plpython3u |