Skip site navigation (1) Skip section navigation (2)

Re: Stored Procedures

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: Wendy Powley <wendy(at)cs(dot)queensu(dot)ca>, pgsql-novice(at)postgresql(dot)org
Subject: Re: Stored Procedures
Date: 2002-05-07 17:35:11
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice

> Is it possible to write a stored procedure which takes a struct as a
> parameter?  I'd like to be able to pass in some info via a struct &
> return some info via another struct something like this:

What's a "Struct"?  It's not a standard SQL term, and I don't recognize

> struct in_struct {
>   integer i, j;
> }
> struct out_struct {
>   integer k;
>    char p;
> }

Are you trying for a custom data type, or more of a record?  Postgres
supports both.

> create function myfunc(in_struct, out_struct) .....

Postgres does not support output parameters, at present.  Functions
have one return value of a defined data type (which may be a custom
data type or a record, if you wish).

-Josh Berkus

In response to

pgsql-novice by date

Next:From: Josh BerkusDate: 2002-05-07 17:38:41
Subject: Re: Problems with psql : ERROR : pg_user: permission
Previous:From: Henshall, Stuart - WCPDate: 2002-05-07 16:13:26
Subject: Re: ERROR: $1 is declared CONSTANT in plpgsql

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group