相关疑难解决方法(0)

在Oracle PL/SQL中有没有办法导入包及其成员?

给出一个包:

create or replace package foo as
  f1 number := 1;
end;
/
Run Code Online (Sandbox Code Playgroud)

代替:

declare
begin
  dbms_output.put_line('f1 = ' || foo.f1);
end;
/
Run Code Online (Sandbox Code Playgroud)

我想写:

declare
begin
  -- pseudocode not a valid PL/SQL
  import dbms_output.*;
  import foo.*;
  put_line('f1 = ' || f1);
end;
/
Run Code Online (Sandbox Code Playgroud)

但是怎么做呢?

编辑杰夫:(试图保持在PL/SQL中完成工作的精神)

DECLARE
  PRAGMA IMPORT dbms_output AS d;
  PRAGMA IMPORT foo AS f;
BEGIN
  d.put_line('f1 = ' || f.f1);
END;
/
Run Code Online (Sandbox Code Playgroud)

oracle plsql namespaces packages

6
推荐指数
1
解决办法
5256
查看次数

标签 统计

namespaces ×1

oracle ×1

packages ×1

plsql ×1