Custom Search
www.rocket99.com : Technical Guides Sybase Oracle UNIX Javascript


Technical Guides
Sybase
Oracle
UNIX
Javascript




Of Interest

Business Intelligence and Analytics



Oracle Training





Oracle » PL-SQL » Coding »

Packages

     



A package is a construct which bounds related procedures and functions together.
Variables declared in the declaration section of a package can be shared among the
procedures/functions in the body of the package.


/* package */

CREATE OR REPLACE PACKAGE INVPACK
IS

FUNCTION COUNTINV (SALESREP IN VARCHAR2) RETURN INTEGER;

PROCEDURE PURGEINV (INV_ID IN INTEGER) ;

END INVPACK;


/* package body */

CREATE OR REPLACE PACKAGE BODY INVPACK
IS

COUNT1 NUMBER;

FUNCTION COUNTINV (SALESREP IN VARCHAR2) RETURN INTEGER
IS
BEGIN

SELECT COUNT(*)
INTO COUNT1
FROM INVOICE
WHERE SALES_REP_ID = SALESREP ;

RETURN COUNT1 ;
END COUNTINV;


PROCEDURE PURGEINV (INV_ID1 IN INTEGER)
IS
BEGIN

DELETE FROM INVOICE
WHERE INV_ID = INV_ID1

END PURGEINV;

/* initialization section for package */
BEGIN

COUNT1 := 0 ;

END INVPACK;










Oracle : Related Topics

Oracle : PL-SQL : Creating a stored procedure
Oracle : PL-SQL : Displaying output
Oracle : PL-SQL : Output variables
Oracle : PL-SQL : Arrays and structures
Oracle : PL-SQL : Conditionals
Oracle : PL-SQL : Looping in PL-SQL
Oracle : PL-SQL : Exception Handling
Oracle : PL-SQL : Sleep and Wait
Oracle : PL-SQL : Date Manipulation
Oracle : PL-SQL : Parallel Query Processing
Oracle : PL-SQL : Exit if error, in a SQL script
Oracle : PL-SQL : Cursors
Oracle : PL-SQL : Complex IF/THEN Processing
Oracle : PL-SQL : Creating triggers
Oracle : PL-SQL : Ranking Data
Oracle : PL-SQL : How to do an outer join in Oracle
Oracle : PL-SQL : Loops in PL-SQL : Hierarchy

Sybase Web Site
Sybase iAnywhere Mobile Web Site
Oracle Enterprise Web Site



Get the latest Rocket99 news and tech tips via






Site Index About this Guide to Sybase, Oracle, and UNIX Contact Us Advertise on this site




Copyright © 2016 Stoltenbar Inc All Rights Reserved.