Behavior of dependent objects. : Object « Object Oriented Database « Oracle PL / SQL






Behavior of dependent objects.

    
SQL>
SQL> COLUMN object_name FORMAT a20
SQL>
SQL> CREATE TABLE simple_table (f1 NUMBER);

Table created.

SQL>
SQL> CREATE OR REPLACE PACKAGE Dependee AS
  2    PROCEDURE Example(p_Val IN NUMBER);
  3  END Dependee;
  4  /

Package created.

SQL>
SQL> CREATE OR REPLACE PACKAGE BODY Dependee AS
  2    PROCEDURE Example(p_Val IN NUMBER) IS
  3    BEGIN
  4       INSERT INTO simple_table VALUES (p_Val);
  5    END Example;
  6  END Dependee;
  7  /

Package body created.

SQL>
SQL> CREATE OR REPLACE PROCEDURE Depender(p_Val IN NUMBER) AS
  2  BEGIN
  3    Dependee.Example(p_Val + 1);
  4  END Depender;
  5  /

Procedure created.

SQL>
SQL> SELECT object_name, object_type, status FROM user_objects WHERE object_name IN ('DEPENDER', 'DEPENDEE','SIMPLE_TABLE');

OBJECT_NAME          OBJECT_TYPE         STATUS
-------------------- ------------------- ----------
DEPENDEE             PACKAGE             VALID
DEPENDEE             PACKAGE BODY        VALID
DEPENDER             PROCEDURE           VALID
SIMPLE_TABLE         TABLE               VALID

4 rows selected.

SQL>
SQL> CREATE OR REPLACE PACKAGE BODY Dependee AS
  2    PROCEDURE Example(p_Val IN NUMBER) IS
  3    BEGIN
  4      INSERT INTO simple_table VALUES (p_Val - 1);
  5    END Example;
  6  END Dependee;
  7  /

Package body created.

SQL>
SQL> SELECT object_name, object_type, status FROM user_objects WHERE object_name IN ('DEPENDER', 'DEPENDEE','SIMPLE_TABLE');

OBJECT_NAME          OBJECT_TYPE         STATUS
-------------------- ------------------- ----------
DEPENDEE             PACKAGE             VALID
DEPENDEE             PACKAGE BODY        VALID
DEPENDER             PROCEDURE           VALID
SIMPLE_TABLE         TABLE               VALID

4 rows selected.

SQL>
SQL> DROP TABLE simple_table;

Table dropped.

SQL>
SQL> SELECT object_name, object_type, status FROM user_objects WHERE object_name IN ('DEPENDER', 'DEPENDEE','SIMPLE_TABLE');

OBJECT_NAME          OBJECT_TYPE         STATUS
-------------------- ------------------- ----------
DEPENDEE             PACKAGE             VALID
DEPENDEE             PACKAGE BODY        INVALID
DEPENDER             PROCEDURE           VALID

3 rows selected.

SQL>

   
    
    
    
  








Related examples in the same category

1.Create Object
2.CREATE OR REPLACE TYPE
3.Create a stored type which is visible to SQL and PL/SQL.
4.reference user-defined data type in another block
5.Student type
6.Point type
7.Use user-defined type as parameter
8.This script demonstrates complex objects
9.Name type
10.Build data type with another user type
11.Create the object and collection types
12.Create type and use it in inner query
13.Create types and then use it in pl/sql block
14.Combine user-defined type to create new type
15.PriceType becomes the datatype of the price attribute in the ProductType object type
16.Use self to reference member variable in constructor
17.One to list using object references