Re: How to Declare Functions Containing OUT PArameters?

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: Bill Thoen <bthoen(at)gisnet(dot)com>
Cc: pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to Declare Functions Containing OUT PArameters?
Date: 2010-07-14 18:51:31
Message-ID: 1279133491.22775.49.camel@jd-desktop.unknown.charter.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2010-07-14 at 12:21 -0600, Bill Thoen wrote:
> I'm having some difficulty getting plpgsql to recognize a function with
> a couple of OUT parameters. I'm either declaring the function
> incorrectly, making the call to it in the wrong way or my program is
> simply possessed by evil spirits. I'm using Postgres 8.1.5.

First, 8.1.x is EOL as of November. You need to upgrade.

> CREATE OR REPLACE FUNCTION main() RETURNS VOID AS $$
> DECLARE
> str1 text;
> str2 text;
> num integer := 0;
> fnum real := 0.0;
> BEGIN
> str1 := 'One fish, two fish';
> str2 := 'Shark fish, No fish';
> SELECT fishy( str1, str2, num, fnum) ;

> /* ERROR MESSAGE
>
> psql:ex_out_fail.sql:28: ERROR: function fishy(text, text, integer,
> real) does not exist
> HINT: No function matches the given name and argument types. You may
> need to add explicit type casts.
> CONTEXT: SQL statement "SELECT fishy( $1 , $2 , $3 , $4 )"
> PL/pgSQL function "main" line 9 at SQL statement
>

You are passing four IN paramaters. The out paramaters are used in
return are they not?

Joshua D. Drake

--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tim Landscheidt 2010-07-14 19:03:59 Re: Need help doing a CSV import
Previous Message Pavel Stehule 2010-07-14 18:40:53 Re: How to Declare Functions Containing OUT PArameters?