How to find the position of a characted in a string

From: ss_postgres <ss(dot)postgres(at)gmail(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: How to find the position of a characted in a string
Date: 2008-12-08 06:30:00
Message-ID: 6c1264780812072230v6d89cbf4hf618c035d98319b4@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi,

I am trying to find the position of a character in a string which appears
multiple times.

The POSITION function returns the position of the character when it first
occurs.

For eg:

select position ( ' ' in 'Hi How are you');

This returns the result as "3".

But i need to result to be

3
7
11

Can anyone please let me know what would be the best way to do this.

Thanks

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Pawel Socha 2008-12-08 07:14:22 Re: How to find the position of a characted in a string
Previous Message AmitKumar Jain 2008-12-08 02:39:42 pg_service.con