Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id B555264FC45 for ; Mon, 8 Dec 2008 02:30:06 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 70709-05 for ; Mon, 8 Dec 2008 02:30:02 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.227]) by mail.postgresql.org (Postfix) with ESMTP id EC73264FC2F for ; Mon, 8 Dec 2008 02:30:01 -0400 (AST) Received: by rv-out-0506.google.com with SMTP id b25so1036633rvf.43 for ; Sun, 07 Dec 2008 22:30:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=d/kfLEEmEk/CK2+xNpQCNtaqpUxo/in1TYUheeS1AFg=; b=TpIJ9ElQbYrzv11AeRnijJ9eC5I6VU/0FV+sWNC2CYVsensD/ZIkPDqTSn2hE5EsWr NlEElrihHm2YlsswUlOXxcyNi/fpfCA/shwqHUNNtAvHt4n82zalzAb9y4LcZUVkzDEf 8ijw+y2rN/3MC9CsrtQUjDZnp9GDQRxk7+lBc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=U+KjKZm7rrs4rt13AXdfSKKdBTgGyLvmQq41qKro/isSqcGTh5lYvQaMf+GsFpl9XM r/A483vH6n/SF42ZOIZX1RZ2cm5RktbocWxqZQkVmwVkktBuA4x2f1FsU+EBjMhroqhW NNxq8ps+RHuGr92OWZwYJl1k+bA26bUHiPqv8= Received: by 10.140.163.12 with SMTP id l12mr1488706rve.178.1228717800612; Sun, 07 Dec 2008 22:30:00 -0800 (PST) Received: by 10.141.43.3 with HTTP; Sun, 7 Dec 2008 22:30:00 -0800 (PST) Message-ID: <6c1264780812072230v6d89cbf4hf618c035d98319b4@mail.gmail.com> Date: Mon, 8 Dec 2008 17:00:00 +1030 From: ss_postgres To: pgsql-admin@postgresql.org Subject: How to find the position of a characted in a string MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_58440_4225038.1228717800595" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200812/41 X-Sequence-Number: 30874 ------=_Part_58440_4225038.1228717800595 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ------=_Part_58440_4225038.1228717800595 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
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
 
------=_Part_58440_4225038.1228717800595--