当前位置:首页 > 开发 > 数据库 > 正文

PACKAGE

发表于: 2013-03-13   作者:四书五经   来源:转载   浏览:
摘要: 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 p

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

PACKAGE

  • 0

    开心

    开心

  • 0

    板砖

    板砖

  • 0

    感动

    感动

  • 0

    有用

    有用

  • 0

    疑问

    疑问

  • 0

    难过

    难过

  • 0

    无聊

    无聊

  • 0

    震惊

    震惊

版权所有 IT知识库 CopyRight © 2009-2015 IT知识库 IT610.com , All Rights Reserved. 京ICP备09083238号