Product-specific packages, PL-SQL Programming

Assignment Help:

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.


Related Discussions:- Product-specific packages

Creating Views, Create a view named CustomerAddresses that shows the shippi...

Create a view named CustomerAddresses that shows the shipping and billing addresses for each customer in the MyGuitarShop database. This view should return these columns from the

Collections in pl sql, Collections:   The collection is an ordered gr...

Collections:   The collection is an ordered group of elements, all of similar type (for illustration, the grades for a class of students). Each element has an exclusive subsc

Calculate the total shopper spending, Many of the reports generated from th...

Many of the reports generated from the system calculate the total dollars in purchases for a shopper. Complete the following steps to create a function named TOT_PURCH_SF that acce

Parameter and keyword description - select into statement, Parameter and Ke...

Parameter and Keyword Description: select_item: This select_item is a value returned by the SELECT statement, and then assigned to the equivalent variable or field in the

Triggers, At times, customers make mistakes in submitting their orders and ...

At times, customers make mistakes in submitting their orders and call to cancel the order. Brewbean’s wants to create a trigger that automatically updates the stock level of all pr

Parameter and keyword description - packages, Parameter and Keyword Descrip...

Parameter and Keyword Description: package_name: This construct identifies the package. AUTHID Clause: This determine whether all the packaged subprograms impleme

Using subqueries, Using Subqueries A subquery is a query (typically ...

Using Subqueries A subquery is a query (typically enclosed by parentheses) that appears within another SQL data manipulation statement. If evaluated, the subquery gives a va

Fetching from a cursor variable, Fetching from a Cursor Variable The F...

Fetching from a Cursor Variable The FETCH statement retrieve rows one at a time from the product set of a multi-row query. The syntax for the same is as shown: FETCH {curso

Fetching with a cursor, Fetching with a Cursor The FETCH statements re...

Fetching with a Cursor The FETCH statements retrieve the rows in the result set one at a time. After each and every fetch, the cursor advance to the next row in the result set

Write a pl-sql program using the implicit cursor, Question: a) Given th...

Question: a) Given the following relation: Location(loc_id, bldg_code, room, capacity) The underlined field is a primary key. (i) Write a PL/SQL program using the impl

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd