Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Oracle PL/SQL is there any way to import packages and their members?

Given a package:

create or replace package foo as
  f1 number := 1;
end;
/

Instead of:

declare
begin
  dbms_output.put_line('f1 = ' || foo.f1);
end;
/

I'd like to write:

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

But how to do that ?

EDIT by Jeff: (trying to stay in the spirit of how things are done in PL/SQL)

DECLARE
  PRAGMA IMPORT dbms_output AS d;
  PRAGMA IMPORT foo AS f;
BEGIN
  d.put_line('f1 = ' || f.f1);
END;
/
like image 911
user272735 Avatar asked Apr 13 '11 13:04

user272735


1 Answers

Quite simply, you can't. Sorry, but there is no other answer!

like image 133
Tony Andrews Avatar answered Sep 27 '22 17:09

Tony Andrews