view counter

PL/SQL Feed

Oracle PL/SQL (Procedural Language/Structured Query Language) resources, news, and support articles.

A Letter from "Oyster Shel"

My father, Sheldon Feuerstein, was a large presence in our lives and the lives of many others. He was a big man, physically (and, sadly, overweight for too many of his later years, which contributed to the diseases that led to his death in 2010), but it was more than that. He was smart and honest and eloquent. He could also be very stern and, before he passed middle age, manifested quite the temper. But he was a deeply compassionate man, especially for members of the family. Many nieces, nephews and cousins remember him with a love and deep fondness that sometimes surprises me.

SQL Venn Diagrams

select *
from
people
where understanding_of_venn_diagrams = 'Y'
intersect
select *
from
people
where understanding_of_sql = 'Y';

DESCRIPTION
-------------------------
People who understand this is
a Venn diagram in disguise

select posts from sqlfail

Cleanup a MySQL Schema

My students required way to remove all their tables, views, and constraints from a MySQL database (or the alias schema). Since they’re using referential or foreign key constraints, I also wrote one procedure to drop all foreign key constraints from a database. There’s also another to drop views. The final stored procedure calls the procedure that drops foreign keys, then calls the procedure to drop views before dropping all the tables.

Here’s the dropForeignKeys stored procedure:

Mac Mini to the rescue

In teaching, I had a problem because my students have different base operating systems, like Windows 7, Windows 8, Linux, and Mac OS X. I needed a teaching and lecture platform that would let me teach it all (not to mention support their environments).

When dealing with OTHERS, ensure you RAISE it

begin
raise
my_database_is_on_fire;
exception
when others then

dbms_output.put('Just ignore it...');
dbms_output.put('...it'll go out soon!');
end;
/
This is a re-hash of my very first post. I wouldn’t normally repeat myself, but I’ve just been horribly burned by some code with “when others then null” blocks.

Oracle 12c PL/SQL Published

Oracle Database 12c PL./SQL ProgrammingAfter writing nine books, it’s always great when the author copies arrive. That’s when I know the process is complete.

Oracle 12c PL/SQL

While you try to eliminate all errors when you write a book, some exceptions remain and some new opportunities present themselves. I think we did a great job on this book and the errors are minimal, but readers bring new insights and rereading what you’ve written brings fresh ideas. This errata includes corrections of mistakes, suggestions for change, and improvements to the base text. If the book is successful, I’m sure they’ll make it into the next edition.

SQL Quiz: How does this table disappear?

An SQL magic trick – the table disappeared, just by running a select statement! Can you figure out how it’s done?
select *
from
the_disappearing_table_trick
/

NOW_YOU_SEE_ME
--------------
Now you don't

--....

select *
from
the_disappearing_table_trick
/

ORA-00942: table or view does not exist
If you think you know, put your answers in the comments!

Favorite stories: how programmers benefited from my book(s)

I received this very pleasant note today from a PL/SQL developer:

Finding All the Red M&Ms: A Story of Indexes and Full-Table Scans

In the database design quiz on the PL/SQL Challenge, a player made a comment referring to a 5% rule for indexes – i.e. that an index will (only) be used when accessing 5% or less of the rows in a table. This is something I’ve heard others refer to as well, so I thought I’d put together a post explaining how indexes work via the medium of chocolate!

view counter