VastbaseE100

基于开源技术的HTAP数据库管理系统。性能优异,稳定可靠,提供诸多专属领域特性。

Menu

PL/pgSQL中调用存储过程和函数不需要加CALL和PERFORM

atlasdb=# CREATE OR REPLACE PROCEDURE pro_test() AS $$  
atlasdb$# DECLARE  
atlasdb$# BEGIN  
atlasdb$#    dbms_output.put_line ('this is a procedure');
atlasdb$# END;  
atlasdb$# $$ LANGUAGE plpgsql;  
CREATE PROCEDURE
atlasdb=# 
atlasdb=# CREATE OR REPLACE FUNCTION fun_test (
atlasdb(#  p_sal NUMBER,
atlasdb(#  p_comm NUMBER
atlasdb(# ) RETURNs NUMBER
atlasdb-# as $BODY$
atlasdb$# BEGIN
atlasdb$#  RETURN (p_sal + NVL(p_comm, 0)) * 24;
atlasdb$# END emp_comp;
atlasdb$# $BODY$;
CREATE FUNCTION
atlasdb=# DO $$ DECLARE
atlasdb$# BEGIN
atlasdb$#  fun_test(1,2);
atlasdb$#  pro_test();
atlasdb$# END $$;
NOTICE:  this is a procedure
DO