From: | "Josh Berkus" <josh(at)agliodbs(dot)com> |
---|---|
To: | Morgan Curley <mcurley(at)e4media(dot)com>, <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Re: Inserts in triggers Follow Up |
Date: | 2001-07-25 15:14:09 |
Message-ID: | web-91191@davinci.ethosmedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
Morgan,
> One other problem I am having in that proc is SELECT'ing INTO a var.
>
> declare
> id lookup_sports.sport_id%TYPE;
> begin
> SELECT INTO id sport_id FROM lookup_sports WHERE....some
> clause
>
> id is always null
That's because the SELECT INTO variable and SELECT INTO record syntax
are confusingly different. It's
for records:
SELECT INTO record_var * FROM ...
for simple variables:
SELECT column INTO variable FROM ...
I'm not clear on the origin of the inconsistency; my guess is that jan
copied it over from PL/SQL.
> good suggestion to differentiate my vars from my columns. For the
> sake of
> expediency I named them the same so when I was writing the insert
> statements I could just copy/past my columns list into my values
> list.
You should *always* do this. Most functions with identical column and
variable names will confuse the compiler and result in errors.
It'd have been nice if PL/pgSQL supported variable naming with a special
character preifx (e.g. $variable). Does anyone know of a character that
won't give the parser fits? Currently I'm using "v_", same as Richard.
-Josh
______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 2 bytes |
unknown_filename | text/plain | 2 bytes |
unknown_filename | text/plain | 2 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Joel Burton | 2001-07-25 15:18:17 | Re: PL/PgSQL bug? |
Previous Message | Nikola Milutinovic | 2001-07-25 13:59:25 | PL/PgSQL bug? |
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2001-07-25 15:22:31 | Re: Meta integrity |
Previous Message | Renato De Giovanni | 2001-07-25 15:08:51 | Meta integrity |