错误:“电子邮件”不是已知变量

时间:2017-06-19 09:42:04

标签: sql postgresql heroku login

我已经为我的登录功能创建了一个存储过程,但它工作正常但是当我将它部署到heroku时它给了我错误。

这是我在sql中的存储过程:

    create or replace function login(in par_email  text, in par_password text) returns text as
$$
  declare
    loc_eml text;
    loc_pwd text;
    loc_res text;
  begin
     select into loc_eml, loc_pwd, email, password from account
       where email = par_email and password = par_password;

     if loc_eml isnull AND loc_pwd isnull then
       loc_res = 'Error';
     else
       loc_res = 'ok';
     end if;
     return loc_res;
  end;
$$
 language 'plpgsql' VOLATILE;

2 个答案:

答案 0 :(得分:1)

您在程序中的查询应该是这样的:

select email, password into loc_eml, loc_pwd
from account
where email = par_email and password = par_password;

答案 1 :(得分:0)

应该是

SELECT email, password INTO loc_eml, loc_pwd FROM account ...