云数据库 GAUSSDB-PKG_UTIL:示例

时间:2024-04-26 16:14:42

示例

-- 删除schema
drop schema if exists pkg_var_test cascade;
-- 创建pkg_var_test
create schema pkg_var_test;
-- 设置shchema和参数
set current_schema = pkg_var_test;
set behavior_compat_options ='plpgsql_dependency';
-- 创建包
create or replace package test_pkg as
    referenced_var int;
    unreferenced_var int;
end test_pkg;
/
-- 创建函数
create or replace function test_func return int
is
begin
  return 1;
end;
/
-- 创建存储过程
create or replace procedure test_proc
is
  proc_var int;
begin
  proc_var := 1;
end;
/
-- 重编译pkg_var_test下的包 函数和存储过程
call pkg_util.utility_compile_schema('pkg_var_test');
或者
call pkg_util.gs_compile_schema(' ',false,2);
-- 删掉pkg_var_test 
drop schema if exists pkg_var_test cascade;
support.huaweicloud.com/centralized-devg-v3-gaussdb/gaussdb-12-0759.html