how do I test conditions inside a stored procedure/function

Поиск
Список
Период
Сортировка
От adb
Тема how do I test conditions inside a stored procedure/function
Дата
Msg-id Pine.GSO.4.10.10101251644340.2561-100000@hairdini.beast.com
обсуждение исходный текст
Список pgsql-general
Hi, I've just started using postgres 7.0 and I'm trying to see how
much I can do inside a stored procedure (or function I should say)

Is there any way to get data from a table into a variable in your
function?  like
$maxuser = select max(userId) from users;

Also is there a way to test for existence of a row like

if exists (select 1 from users where userId = $userId) then
    do something
else
    raise exception "crap"
end if;

Basically I'm used to using stored procedures in sybase and I
want to see if similar methods can be used in postgres

Thanks,

Alex.


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

Предыдущее
От: Karel Zak
Дата:
Сообщение: Re: backend closing connections while executing...
Следующее
От: Kyle
Дата:
Сообщение: DBD::Pg using int2 / smallint