Pl/Sql tips

See Exceptions in Pl/Sql, Pipelined functions, Pl/Sql Cursor, Nested tables and Arrays
My forum

How to invalidate a package without modify?
http://forums.oracle.com/forums/thread.jspa?messageID=1791200

 

Unique id
select SYS_GUID() from dual

 

Restrict references
RESTRICT_REFERENCES Pragma http://download-uk.oracle.com/docs/cd/B14117_01/appdev.101/b10807/13_elems039.htm

CREATE PACKAGE loans AS
   FUNCTION balance(account NUMBER) RETURN NUMBER;
   PRAGMA RESTRICT_REFERENCES (balance, WNDS, RNPS);
END loans;
/

RNDS Reads no database state (does not query database tables).
RNPS Reads no package state (does not reference the values of packaged variables)
TRUST Can be trusted not to violate one or more rules. 
      This value is needed for functions written in C or Java that are called from PL/SQL, since PL/SQL cannot verify them at run time.
WNDS Writes no database state (does not modify database tables).
WNPS Writes no package state (does not change the values of packaged variables).

 

detailed system tracing for compilation errors

enable using:

alter system set events '6553 trace name errorstack level 3';

disable using:

alter system set events '6553 trace name errorstack off';