Here is the Steps to create first Package in Oracle 10g using PL/SQL developer.
Step 1: Open PL/SQL developer and login to database.
Step 2: Go to tools menu of PL/SQL Developer and check the Browser option, A Browser window will appear.
Step 3: Now Go to Packages folder and right click and select new.
Step 4: Give the name of package and Purpose of package. Click ok.
Now packages contains two part declaration and body part. declaration contains the declaration of procedures and functions while body part contains the all logic for the function and procedures.
Declaration part of Package contains the Procedure and cursor declaration.
Package
- CREATE OR REPLACE PACKAGE PKG_DEMO is
- -- Author : DEMO_AUTHOR
- -- Created : 1/04.2010 10:00:33 AM
- -- Purpose : DEMO
- TYPE refcur IS REF CURSOR;
- -- Public type declarations
- v_const_partial VARCHAR2(10) := 'Partial';
- v_const_full VARCHAR2(10) := 'Full';
- PROCEDURE PRC_DEMO(ID IN NUMBER,
- CUR_RESULT OUT REFCUR);
- end PKG_DEMO;
Definition part of Package contains the Procedure and cursor declaration.
Package Body
- create or replace package body PKG_DEMO is
- PROCEDURE PRC_DEMO(ID IN NUMBER, CUR_RESULT OUT REFCUR) AS
- v_Sql LONG;
- BEGIN
- OPEN CUR_RESULT FOR 'SELECT * FROM TB_NAME';
- END PRC_DEMO;
- end PKG_DEMO;
0 comments:
Post a Comment