【发布时间】:2013-07-07 10:29:25
【问题描述】:
我编写了一个 PostgreSQL 函数,其中包含如下的 while 语句:
WHILE id_exist == 'f' LOOP
lotto_id = lotto_id + 1;
id_exist = check_if_exist(lotto_id, 'lotto', 'id');
END LOOP;
其中id_exist 是一个布尔变量,通过调用返回布尔值的check_if_exist() 方法(也在while 代码中使用)初始化。
现在当我尝试调用我的函数时,我得到了这个错误
ERROR: operator does not exist: boolean == unknown
LINE 1: SELECT id_exist == 'f'
^
HINT: No operator matches the given name and argument type(s). You might need to add
explicit type casts.
QUERY: SELECT id_exist == 'f'
CONTEXT: PL/pgSQL function "acquistolotto" line 11 at WHILE
【问题讨论】:
标签: sql function postgresql stored-procedures