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: signature.asc
Description: OpenPGP digital signature

Reply via email to