PL/pgSQL: SELECT INTO variables - no result

Поиск
Список
Период
Сортировка
От Tarlika Elisabeth Schmitz
Тема PL/pgSQL: SELECT INTO variables - no result
Дата
Msg-id 20111110221740.094631b0@dick.coachhouse
обсуждение исходный текст
Список pgsql-general
I go through a series of SELECT INTO in a trigger function.

SELECT INTO  country_id  id
FROM vcountry WHERE [...];

I might or o might not find a result.

Next, I try to find a region within this country, if found previously,
and if not anywhere.

SELECT INTO
  country_id, region_id
  country_fk, id
FROM vregion
WHERE (country_id IS NULL OR country_fk = country_id) AND name ILIKE
place;

If the first search found a country, and the second search fails to
find the region, the second search will set my variables to NULL. So, a
previously populated country_id will now be NULL.


Is there any way I can avoid this or do I have to use different sets of
variables?


--

Best Regards,
Tarlika Elisabeth Schmitz

В списке pgsql-general по дате отправления:

Предыдущее
От: "J.V."
Дата:
Сообщение: Re: PostgreSQL uninstall fails
Следующее
От: John R Pierce
Дата:
Сообщение: Re: PostgreSQL uninstall fails