[ CC'd to "Jiri Nemec" <[EMAIL PROTECTED]>]

"Jiri Nemec" <[EMAIL PROTECTED]> said:


> 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';

should this not be language 'plpgsql' ?

or 

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


mind you, i could be wrong.

gnari




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

Reply via email to