Received: from uu-t1-6.visgen.com (uu-t1-6.visgen.com [216.94.71.6]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f6NI2Tf93286 for ; Mon, 23 Jul 2001 14:02:29 -0400 (EDT) (envelope-from dorin@visgen.com) Message-Id: <4.3.2.7.2.20010723135813.00b50630@pophost> X-Sender: dorin@pophost X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Date: Mon, 23 Jul 2001 13:58:52 -0400 To: karl@tecc.co.uk (Karl Orbell), pgsql-sql@postgresql.org From: Dorin Grunberg Subject: Re: position(text,text) function In-Reply-To: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=====================_16626521==_.ALT" X-Virus-Scanned: by VGI Postfix Mcafee VirusScan 4.x X-Archive-Number: 200107/316 X-Sequence-Number: 4125 --=====================_16626521==_.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed The correct way would be: select position('el' in 'Hello'); Dorin At 02:27 PM 7/23/01 +0000, Karl Orbell wrote: >I'm having trouble using the position function, it's a simple built-in >function. > >It returns the index of a substring within a main string. > >But, I just can't get it to work, it always gives this silly parser error. >I've tried it in a variety of ways with variables instead of constants >casting >to text and using it in other contexts, (ie. in functions, not just in a >select). What am I doing wrong? Is this not the correct syntax for a two >argument function? > >test=# select position('hello','el'); >ERROR: parser: parse error at or near "," > > >Karl Orbell. > > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org --=====================_16626521==_.ALT Content-Type: text/html; charset="us-ascii" The correct way would be:

select position('el' in 'Hello');

Dorin

At 02:27 PM 7/23/01 +0000, Karl Orbell wrote:
I'm having trouble using the position function, it's a simple built-in function.

It returns the index of a substring within a main string.

But, I just can't get it to work, it always gives this silly parser error.
I've tried it in a variety of ways with variables instead of constants casting
to text and using it in other contexts, (ie. in functions, not just in a
select).  What am I doing wrong?  Is this not the correct syntax for a two
argument function?

test=# select position('hello','el');
ERROR:  parser: parse error at or near ","


Karl Orbell.


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

--=====================_16626521==_.ALT--