Quick Search:
CODE
Oracle PL/SQL Code Library
JOBS
Find Or Post Oracle Jobs
FORUM
Oracle Discussion & Chat
 The Oracle PL/SQL PUBLIC Keyword      [Return To Index] Jump to:  
  Looking for the original pages? (formerly called "Morgan's Library") You can find them here.

Term: PUBLIC

Definition:
In Oracle PL/SQL, the PUBLIC keyword is used to create public database objects, which are accessible to all users. The database objects which can be created as Public are synonyms and database links. Note that public objects are non schema objects.

GRANT and REVOKE DCL commands use the PUBLIC keyword to grant or remove access rights or privileges on an object to all users.

Example Syntax:

To create a Public Synonym

CREATE PUBLIC SYNONYM [NAME]
FOR [DATABASE OBJECT]


To create a Public Database Link

CREATE PUBLIC DATABASE LINK [NAME]
USING [CONNECT STRING]


To GRANT/REVOKE privilege to/from PUBLIC

GRANT [PRIVILEGE] ON [OBJECT NAME] TO PUBLIC


Example Usage

The SQL statement below creates a database link named DBPROD USING 'DBROD':

CREATE PUBLIC DATABASE LINK DBPROD
USING 'DBPROD';


The SQL statement below creates a Public synonym named ORDERS for the ORDERS table in the SCOTT schema. Note that no private synonym with the name ORDERS should exist in SCOTT schema or else the dependent object would be invalidated.

CREATE PUBLIC SYNONYM ORDERS
FOR SCOTT.ORDERS


The DCL statement below grants SELECT and DML privileges on the ORDERS table to PUBLIC:

GRANT SELECT, INSERT, UPDATE, DELETE
ON ORDERS TO PUBLIC;



Related Links:
 
Home      :      Code Library      :      Sponsors      :      Privacy      :      Terms of Use      :      Contact Us 113 users online    © 2009 psoug.org
PSOUG LOGIN
Username: 
Password: 
Forgot your password?