postgresql – 错误:运算符不存在:整数==整数
发布时间:2020-12-13 16:00:26 所属栏目:百科 来源:网络整理
导读:我在postgres函数中使用这些语句. Select count(*) into V_checkfrom employeewhere employee_name like 'Raj%';if V_check == 0then update exception set exception_found = 'Raj';end if; 我收到此错误: 06001 解决方法 正如所指出的,相等的比较运算符是
我在postgres函数中使用这些语句.
Select count(*) into V_check from employee where employee_name like 'Raj%'; if V_check == 0 then update exception set exception_found = 'Raj'; end if; 我收到此错误:
解决方法
正如所指出的,相等的比较运算符是= not ==.但是,您应该将条件写为:
if not exists (select 1 from employee where employee_name like 'Raj%') then update exception set exception_found = 'Raj'; end if; 这可以为您节省声明.此外,不存在比count(*)更快 – 因为不存在可以在第一个匹配行停止. 或完全免除条件: update exception set exception_found = 'Raj' where not exists (select 1 from employee where employee_name like 'Raj%'); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |