Re: understanding select into

From: "Plugge, Joe R(dot)" <JRPlugge(at)west(dot)com>
To: John <johnf(at)jfcomputer(dot)com>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: understanding select into
Date: 2010-04-09 17:31:13
Message-ID: BD69807DAE0CE44CA00A8338D0FDD08302CF828DA8@oma00cexmbx03.corp.westworlds.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Johnf,

I would think that the _p, _test, _r etc are local variables within the procedure/function and this is the way that the value (from the select) gets assigned to that local variable.

-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org [mailto:pgsql-sql-owner(at)postgresql(dot)org] On Behalf Of John
Sent: Friday, April 09, 2010 12:19 PM
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] understanding select into

Hi,

I am reviewing a function written by some xTuple guys. What is interesting

about it is it uses the "INTO" statement like

select something into _p from sometable where somecriteria.

The function contiunes and uses the data retreived

_p.somefield_name

And then the function ends.

Ok my question:

I also thought the select "into" created a real table. But after running the

function the table does not exist. I see no where that a 'drop' is issued.

In fact the function uses lot's of select into's like (_test, _r, etc..). So

would some kind soul explain what is happening.

Could it be that "_p" is drop automaticly when the function ends? Something

to do with scope.

Could it have something to do with the fact the function returns only an

integer? And that causes the table to be drop.

As you can see I'm lost here!

Johnf

--

Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)

To make changes to your subscription:

http://www.postgresql.org/mailpref/pgsql-sql

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Pavel Stehule 2010-04-09 17:32:51 Re: understanding select into
Previous Message John 2010-04-09 17:18:37 understanding select into