Re: error using pl/pgsql? [possibly off topic] - Mailing list pgsql-general

From Stephan Szabo
Subject Re: error using pl/pgsql? [possibly off topic]
Date
Msg-id 20011123105130.F84165-100000@megazone23.bigpanda.com
Whole thread Raw
In response to error using pl/pgsql? [possibly off topic]  ("Johnny Jørgensen" <pgsql@halfahead.dk>)
Responses Re: error using pl/pgsql? [possibly off topic]
List pgsql-general
On Fri, 23 Nov 2001, [ISO-8859-1] "Johnny J�rgensen" wrote:

A few notes **ed below.

> CREATE FUNCTION new_order(text,text)
> RETURNS text
> AS '
>  DECLARE
>   p_id ALIAS FOR $1;
>   p_date ALIAS FOR $2;
>   ret_val text;
>  BEGIN
>   BEGIN WORK;
** can't put transaction statements in I think to start.
** Take out the begin work and commit work.

>    INSERT INTO ordre (person_id,placement_date,status) VALUES (p_id::int4,p_date::decimal,1);
** I don't think there's a text->decimal conversion defined.  Why is the
** parameter defined as text anyway?

>    SELECT currval(ordre_id_seq::text) INTO ret_val;
** I think you really want ''ordre_id_eq'' since otherwise
** its looking for a parameter or column name,
** and do you really want this back as text rather than
** the integer type currval normally returns?

>   COMMIT WORK;
>   RETURN ret_val;
>  END;
> '
> LANGUAGE 'plpgsql';


pgsql-general by date:

Previous
From: William WAISSE
Date:
Subject: Re: newbie needs help with postgres internal tables
Next
From: Luis Amigo
Date:
Subject: explain analyze