Re: Re: Inserts in triggers Follow Up
От | Josh Berkus |
---|---|
Тема | Re: Re: Inserts in triggers Follow Up |
Дата | |
Msg-id | web-91191@davinci.ethosmedia.com обсуждение исходный текст |
Ответ на | Re: Inserts in triggers Follow Up (Morgan Curley <mcurley@e4media.com>) |
Ответы |
Re: Re: Inserts in triggers Follow Up
|
Список | 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@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco
Вложения
В списке pgsql-sql по дате отправления: