Visit the Quest Software Home Page. Pipelines Home

Oracle PL/SQL Archives
Quest Experts Page

Click Here to subscribe to the Quest Pipelines Newsletter.  

Please Note: Some Newsletter articles, particularly in earlier editions, were pulled from content found in the Oracle PL/SQL Archives and are not duplicated here. Also, not all editions of the Newsletter contained PL/SQL articles whereas some editions contained more than one.

Volume I (2000)

Volume II (2001) Volume III (2002) Volume IV (2003) Volume V (2004) Volume VI (2005)

Future Oracle PL/SQL Enhancements (June 2000)
By Tushar Gadhia & Chris Racicot, Oracle Corp.

As Oracle technology evolves, numerous questions have been raised about the future direction of PL/SQL. The Oracle PL/SQL Team has several new projects planned for release 8.2 and above. A partial listing of these planned enhancements are listed in the attached document. As these enhancements become available, stay tuned to the Oracle Technology Network for announcements.

Click Here for a listing of current projects.


Oracle Native Dynamic SQL (July 2000)
Topic Extracted from Knowledge Xpert for PL/SQL.

Since Oracle 7.1, PL/SQL developers have been able to use the built-in DBMS_SQL package to execute dynamic SQL and PL/SQL.  But there are some problems with DBMS_SQL:

  • It is a very complicated package.
  • It has a number of restrictions (such as not recognizing and being able to work with new Oracle8 datatypes).
  • It is relatively slow.

So dynamic SQL, was re-implemented directly in the PL/SQL language itself.  This new facility is called Native Dynamic SQL.  Native Dynamic SQL is faster and easier to use than DBMS_SQL. 

Click Here for a listing of current projects.


The Perils of Code Recycling (July 2000)

This story was posted recently in the Jokes section of the PL/SQL Pipeline.  It was posted by Bill Pribyl from Datacraft, forwarded to him by Debby Russell at O'Reilly.  We're not certain where it came from, or if it's even true, but it ought to be!

Click Here for the story.


Creating Access Key Shortcuts in Forms (August 2000)
By Peter Koletzke (excerpt from Oracle Developer Advanced forms and Reports, Osborne/McGraw-Hill, Oracle Press, 2000)

In forms that require heavy data entry, users find it easier to use the keyboard for many operations. When you design forms in this category, you need to consider how the user can use the keyboard to navigate from one item to another and to activate buttons. It is easier to move the cursor by pressing keys when your hands are on the keyboard than by reaching for, moving, and clicking the mouse. Your forms can be used more efficiently if you take this into consideration. 

Click Here to see the article.


All About CRON Jobs (September 2000)
By Logan Ramasamy

When I started as a DBA and tried to run batch files as cron jobs it was unclear to me how to run cron jobs.  I tried to learn from Unix Administrators.  They didn't have time or they did not want to spare their knowledge.  So I learned all about cron jobs and the following is the outcome. 

Click Here to see the article.


PL/SQL Best Practices (In 1 Hour or Less)  (November 2000)
By Steven Feuerstein

This powerpoint presentation is of Steven's handouts from a presentation on the most important concepts of PL/SQL best practices.  The presentation covers coding in layers, crafting generic solutions, reducing code-volume, how to avoid hard-coding and streamlining your decision making. 

Click Here to see the presentation.


Tool Tips for Designer 6.0  (December 2000)
By Peter Kloetzke

It seems that Oracle Designer is a tool that everyone either loves or hates.  Those who love it appreciate its rich repository that offers centralized system development work.  Those who hate Designer are confused or frustrated by its complexity and steep learning curve.  This paper presents a dozen categories of the author's top tips to assist you, both in learning Oracle Designer and in applying it to a system development process. 

Click Here to see the paper.


Using Oracle 8i's ROLLUP Feature  (January 2001)
By Vijays, Datacons

Oracle 8i's ROLLUP feature enables a SELECT statement to calculate multiple levels of subtotals across a specified group of dimensions.  It also calculates a grand total.  ROLLUP is a simple extension to the GROUP BY clause, so its syntax is extremely easy to use.  The ROLLUP extension is highly efficient, adding minimal overhead to a query.  This paper explores the syntax and use of the ROLLUP command.  The January 2001 PL/SQL Tip explores further examples of Oracle's ROLLUP and CUBE functions.  Click Here for the Tip.

Click Here to see the paper.


Guidelines for Building Bullet-Proof Code  (February 2001)
By Daniel Clamage, Clamage Computer Consulting

When writing Production-quality software, take the attitude of making all your code bullet-proof right up front, the first time through coding (instead of thinking "I'll add it later").  This requires a tedious amount of pessimism about your own code.  It seems like overkill while you're writing it, but it'll really save your butt. 

Click Here to see the paper.


Web Application Case Study: Developing an Anonymous Survey  (March 2001)
By Brad Brown, TUSC

This section walks through a simple process you can use to create a generic survey system.  The first step is to design a storyboard to define each screen in the system.  This sketch helps us in the next step:  designing a generic data model that can be used to construct each page.  The last step is to actually code the system.  

Click Here to see the article.


Making Code Review a Regular Part of Your Development Process  (April 2001)
By Steven Feuerstein, Quest Software (This topic is reprinted with permission form Quest Software's re:Quest Newsletter

Developing a formalized Code Review process dramatically improves the quality, maintainability, and reliability of your code.  This topic identifies the need for Code Review, and discusses several methods for reviewing source code. 

Click Here to see the article.


Ask for Help After 30 Minutes on a Problem  (May 2001)
By Steven Feuerstein, Quest Software (Excerpt from Steven's new book "Oracle PL/SQL Best Practices")

Following this simple piece of advice will probably have more impact on your code than anything else in this book!

How many times have you stared at the screen for hours, trying this and that in a vain attempt to fix a problem in your code?  Finally, exhausted and desperate, you call over your cubicle wall:  "Hey Melinda, could you come over here and look at this?"  When Melinda reaches your cube she sees in an instant what you, after hours, still could not see.  Gosh, it's like magic! 

Click Here to see the article.


PL/SQL Best Practices: Solve Problems Simply  (June 2001)
By Thomas Kyte, Oracle Corporation, Oracle Magazine's "Ask Tom" column 
Excerpt from "Expert One-On-One Oracle", WROX Press

There are always ways two ways to solve everything: the easy way and the hard way.  Time and time again, I see people choosing the hard way.  It is not always done consciously.  More usually, it is done out of ignorance.  They never expected the database to be able to do 'that'.  I, on the other hand, expect the database to be capable of anything and only do it the 'hard' way (by writing it myself) when I discover it cannot do something.

Click Here to see the excerpt from Tom's book.


Oracle 9i PL/SQL New Features  (July 2001)
By Sandeepan Banerjee, Oracle Corp PL/SQL Development Team 

At the center of Oracle's time-tested platform stand SQL and PL/SQL. In Oracle9i, architectural enhancements make PL/SQL significantly faster.  PL/SQL has been integrated with XML as never before.  PL/SQL has also been enhanced to provide a number of functional improvements.  With these enhancements, the Oracle development stack makes available today what other frameworks are promising for tomorrow. 

Click Here to see a paper listing the Oracle 9i PL/SQL enhancements.


Understanding Checkboxes in HTML Forms  (August 2001)
By Kevin Runner, Runner Technologies 

Checkboxes are an excellent way to represent two-state columns to the user.  They are intuitive for the end-user, however they can be a bit tricky to implement for the web developer.

Checkboxes are commonly referred to as flags or indicators.  Database columns are typically represented as checkboxes when they are length of one (1) character or number, such as VARCHAR2(1) or NUMBER(1).  Valid values for a column like this are usually 1/0 or Y/N, representing an On/Off state. 

Click Here to see the article.


PL/SQL Best Practices:  "How do I Make it Run Faster?"  (August 2001)
By Tom Kyte, Oracle Corporation PL/SQL Development Team 

This article is an excerpt from Tom Kyte's latest book, "Expert One on One: Oracle" released in June by WROX Press.  These and other Oracle books can be purchased at a discount from the Illuminations Book Store.

Performance is something you have to design for, to build to, and to test for continuously throughout the development phase.  It should never be something to be considered after the fact.  I am amazed at how many times people wait until the application has been shipped to their customer, put in place and is actually running before they even start to tune it. 

Click Here to see the excerpt.  

 


Oracle 9i Cursor Sharing  (September 2001)
By Szabo Imre  

This article comes from one of our readers in Hungary.  Szabo discusses the implications of using the new feature, and our Pipeline SYSOP team comments on the article. 

Click Here to see the article.


UTL_SMTP: E-Mail from PL/SQL  (October 2001)
By Darryl Hurley, Pipeline SYSOP 

Sending electronic mail from PL/SQL is a long awaited feature that finally arrived with version 8.1 of the database.  Finally the outside world can be notified directly of events within the database using standard PL/SQL packages.  Things like notifying users of important data changes or notifying the DBA of impending lack of storage space can now be performed within PL/SQL.

Granted that sending mail from the database has been available for quite some time using methods like creating text files of mail commands for CRON jobs to process later or similar interfaces but now it can be done directly from PL/SQL! 

Click Here to see the paper.


Sending Email from within Your Oracle Database  (November 2001)
By Bob Mycroft 

In the October 2001, we featured a popular article on UTL_SMTP, written by Darryl Hurley, (see above). Bob Mycroft has submitted a paper that serves as a nice follow-up with excellent examples.

This article should be of interest to both the developer and the DBA.  To try and shed some light on why this might be, I have thought of a couple of examples where the ability for the database itself to send emails would add value to an application or system.

Firstly, imagine a simple stock control system.  With email functionality available from within the rdbms, you could code triggers that would email the supplier when stock of a particular item fell below a threshold level.  This would be ideal for a 'just-in-time' warehouse system where the levels of stock must be tightly controlled.  

Click Here to see the paper.


Using Dynamic SQL for Updates with Bind Variables  (February 2002)
By Chris Weiss, Chief Scientist, PureCarbon 

The following article represents an efficient way of using dynamic SQL and stored procedures for performing updates using the EXECUTE IMMEDIATE...USING statement. This method is useful even when the bind list is not known in advance.   

Click Here to see the article.


Using INSTR as an Alternative to Using the IN and NOT IN Operators  (February 2002)
By Grant Daley and Brahmaiah Koniki 

From Australia, Pipeliners Grant Daley and Brahmaiah Konika have supplied a few tips for using INSTR as an alternative to using the IN and NOT IN operators.   

Click Here to see the tips.


Oracle 8i PL/SQL FTP Protocol Implementation (March 2002)
By Dmitry Bouzolin 

This paper shows basic ideas of how to work with FTP protocol from an Oracle database, presenting a PL/SQL package example, which allows you to download text files right inside your Oracle database.  The task of building an Oracle package even with minimal ftp functionality is very complex and challenging, but feasible.  In this paper, the author shows the basic approach to the process.   

Click Here to see the paper.


A Brute Force Approach to Debugging Forms (March 2002)
By Ryan Gaffuri, Bloodworth Integrated Technology 

You're sitting at your desk and your manager comes over to you, hands you an issue that needs to be fixed - the client is complaining because something is not working, let it be a forms crash, triggers acting improperly, or anything else.  This is the kind of thing that the Oracle documentation and the books do not discuss.  You have no idea what is going on.  You scan Metalink and OTN to see if anyone else has had this issue and find nothing.  The Oracle representative responds to your post saying that they were unable to recreate the error.  You're under time pressure.  The client and your management want this fixed.  What do you do?   

Click Here to see the answer.


Introduction to Oracle8i Analytic Functions (April 2002)
By Adrian Billington 

Analytic functions were introduced in Release 2 of 8i and simplify greatly the means by which pivot reports and OLAP queries can be computed in straight, non-procedural SQL.  Prior to the introduction of analytic functions, complex reports could be produced in SQL by complex self-joins, sub-queries and inline-views but these were resource-intensive and very inefficient.  Furthermore, if a question to be answered was too complex, it could be written in PL/SQL, which by its very nature is usually less efficient than a single SQL statement.

There are three types of SQL extensions that fall under the banner of "analytic functions" (though the first could be said to provide "analytic functionality" rather than actually be analytic functions):

  • new grouping of result sets through extensions to the GROUP BY clause (ROLLUP and CUBE)

  • new analytic functions themselves

  • TOP-N analysis (largely enabled by the analytic functions).

Each of these will be dealt with in turn.   

Click Here to see the paper.


PL/SQL Scan Function (June 2002)
By Fuping Peng 

This PL/SQL scan function will return the nth word of a string using a delimiter of your choosing.   

Click Here to see the script.


ALERT_LOG_MANAGER (June 2002)
By Darryl Hurley, Pipeline SYSOP 

This PL/SQL package takes advantage of external tables in Oracle 9 to make Oracle alert logs and trace files available for display within the database itself as shown in the following demonstrations.

The current version of alert_log_manager focuses on trace files. Specifically locating them in the alert log and displaying their contents.   

Click Here to see the article.


Explain Plan - MSSQL style (July 2002)
By Christian Adams 

I work with MS SQL Server as well as Oracle, and I like the information SQL Server's Query Analyzer gives you when you request the execution plan for a query. It shows you the cost of each task, the total cost of all the child tasks under each task (subcost), and percentages of these two figures relative to the total cost of the query.

Conversely, Oracle's EXPLAIN PLAN combines the cost of each task with the cost of it's children, which sometimes makes it tricky to interpret which individual tasks are more expensive than others.

I have a script I found a while back, EXPLAIN.SQL, which runs EXPLAIN PLAN against the query currently in the SQL*PLUS query buffer. I modified it to separate each task's cost from the costs of its children, and to compute the percentages.   

Click Here to see the script.


Loading External XML Files (July 2002)
Topic Extracted from Knowledge Xpert for PL/SQL™ 

When a developer is setting out to store the contents of an XML document in the database to perform queries over its content and structure, one of the first questions that arises is, “How do I get XML files in there?” Here you’ll start simple and work through the steps of loading an existing XML file into a CLOB column.

CLOB (pronounced “klob” or “see-lob”) stands for C haracter L arge OB ject. Think of a column of type CLOB as a very, very large VARCHAR2. It can hold character-based data like XML documents as large as four gigabytes (4GB).   

Click Here to see the topic.


Using UTL_SMTP (October 2002)
By Michael Selvaggio

I wrote this package to send email messages from PL/SQL. Using existing examples, I added the simple ability to pass a query in and return data in the text of the email. I also allow the passing in of a PL/SQL table for an address list. Click on the links below for the procedure and a sample execution.

Click Here to see the procedure.
Click Here to see the sample execution.


Calculating the Buffer Cache Hit Ratio for Accurate Results (November 2002)
Extracted from the Quest Pipelines PL/SQL Pipetalk

This script is a PL/SQL procedure that can be used to periodically load hit ratio, usage, and number of users into a table for later review. This will provide valuable information about peak usage times and hit ratio at those peak times. This procedure/table can be used to store entire database hit ratio or per user hit ratios.

Click Here to see the script.


Alert Log Scanner (November 2002)
By Michael Selvaggio

The following Unix shell script was written for HP/UX to scan the alert log, checking if Oracle and the SQL*Net listener are up in an effort to be proactive regarding system errors. It's based on a script from www.dba-oracle.com but it has been enhanced to be submitted once and run every minute and end at a predefined time. It also doesn't resend the same error all day. It only sends messages since the last scan.

Click Here to see the script.


Procedure to Count the Number of Nulls Occurring in a Table (December 2002)
By Dan Clamage, Pipeline SYSOP

This stored procedure generates an anonymous PL/SQL block that calculates how many NULL values occur in each column for all rows of the given table. It returns a string of the form "col1,cnt1,col2,cnt,...,colN,cntN" where colN is the column name and cntN is the number of NULL values found for the column. It also displays the entire anonymous block so you can see what it is doing.

Click Here to see the script.


Procedure to Print the Difference Between Two Date Values (December 2002)
By Dan Clamage, Pipeline SYSOP

This stored procedure prints the absolute difference between two DATE values in hours-minutes-secs. It can also be turned into a function to return the string instead of printing it through dbms_output.

Click Here to see the script.


Get Working Days without Using the WORK_DAYS Function (January 2003)
By Michael Selvaggio

This function allows users to calculate the working days between two dates when they are unable to create the Oracle function WORK_DAYS. The same logic is implemented in a SELECT statement.

Click Here to see the script.


Connectionless Logging to Oracle on UNIX (January 2003)
By James Thorby

For Unix based console applications it is sometimes important to log messages to Oracle as well as to log files. Long running processes may require real-time logging for meaningful feedback and, with the prevalence of web applications against Oracle databases it is a convenient way of storing these messages for easy client access. This example demonstrates a method of allowing Unix applications to log to Oracle without incurring the time penalty of repeated connect/disconnects or the complexity of writing custom ProC/Java Daemons (i.e. a program running in the background that would handle all database logging requests for the application).

Click Here to see the paper.


Utility to Change Database Links (February 2003)
By Shankar Govindan

This is a small script that logs on to the database, checks if there are any links that use the specific password. The information is then spooled, the script logs in as the owner of the link, drops the database link and recreates it. It then tests the database link and sends a mail out to the DBA.

Click Here to see the script.


Utility to Check Database Links (February 2003)
By Shankar Govindan

This utility is a handy one to check all the private database links that exist in the database under different users. This script checks all the private database links available, identifies the user who owns the database links and connects as owner of the database link and tests the link for connectivity. It then spools the information and mails to the mailing address specified.

Click Here to see the script.


External Tables (March 2003)
By Dan Clamage

If all you need to do is read from a flat file, consider using external files instead of UTL_FILE. With UTL_FILE, you have to control file I/O yourself (open, get_line, close), plus write code to parse out the fields you want. Instead, using a SQL*Loader-like syntax, you can let Oracle handle all of that for you. Here is a very simple example. I've left out some error handling like bad record log files, etc. I ran this with Oracle 9.2 under NT 4.0, but it should work as well under UNIX.

Click Here to see the procedure.


Dynamic Method Dispatch and Method Overloading in a Subtype (May 2003)
By Zlatko Sirotic

Oracle 9i has support for inheritance, method overriding and "dynamic method dispatch" (or "dynamic binding", or "virtual"). When we have inheritance and overriding, a process of selecting a method implementation is called "dynamic method dispatch" because it is done at run time, not at compile time. A method call is dispatched to the nearest implementation, working back up the inheritance hierarchy from the current or specified type.

When child (type) overrides parent's method, dynamic method dispatch in PL/SQL works as expected. This simple example shows that after polymorphic assignment, child method is executed.

Click Here to see the script.


Generic Log Package (July 2003)
By Zlatko Sirotic

This script creates a generic procedure that can be used for maintaining a transaction log for audit purposes.

Click Here to see the package.


Creating XML Documents with PL/SQL (July 2003)
By Christoph Gächter

This article shows some of the possibilities how XML documents can be created with PL/SQL and Oracle 8i or 9i. The discussed topics are:

  • XMLGEN Package
  • XML-SQL Utility for PL/SQL
  • XMLDOM Package
The examples use the well known tables DEPT (the master table) and EMP (the detail table): Every employee has exactly one department assigned. One department has no, one, or more employees.

Click Here to see the article.


ORACLE 9i MERGE Statement - Decomposing SQL%ROWCOUNT (September 2003)
By Adrian Billington

The MERGE statement (AKA "UPSERT") released in Oracle 9i is possibly one of the most useful ETL-enabling technologies built into the Oracle kernel. For those who have missed Oracle's headlines for the last year and a half and are unaware of what the MERGE statement does, it simply enables us to either UPDATE or INSERT a row into a target table in one statement. You simply tell Oracle your rules for determining whether a target row should be UPDATEd or INSERTed from the source, and Oracle does the rest.

Click Here to see the paper.


Ad Hoc Queries Against Tables/Views (December 2003)
By Dave Keller

The adhoc_pak is a PL/SQL package geared towards allowing Ad Hoc queries against tables/views. It relies on Oracle iAS to provide the Web interface. To use, first alter the package specification by changing the schema owner variable as appropriate and compile it into the database. Then compile the package body into the database - no changes are needed.

Click Here to see the article.


Logminer in Action (January 2004)
By Frank Pantaleo

The body of work that follows was born out of a desire to replicate data out of production. Of course we needed to do this while minimizing the effect on production. The best way to do this was to leverage APIs that Oracle made available in 8i. Some or all of the logic provided becomes unnecessary in 9i with the introduction of Oracle streams. However, I would contend that the procedures below provide a better level of control.

Click Here to see the article.


Transaction, Heal Thyself! Part 1 (February 2004)
By Darryl Hurley

Oracle 9i introduces a long awaited feature that suspends certain transactions instead of failing them straight away. Starting with this article, Darryl will discuss how you can take advantage of resumable transactions to support sophisticated transaction processing requirements. He will also highlight shortcomings and remedy them with his custom-built solutions.

This article was originally published in the May, 2003 issue of Oracle Professional.

Click Here to see the article.


Transaction, Heal Thyself! Part 2 (March 2004)
By Darryl Hurley

Oracle 9i introduces a long awaited feature that suspends certain transactions instead of failing them straight away. In last month’s article Darryl discussed how to augment resumable statements to automatically resolve storage issues. In this second article of the series he focuses on a key area of resumable statements, namely, responding to timeouts and terminations.

This article was originally published in the June, 2003 issue of Oracle Professional.

Click Here to see the article.


Transaction, Heal Thyself! Part 3 (April 2004)
By Darryl Hurley

Oracle 9i introduces a long awaited feature that suspends certain transactions instead of failing them straight away. The first two parts of this series laid the groundwork for automatically fixing space related errors by augmenting Oracle 9i’s resumable statement functionality. This expansion comes complete with a catchy name, THY, which loosely stands for Transaction, Heal Thyself. It’s also the name of the single Oracle schema holding all of the working code described below.

This article was originally published in the August, 2003 issue of Oracle Professional.

Click Here to see the article.


Transaction, Heal Thyself! Part 4 (May 2004)
By Darryl Hurley

Oracle 9i introduces a long awaited feature that suspends certain transactions instead of failing them straight away. In this series of articles Darryl presents a methodology to take advantage of resumable transactions to support sophisticated transaction processing requirements. Part IV imparts more details of his custom built solution for handling objects exceeding their maximum extent allotment.

This article was originally published in the October, 2003 issue of Oracle Professional.

Click Here to see the article.


Transaction, Heal Thyself! Part 5 (June 2004)
By Darryl Hurley

Oracle 9i introduces a long awaited feature that suspends certain transactions instead of failing them straight away. In this series of articles Darryl presents a methodology to take advantage of resumable transactions to support sophisticated transaction processing requirements. Part V delivers his custom built solution for handling the most literal of space errors, NO MORE SPACE. Also in this final article in the series he concludes with general error handling and a look to the future including Oracle 10G.

This article was originally published in the January, 2004 issue of Oracle Professional.

Click Here to see the article.


PL/SQL Procedure - Write Records to Excel File (July 2004)
By Tom Kyte

This PL/SQL procedure will write records to an Excel File.

There is more then one format we can use to write an excel file -- from CSV to SYLK. I will demonstrate the SYLK format as I already have the code and it offers the ability to do much fancier stuff like fonts, headings, formulas and such. 

We will use UTL_FILE (see the supplied packages guide for setup info on that package. You need an init.ora parameter set for this to work correctly). UTL_FILE allows us to write a file on the server and since your workstation = server, this should work nicely for you.

Click Here to see the script.


DateADD (August 2004)
By George Joseph

This function will return a new date value based on adding an interval to the specified date.

Click Here to see the script.


Improving PL/SQL Performance By Using Collections (August 2004)
By Mark Rittman

Yesterday I looked at some code written in Oracle 7-style PL/SQL, and compared it with what is considered best practice with Oracle 8i and 9i. The more up-to-date code generally runs around 3-5 times faster than the old style code, and, as part of understanding where the changes to PL/SQL have occurred, I've started off by looking at how Oracle now handles a concept known as 'Collections'.

Click Here to see the article.


What's My Line? Tracking Exceptions in Oracle10g (September 2004)
By Adrian Billington

It has always been possible in PL/SQL to identify the source of an exception in a block of code; i.e. to know the precise point at which a block of code failed. However, until Oracle 10g, it has not been possible for developers to intervene in the exception in any way whilst retaining this information ( for example to record the exception and its source in application logs ). This has been the cause of many a frustration for developers.

Finally, with the release of 10g, Oracle has added provision for PL/SQL developers to trap AND log exceptions accurately for the first time. The DBMS_UTILITY.FORMAT_ERROR_BACKTRACE function gives us the flexibility we have been demanding for years and the information that the DBMS_UTILITY.FORMAT_ERROR_STACK function simply didn't provide.

Click Here to see the article.


Self-Managing PL/SQL (October 2004)
By Steven Feuerstein

Oracle has introduced significant management automation features in its flagship database product and has described the new Oracle Database 10g release as "the self-managing database." Given that achievement and direction, I thought it would make sense to talk about how to write one's PL/SQL application so that it is also self-managing.

Click Here to see the article.


Number to Words (December 2004)
By Dieter Oberkofler

This script converts numbers to their English equivalent and returns it as a string.

Click Here to download the script.


Bulk Bind Operations (January 2005)
Topic Extracted from Knowledge Xpert for PL/SQL

Bulk bind operations help to improve the performance of PL/SQL operations. Oracle 10g introduces two new types of functionality for bulk binds, including:

  • Processing of sparse collections
     
  • New exception handling

Click Here to read more on bulk bind operations.


Explain Plan's AUTOTRACE Facility (February 2005)
Topic Extracted from Knowledge Xpert for PL/SQL

The EXPLAIN PLAN command is not the only way to see an execution plan for a given SQL statement. SQL*Plus includes the AUTOTRACE facility. The problem with the EXPLAIN PLAN command is that the EXPLAIN PLAN statement has to be explicitly run for the query you want to examine, then the plan table has to be queried. Once done, the information may be removed from the plan table before the process is repeated.

The AUTOTRACE facility is an easier way to accomplish the same goal. The AUTOTRACE facility is only available in SQL*Plus. Unlike the EXPLAIN PLAN command, the AUTOTRACE facility must use a table called PLAN_TABLE. The EXPLAIN PLAN command can use a plan table of any name. The PLAN_TABLE table can be created with the ORACLE_HOME/rdbms/admin/utlxplan.sql supplied script. Additionally, before starting the AUTOTRACE facility, you must have been granted the PLUSTRACE role. This role is created with the ORACLE_HOME/sqlplus/admin/plustrce.sql supplied script.

Click Here to read more on the AUTOTRACE facility.


Refactoring for PL/SQL Developers (April 2005)
By Steven Feuerstein

What is refactoring?

Most PL/SQL developers stay very busy building applications. As a result, relatively few explore the wider world of software programming, in which the topic of refactoring is known.

Refactoring, to quote the book Refactoring: Improving the Design of Existing Code by Martin Fowler et al. (Addison-Wesley, 1999), "is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure. . . . It is a disciplined way to clean up code that minimizes the chances of introducing bugs. In essence when you refactor you are improving the design of the code after it has been written."

Click Here to see the article.


Creating Stored Outlines - Part 1 (May 2005)
Topic Extracted from Knowledge Xpert for PL/SQL

Stored outlines bring stability to your application's SQL statements. It is possible to make a better decision than the CBO, and then to want the application use your decision over the CBO's decision. Additionally, changes in the data distribution can alter an execution plan of a SQL statement, once the CBO has new statistics on the new data. Stored outlines are also great when working with third party applications, where you cannot touch the SQL statements, but you'd like to alter how they run. You can provide execution plan stability through the use of stored outlines.

Click Here to see the topic.


Creating Stored Outlines - Part 2 (June 2005)
Topic Extracted from Knowledge Xpert for PL/SQL

Stored outlines bring stability to your application's SQL statements. It is possible to make a better decision than the CBO, and then to want the application use your decision over the CBO's decision. Additionally, changes in the data distribution can alter an execution plan of a SQL statement, once the CBO has new statistics on the new data. Stored outlines are also great when working with third party applications, where you cannot touch the SQL statements, but you'd like to alter how they run. You can provide execution plan stability through the use of stored outlines.

Click Here to see the topic.


Use of Grouping_ID in Summary Queries (July 2005)
By Keshav Chennakeshav

This is a way to analyze grouped data when grouping more than one column with GROUP BY ROLLUP(col1,col2,..) using GROUPING_ID(col1,col2,..).

Click Here to see the script.


Unloading Data Using External Tables in Oracle 10g (July 2005)
By Adrian Billington

This is an introduction to a new feature of external tables in 10g, namely the ability to unload data from the database using SQL. Introduced in 9i, external tables provided a new means of reading flat file data without first loading it into a staging table. They offered additional benefits over traditional SQL*Loader methods in that loading data became as simple as an INSERT..SELECT, with all the SQL processing and manipulation options that such a statement implies. It also meant that more of the ETL application could be self-contained in PL/SQL packages, as call-outs to SQL*Loader or batch scripts were no longer necessary to load data.

Oracle 10g has taken external tables a stage further by enabling an external table to be created as a CTAS ( Create Table As Select ) operation, which enables a one-time unloading of data. When I first saw the headlines about "writing" to an external table, I must admit to being excited by the possibilities of a native data unloader ( no more sqlplus spools, UTL_FILE writes, Pro*C unloaders etc ). Alas, this is not the case. Oracle has in fact supplied a new access driver known as "ORACLE_DATAPUMP" which means that Oracle will "unload" an external table to a proprietary format usable by the Data Pump set of utilities ( significant new 10g feature to replace imp and exp ). So, generating an ASCII, CSV file from external tables is not possible, but this new feature is exciting nonetheless.

Click Here to see the article.


Database Interaction with PL/SQL, Part 1 (August 2005)
By Jagadish Chatarji

This first article in a series focusing on database interactions with Oracle PL/SQL serves as a good introduction to the topic. It mainly focuses on the basics of retrieving information from the Oracle database using the SELECT..INTO statement, as well as two attributes, namely "%TYPE" and "%ROWTYPE." Readers should have some knowledge of RDBMS, Oracle SQL, and some very fundamental grounding in PL/SQL.

Click Here to see the article.


Is element found in collection? (September 2005)
By Steven Feuerstein

Oracle Database 10g allows you to use MEMBER OF syntax to determine if a particular values is a "member of" a nested table. Here is an example:

DECLARE
 TYPE clientele IS TABLE OF VARCHAR2 (64);
 client_list_12 clientele :=
 clientele ('Customer 1', 'Customer 2');
BEGIN 
 IF 'Customer 1' MEMBER OF client_list_12
 THEN
 DBMS_OUTPUT.put_line ('Customer 1 is in the 12 list');
 END IF;
 IF 'Customer 3' NOT MEMBER OF client_list_12
 THEN
 DBMS_OUTPUT.put_line ('Customer 3 is not in the 12 list');
 END IF;
END;
/

Click Here to see more.


PL/SQL Pipeline

For questions or comments on this site: webmaster@quest-pipelines.com
All content Copyright © Quest Software, Inc. All rights reserved.