Search Postgresql Archives

PL/pgSQL question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All!
I'm trying to get working the below PL/pgSQL function without sucess.
The function is correctly created, but when I tested it i got:

# SELECT grantAccess('sara', 'sarapass');
ERROR:  set-valued function called in context that cannot accept a set
CONTEXT:  PL/pgSQL function "grantaccess" line 10 at return next
veillewm=#

What I'm missing?
Thank in advance
Younes

----------------- CODE BEGIN --------------------------
CREATE FUNCTION grantAccess(text,text) RETURNS SETOF users AS '
 DECLARE
    userlogin  ALIAS FOR $1;
    userpasswd   ALIAS FOR $2;
    row users%ROWTYPE;
 BEGIN

FOR row IN SELECT user_id FROM users WHERE user_login = userlogin AND user_passwd = userpasswd AND user_account = TRUE LOOP
      RETURN NEXT row;
    END LOOP;
  RETURN;
 END;
' LANGUAGE 'plpgsql';

----------------- CODE END --------------------------




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux