Re: error in SELECT

Поиск
Список
Период
Сортировка
От P.M
Тема Re: error in SELECT
Дата
Msg-id 20060527163952.24959.qmail@web33201.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на Re: error in SELECT  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы a row disapearing  (Rafal Pietrak <rafal@zorro.isa-geek.com>)
Список pgsql-general
Hi Tom,

in fact,i needed to move the DECLARE before begin and to adjust some autoincrement...and the problem is solved ;-)

thx,

Maileen

Tom Lane <tgl@sss.pgh.pa.us> wrote:
"P.M" writes:
> here is my function in PostgreSQL :
> CREATE OR REPLACE FUNCTION immense_sp001(VARCHAR,VARCHAR, service_nom VARCHAR, OUT result BOOLEAN, OUT error_message VARCHAR)
> RETURNS record LANGUAGE plpgsql
> AS '
> BEGIN
> DECLARE
> username varchar :=$1;
> strhash varchar :=$2;
> Profile_Detected INTEGER;
> Service_Already_Exist INTEGER;

> /* detect if the user logged in exists in database */
> SELECT count(*) INTO Profile_Detected FROM profiles WHERE login=username AND pwd=strhash;

The BEGIN goes after the variable declarations, not before them.

You're going to have some problems with those double-quoted string
literals too; that's not the correct syntax for string literals.
And you don't use "set" when assigning to a plpgsql variable.

Might be a good idea to practice on some toy functions until you've got
some familiarity with plpgsql syntax, rather than diving in with porting
many-line functions. A big function is too hard when you're trying to
fix many misconceptions at once.

regards, tom lane


Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.

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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: error in SELECT
Следующее
От: "Dawid Kuroczko"
Дата:
Сообщение: Re: Making query without trigger