Product-specific packages, PL-SQL Programming

Product-specific Packages

The Oracle and different Oracle tools are supplied with the product-specific packages which help you to build the PL/SQL-based applications. For illustration, the Oracle is supplied with a lot of utility packages, a few of that are highlighted below.

DBMS_STANDARD

The Package DBMS_STANDARD gives language facilities which help your application interact with the Oracle. For illustration, the procedure raise_application_error issue a user-defined error messages. In that way, you can report the errors to an application and evade returning the unhandled exceptions.

DBMS_ALERT

The Package DBMS_ALERT use the database triggers to alert an application when the definite database values change. The alerts are asynchronous (i.e., they operate separately of any timing mechanism) and transaction based. For illustration, a company may use this package to update the value of its investment portfolio as the new stock and bond quotes arrive.

DBMS_OUTPUT

The Package DBMS_OUTPUT enables you to display output from the PL/SQL subprograms and blocks, that makes it easier to test and debug them. The procedure put_ line results the information to the buffer in the SGA. You can display the information by calling the procedure get_line or by setting the SERVEROUTPUT ON in the SQL*Plus. For illustration, assume that you create the stored procedure which is as shown below:

CREATE PROCEDURE calc_payroll (payroll OUT NUMBER) AS

CURSOR c1 IS SELECT sal, comm FROM emp;

BEGIN

payroll := 0;

FOR c1rec IN c1 LOOP

c1rec.comm := NVL(c1rec.comm, 0);

payroll := payroll + c1rec.sal + c1rec.comm;

END LOOP;

/* Display debug info. */

DBMS_OUTPUT.PUT_LINE('Value of payroll: ' || TO_CHAR(payroll));

END;

Whenever you issue the commands below, the SQL*Plus display the value assigned by the procedure to the parameter payroll:

SQL> SET SERVEROUTPUT ON

SQL> VARIABLE num NUMBER

SQL> CALL calc_payroll(:num);

Value of payroll: 31225

DBMS_PIPE

The Package DBMS_PIPE allows various sessions to communicate over the named pipes. (A pipe is a region of memory used by one of the process to pass information to the other.) You can use the procedures pack_message & send_message to pack a message into the pipe, then it send to the other session in the similar instance.

At the other part of the pipe, you can use the procedures receive_message and unpack_message to receive and unpack the message. The Named pipes are helpful in many ways. For illustration, you can write the routines in C which allow an external servers to collect the information, then send it through pipes to the procedures stored in an Oracle database.

UTL_FILE

The Package UTL_FILE permits your PL/SQL programs to read & write operating system (OS) text files. It gives a restricted version of the standard OS stream file I/O, involving the open, put, get, and close operations. When you desire to read or write a text file, you call the function fopen that returns a file handle for use in consequent procedure calls. For illustration, the procedure put_line writes a text string and line terminator to an open file. The procedure get_line reads a line of the text from an open file into an output buffer.

The PL/SQL file I/O is accessible on both the client and server sides. Though, on the server side, the file access is constrained to those directories explicitly listed in the accessible directories list that is stored in the Oracle initialization file.

UTL_HTTP

The Package UTL_HTTP permits your PL/SQL programs to make hypertext transfer protocol (HTTP) callouts. It can recover data from the Internet or call Oracle Web Server cartridges. The package has 2 entry points, each of that accepts a uniform resource locator (URL) string, links the specified site, and returns the requested data, that is usually in the hypertext markup language (HTML) format.

Posted Date: 10/8/2012 1:11:52 AM | Location : United States







Related Discussions:- Product-specific packages, Assignment Help, Ask Question on Product-specific packages, Get Answer, Expert's Help, Product-specific packages Discussions

Write discussion on Product-specific packages
Your posts are moderated
Related Questions
Query: SELECT * FROM EMPLOYEE1; Select 5 columns and all rows from one table Query: SELECT C_ID, COMPANY, BUILDING, DEPARTMENT, BRANCH FROM CONTRACT;

Using COUNT The COUNT returns the number of elements that a collection presently contains. For instance, when a varray projects contains 15 elements, then the following IF con

Keyword and Parameter Description: label_name: This is an undeclared identifier which labels an executable statement or the PL/SQL block. You can use a GOTO statement to

Declaring a Cursor The Forward references are not allowed in the PL/SQL. Therefore, you must declare a cursor before referencing it in other statements. Whenever you declare a

Semidifference via EXCEPT and JOIN - SQL SELECT * FROM (SELECT StudentId FROM IS_CALLED WHERE Name = 'Devinder' EXCEPT DISTINCT CORRESPONDING SELECT StudentId

This is a Customer Management project. Customer data is presented in a text file. The program will load this text data into its DB columns. The data mapping is user definable. User

Example of Shorthand for a row constraint Example: Shorthand for a row constraint ALTER TABLE EXAM_MARK ADD CONSTRAINT Mark_in_range CHECK (Mark BETWEEN 0 AND 100);

Primary Key - SQL A PRIMARY KEY specification carries an implicit NOT NULL constraint on each column of the specified key. When more than one key constraint is required, the k

Using Aliases The Select-list items fetched from a cursor related with the %ROWTYPE should have simple names or, if they are expressions, should have aliases. In the example bel

The accuracy of product table data is critical and the Brwebean's. owner wants to have an audit file that contains information regarding all DML activity on the BB_PRODUCT table. T