Hello all, sorry about beginner question, but I'm sure function has
correct structure, buw PostgreSQL reports error. (This function is
only on approbation.)

CREATE FUNCTION foo(int2)
RETURNS TEXT
AS 'DECLARE ret TEXT;
   begin
      SELECT INTO ret CAST(name AS text)
      FROM shop_goods
      WHERE id = $1;
      return ret;
   end;'
language 'sql';

PostgreSQL still returns:

ERROR:  syntax error at or near "TEXT" at character 13

PostgreSQL version:

[EMAIL PROTECTED]:/root$ /usr/local/postgresql/bin/postmaster --version
postmaster (PostgreSQL) 7.4.2

I have tried function from PostgreSQL book but with same results.
Thank you for replies.

-- 
Jiri Nemec
www.menea.cz - web solutions


---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to