basics on User Defined Functions

From: Dennis Gearon <gearond(at)fireserve(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: basics on User Defined Functions
Date: 2004-09-21 05:54:07
Message-ID: 414FC1FF.5050708@fireserve.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is this the correct way to return values in a record from a UDF in 7.4.+ ?

Is it ok to modify the arguments as in 'arg_int'?

-- return type should be RECORD
--
CREATE OR REPLACE FUNCTION test_function( int )
RETURNS RECORD AS '
DECLARE

arg_int ALIAS FOR $1;

var_record_out record;
var_message_out text;

BEGIN

var_message_out := ''This was successful'';
arg_int := rg_int * 3;

SELECT INTO var_record_out
:arg_int AS intX3,
:var_message_out AS message;
RETURN var_record_out;
END;
' LANGUAGE 'plpgsql';

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John Sidney-Woollett 2004-09-21 06:15:08 Re: using database for queuing operations?
Previous Message David Garamond 2004-09-21 05:45:45 Re: Any reason not to use inheritance?