CREATE OR REPLACE PROCEDURE proc_test1(p_1 varchar)
LANGUAGE plpgsql
AS $$
DECLARE
V_TEST integer := 0;
BEGIN
select count(*)
from mytab
into V_TEST
WHERE X =P_1;
RAISE NOTICE 'COUNT IS:(%)',V_TEST;
EXCEPTION
WHEN OTHERS THEN
null;
END;
$$
;
在Amazon Redshift中,我可以不这样调用这个存储过程吗?
call proc_test1(p_1 =>"x")
还有,为什么带分号的RAISE会失败?下面的错误处理程序说RAISE;-我得到的错误是无效的操作:语法错误在或接近;
CREATE OR REPLACE PROCEDURE risk.proc_test1(p_1 varchar)
LANGUAGE plpgsql
AS $$
DECLARE
V_TEST integer := 0;
BEGIN
select count(*)
from risk.mytab
into V_TEST
WHERE X =P_1;
RAISE NOTICE 'COUNT IS:(%)',V_TEST;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END;
$$
;
call proc_test1(p_1 => 'x')
你是在问调用的语法,还是在问命名参数?
文档没有提到,所以不支持
https://docs.aws.amazon.com/redshift/latest/dg/r_CALL_procedure.html
我猜关于RAISE
错误,你缺少必要的参数
https://docs.aws.amazon.com/redshift/latest/dg/c_PLpgSQL-statements.html r_PLpgSQL-messages-errors
RAISE level 'format' [, variable [, ...]];
所有这些都在文档中。