pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: ss_postgres <ss.postgres@gmail.com>
To: pgsql-admin@postgresql.org
Subject: How to find the position of a characted in a string
Date: Mon, 8 Dec 2008 17:00:00 +1030
Message-ID: <6c1264780812072230v6d89cbf4hf618c035d98319b4@mail.gmail.com> (raw)

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

view thread (4+ messages)  latest in thread

Message-ID: <6c1264780812072230v6d89cbf4hf618c035d98319b4@mail.gmail.com>
Permalink:  ../6c1264780812072230v6d89cbf4hf618c035d98319b4@mail.gmail.com/
Also on:    postgresql.org/message-id/6c1264780812072230v6d89cbf4hf618c035d98319b4@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: ss.postgres@gmail.com
  Subject: Re: How to find the position of a characted in a string
  In-Reply-To: <6c1264780812072230v6d89cbf4hf618c035d98319b4@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox