Re: SQL99 functions

From: Hannu Krosing <hannu(at)tm(dot)ee>
To: Peter Mount <petermount(at)it(dot)maidstone(dot)gov(dot)uk>
Cc: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>, Hackers List <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SQL99 functions
Date: 2000-06-27 10:06:40
Message-ID: 39587CB0.F40714D9@tm.ee
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Mount wrote:
>
> Not knowing much on this side of things but in JDBC, CallableStatement
> mentions things like IN, OUT & INOUT args - not sure about INOUT, but IN &
> OUT are there. Perhaps OUT are not valid for selects, but are in stored
> procedures?
>
> Peter
>
> --
> Peter Mount
> Enterprise Support
> Maidstone Borough Council
> Any views stated are my own, and not those of Maidstone Borough Council
>
> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Tuesday, June 27, 2000 9:51 AM
> To: Thomas Lockhart
> Cc: Hackers List
> Subject: Re: [HACKERS] SQL99 functions
>
> Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> writes:
> > I see mention in SQL99 of function definitions which can have IN, OUT,
> > and INOUT arguments. Any thoughts on how this could be supported in
> > Postgres?
>
> I noticed that but haven't quite figured out how it's supposed to fit
> into the SQL worldview at all. Surely
> SELECT foo(x) FROM table
> shouldn't silently mutate into an UPDATE depending on how foo() is
> declared. Exactly where is a function with OUT args useful in SQL?

They are used (at least) in PL/SQL nad other PLs.

To return multiple values OUT args are one possible solution.

Also one could have session variables possibly like this:

DECLARE VARIABLE MY_VAR INT;

EXECUTE MY_PROC(MY_VAR);

SELECT * FROM SOME_TABLE WHERE ID=MY_VAR;

-----------
Hannu

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Philip Warner 2000-06-27 10:30:58 RE: Proposal: More flexible backup/restore via pg_dump
Previous Message Peter Mount 2000-06-27 09:55:28 RE: Proposal: More flexible backup/restore via pg_dump