Re: postgres function - Mailing list pgsql-general

From Joe Conway
Subject Re: postgres function
Date
Msg-id 561FC05E.3000509@joeconway.com
Whole thread Raw
In response to Re: postgres function  (Ramesh T <rameshparnanditech@gmail.com>)
List 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


Attachment

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Installing plpython3u
Next
From: Adrian Klaver
Date:
Subject: Re: question