Quantcast
Channel: PL/SQL – Jeff Kemp on Oracle
Browsing all 30 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Count All Rows in a Schema

I wrote this simple SQL*Plus script to loop through all the user’s tables and report how many rows were in them at this point in time. Normally I might estimate this information based on the table...

View Article



Image may be NSFW.
Clik here to view.

Infinite Query

This is the query that never ends, It just goes on and on, my friends. Some people started fetching not knowing what it was, And now they can’t stop fetching forever just because… This is the query...

View Article

Image may be NSFW.
Clik here to view.

SPOD for a query

I have two queries that need to be executed by a PL/SQL program. Both of them are quite complex, and both of them have a large section which is identical – because they are different views of the same...

View Article

Image may be NSFW.
Clik here to view.

Add business days

It starts out as a fairly simple, innocent business requirement. Create a report to list records meeting some criteria, one of which is: “List only records where today’s date is more than 35 business...

View Article

Image may be NSFW.
Clik here to view.

Designing a PL/SQL API – BOOLEAN or CHAR?

A simple question: you’re designing an API to be implemented as a PL/SQL package, and you don’t (yet) know the full extent to which your API may be used, so you want to cover a reasonable variety of...

View Article


Image may be NSFW.
Clik here to view.

Generating unique identifiers with “SELECT MAX(id) + 1″

Normally, when you see code like this in a production system, you should duck your head and run: SELECT NVL( MAX( id ), 0 ) + 1 INTO :new_id FROM mytable; What’s wrong with this code? I hope the first...

View Article

Image may be NSFW.
Clik here to view.

Alexandria: May Cause Addiction

Ever since I downloaded the Alexandria PL/SQL library, I haven’t been able to put it down. Just recently I decided I wanted to serve up a whole lot of media files directly from Amazon’s S3 simple...

View Article

Image may be NSFW.
Clik here to view.

Code I Regret: Refactoring as Penance

Recently I refactored some PL/SQL for sending emails – code that I wrote way back in 2004. The number of “WTF“‘s per minute has not been too high; however, I’ve cringed more times than I’d like… 1....

View Article


Image may be NSFW.
Clik here to view.

Forbidden PL/SQL

What’s the biggest clue you can give that your database is vulnerable to SQL injection? When your list of “forbidden words” looks suspiciously like a sample of SQL / PL/SQL keywords: I notice that they...

View Article


Image may be NSFW.
Clik here to view.

Which packages might raise “ORA-04068 existing state of package has been...

I recently saw this question on StackOverflow (“Is there any way to determine if a package has state in Oracle?”) which caught my attention. You’re probably already aware that when a package is...

View Article

Image may be NSFW.
Clik here to view.

Alexandria Updated

Just a quick post to point out that the Alexandria PL/SQL Library has been updated to v1.7, including updates to the Amazon S3 package and a new package for generating iCalendar objects – more details...

View Article

Image may be NSFW.
Clik here to view.

Apex Dynamic Action silently fails – a story

Here is a short story about a little problem that caused me a bit of grief; but in the end had a simple cause and a simple fix. I had a dynamic action in my Apex 4.1 app that had to run some PL/SQL –...

View Article

Image may be NSFW.
Clik here to view.

Using compound triggers to boost your journal table performance

If your schemas are like those I deal with, almost every table has a doppelgänger which serves as a journal table; an “after insert, update or delete” trigger copies each and every change into the...

View Article


Image may be NSFW.
Clik here to view.

RETURNING RECORD INTO

This is an idea for an enhancement to the PL/SQL syntax. If I have the following declaration: DECLARE in_record mytable%ROWTYPE; out_record mytable%ROWTYPE; BEGIN I can do this: INSERT INTO mytable...

View Article

Image may be NSFW.
Clik here to view.

“Smart quotes” showing as “?” in emails

When some of my users were using my system to send emails, they’d often copy-and-paste their messages from their favourite word processor, but when my system sent the emails they’d have question marks...

View Article


Image may be NSFW.
Clik here to view.

TAPI Generator MkII

The last few weeks I’ve made quite a few improvements to my TAPI generator which I thought I’d share. I’ve also added an Apex API generator which generates code suitable for interfacing between simple...

View Article

Image may be NSFW.
Clik here to view.

Apex API – call a package for all your DML

If you create an Apex form based on a table, Apex automatically creates processes of type Automatic Row Fetch and Automatic Row Processing (DML) as well as one item for each column in the table, each...

View Article


Image may be NSFW.
Clik here to view.

Dumb triggers? Let’s make ’em a bit smarter

Some time back, Connor rightly pointed out that triggers that modify data can get in the way when you need to do out-of-the-ordinary data maintenance, e.g. when you need to fix up a row here or...

View Article

Image may be NSFW.
Clik here to view.

Apex API for Tabular Forms

Ever since I started exploring the idea of using a TAPI approach with Apex, something I was never quite satisfied with was Tabular Forms. They can be a bit finicky to work with, and if you’re not...

View Article

Image may be NSFW.
Clik here to view.

Email made Easier

Sending emails from the Oracle database can be both simply deceptively braindead easy, and confoundingly perplexingly awful at the same time. Easy, because all you have to do is call one of the...

View Article
Browsing all 30 articles
Browse latest View live




Latest Images