Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to namespace PL/SQL packages?

I have several different packages, one for each logical part of my application. Some packages are getting huge but I would like to keep all the procedures/functions grouped in some way rather than breaking them into separate packages. Is there any way to nest, or namespace, my packages?

So if I have MYSCHEMA.PKG_PEOPLE and it has 10 procedures and 10 functions, is there no way that I can for instance move the CRUD procedures to MYSCHEMA.PKG_PEOPLE.CRUD. I want to keep all these items inside of PKG_PEOPLE but I want to further sub-divide them.

like image 944
aw crud Avatar asked Nov 03 '10 13:11

aw crud


People also ask

How do you define a package in PL SQL?

A package is a schema object that groups logically related PL/SQL types, variables, constants, subprograms, cursors, and exceptions. A package is compiled and stored in the database, where many applications can share its contents.

What is namespace in Dba_objects?

A namespace is the categorisation which objects are identified (and hence typically will need unique naming). eg. <code> SQL> select object_type, namespace. 2 from dba_objects.

What is an Oracle namespace?

A namespace defines a group of tables, within which all of the table names must be uniquely identified. This chapter describes namespaces and how to create and manage the namespaces in Oracle NoSQL Database. Namespaces permit you to do table privilege management as a group operation.

What is the difference between package and procedure in PL SQL?

A package can contain no procedures or functions. It may just contain data types or global variables. 2. A procedure does not return any values in itself, however it can have parameters that can be used to return values as either OUT or modify (IN/OUT).


1 Answers

Beyond Schema and Package, there is no multi-level namespace handling for PL/SQL packages in Oracle.

Within a package body you can define nested procedures but I would guess this isn't what you need.

I think the closest you'll get is to enforce a naming rule on your packages. For example:

MYSCHEMA.PKG_PEOPLE
MYSCHEMA.PKG_PEOPLE_CRUD
like image 110
Nick Pierpoint Avatar answered Sep 26 '22 01:09

Nick Pierpoint