Re: help with PL/PgSQL bug

From: "Mike Mascari" <mascarm(at)mascari(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Neil Conway" <neilc(at)samurai(dot)com>, "PostgreSQL Hackers" <pgsql-hackers(at)postgresql(dot)org>, <darcy(at)wavefire(dot)com>
Subject: Re: help with PL/PgSQL bug
Date: 2003-01-12 02:23:00
Message-ID: 001201c2b9e1$87155ea0$0102a8c0@mascari.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

----- Original Message -----
From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> "Mike Mascari" <mascarm(at)mascari(dot)com> writes:
> >> Does Oracle's PL/SQL have a concept of record variables? If so, what
> >> do they do in this situation?
>
> > In Oracle 8, a row of NULLs:
>
> > 1 CREATE OR REPLACE FUNCTION foo(t IN NUMBER)
> > 2 RETURN NUMBER
> > 3 IS
> > 4 emp_rec employees%ROWTYPE;
>
> That's a rowtype variable, though, not a record variable. I believe our
> code will work the same as Oracle for that case.
>

1 CREATE OR REPLACE FUNCTION foo(t IN NUMBER)
2 RETURN NUMBER
3 IS
4 TYPE EmpRec IS RECORD (
5 id NUMBER,
6 name VARCHAR(20)
7 );
8 emp_rec EmpRec;
9 BEGIN
10 SELECT *
11 INTO emp_rec
12 FROM employees
13 WHERE id = t;
14 RETURN (emp_rec.id);
15* END;

behaves similarly by returning a NULL value for an unmatched row.

FWIW,

Mike Mascari
mascarm(at)mascari(dot)com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-01-12 03:47:32 Re: v7.3.1 psql against a v7.2.x database ...
Previous Message Bruce Momjian 2003-01-11 19:36:24 Re: src/port/fseeko.c revision 1.9 broken on NetBSD