PACKAGE

oracle sample schema 'HR' & 'SCOTT' locate at :

http://code.google.com/p/adf-samples-demos/downloads/detail?name=demoscripts.zip&can=2&q=

1. Package

(Package is simply a collection of procedures, functions, package variables, etc)

package is a schema object that groups logically related PL/SQL types, items, and subprograms.  Packages usually have two parts, a specification and a body, although sometimes the body is unnecessary. The specification (spec for short) is the interface to your applications; it declares the types, variables, constants, exceptions, cursors, and subprograms available for use. The body fully defines cursors and subprograms, and so implements the spec. Only the declarations in the package spec are visible and accessible to applications. Implementation details in the package body are hidden and inaccessible. So, you can change the body (implementation) without having to recompile calling programs.

Package variable

Packaged public variables and cursors persist for the duration of a session. They can be shared by all subprograms that execute in the environment. They let you maintain data across transactions without storing it in the database.

Hot to reference package variable ?  packagename.variable_name

1 package global variable. If the variable is defined in the package specification, you could reference it outside the package, as packge_name.variable_name.

2. If the variable is defined in the package body, however, you can only reference it from inside another PL/SQL block defined in the package body.

 

http://docs.oracle.com/cd/B10501_01/appdev.920/a96624/09_packs.htm

 

 

2. reset sequence when it exceed maxvalue:

alter sequence emp_test_seq increment by 1 minvalue 8000 maxvalue 8010 cycle cache 10;

 

3. different between delete & truncate ?

http://www.orafaq.com/faq/difference_between_truncate_delete_and_drop_commands

 

4. callback

http://docs.oracle.com/cd/E16184_01/dev.837/e12886/c07_callbacks.htm

猜你喜欢

转载自coderanch.iteye.com/blog/1828746