Newbie in functions

From: Eduardo_Cadena(at)praxair(dot)com
To: pgsql-novice(at)postgresql(dot)org
Subject: Newbie in functions
Date: 2002-04-17 14:52:43
Message-ID: OF971F569C.5DDD7BD2-ON86256B9E.0051AFC5@praxair.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I´m trying to create a function to obtain the possition of a substring, but
i don't kown if is correct
can anyone can help me to do this?

test=# CREATE FUNCTION pos1 (int4) RETURNS int4 AS '
test'# UPDATE tabla1
test'# SET posicion1 = position('pm' in SELECT string1 FROM tabla1 WHERE
id = $1)
test'# WHERE id = $1;
test'# SELECT posicion1 FROM tabla1 WHERE id = $1;
test'# 'LANGUAGE sql;
ERROR: parser: parse error at or near "pm"
test=#

thanks for your help

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2002-04-17 16:13:35 Re: cannot restore db
Previous Message pg sql 2002-04-17 14:21:45 Re: [DOCS] Upgrading - How? - Administrator's Guide ??