简体   繁体   English

在 redshift 中使用 if else 条件调用存储过程时遇到问题

[英]Facing issue while calling a stored procedure with if else condition in redshift

I created the stored procedure in redshift.我在 redshift 中创建了存储过程。 Below is the code for that.下面是代码。

create or replace procedure sp4(f1 IN int)
as
$$
begin
    IF f1==0 then
        CREATE TABLE myetl(a int, b varchar);
    ELSE
        insert into new_tbl(id) values(47);
    END IF;
end;
$$ LANGUAGE plpgsql;

While calling the stored procedure I am getting the error like this调用存储过程时出现这样的错误

call sp4(0)
ERROR: operator does not exist: integer == integer Hint: No operator matches the given name and argument type(s). You may need to add explicit type casts. Where: SQL statement "SELECT $1 ==0" PL/pgSQL function "sp4" line 2 at if

Your comparison should be IF f0 = 0 THEN , with single equal signs.您的比较应该是IF f0 = 0 THEN ,带有单个等号。 See the Redshift PLpgSQL documentation请参阅Redshift PLpgSQL 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM