10 Cool things about the COMPARE_SYNC package

@thatjeffsmith recently recommended an article about making your blog more popular. The article said "lists of 10 things" were great ways to get more readers. Hey, if that's all it takes... STEW_COMPARE_SYNC is a package that generates SQL to compare data or synchronize tables. Here are 10 good reasons to use it.

2014 Annual SQL Championship

Steven Feuerstein runs a great site at PL/SQL Challenge that is just another way for developers to stay up to date with their knowledge of PL/SQL, SQL and database design with a bit of fun.

PL/SQL championships are held quarterly, but the less frequent SQL and Database Design quizzes are currently held annually. Thanks to persistence and maybe a bit of experience, I was eligible to compete in both.

Unfortunately do to a timing issue, (more...)

Twitter as a work tool

Scott Spendolini conducted a little experiment last week, then Jeff Smith & Kellyn Pot'Vin whipped up a little slideshow on the topic.

I thought I'd chime in after some recent experiences were helped along by the use of Twitter, a tool it seems many are underutilising.


Exhibit A

I had an afternoon of generating JSON with SQL using LISTAGG and I kept facing this issue of being limited by 4000 characters. Knowing I occasionally (more...)

NVARCHAR2, UTL-16 and Emails

Development is often the case of trying several paths through the forest, hoping to find one that leads out the other end. That was the start of my week.

Until we get our shiny new 12c database running on its shiny new box (and all the data shifted to it), we are living with a mix of databases. To begin with, the data we managed was mostly AU/NZ and Europeans stuff, and the character set (more...)

Calculate Age in Javascript

I had a registration form in Apex which asks the applicant to enter their Date of Birth in a date item; I then needed to calculate how old they would be at the start of the event, which determines a number of rules, such as whether we need to obtain their parent’s permission.

In my first release I implemented this with a Dynamic Action which ran SQL something like this:

select round(months_between(start_date
             / 12,1)
from  (more...)

Row Pieces in Tabellen mit mehr als 255 Spalten

Jonathan Lewis listet einige der Gründe, die gegen die Verwendung von Tabellen mit mehr als 255 Spalten sprechen - bekanntlich führt diese Spaltenanzahl zur Aufteilung einer row in mehrere row pieces, und damit zu inter- oder intra-row-chaining und sonstigem Ärger. Zu den unerfreulichen Effekten gehören:
  • in 10g führt die Statistikerfassung bereits bei weniger als 255 Spalten - nämlich bei etwa 165 Spalten - dazu, dass mehrere FTS erforderlich werden, um die Daten einzulesen.
  • das (more...)

SQL Server XQuery

I promised my students an example of writing xquery statements in Microsoft SQL Server. This post builds on two earlier posts. The first qualifies how to build a marvel table with source data, and the second qualifies how you can create an XML Schema Collection and insert relational data into an XML structure.

You can query a sequence with xquery as follows:

DECLARE @x xml;
SET @x = N'';
SELECT @x.query( (more...)

Insert into XML Column

Working through Chapter 7 of the Querying Microsoft SQL Server 2012 book for Microsoft’s Exam 70-461, I found the XML examples incomplete for my students. I decided to put together a post on how to create:

  • An XML Schema Collection type.
  • A table that uses an XML Schema Collection as a column’s data type.
  • An example on how you can transfer the contents of a table into the XML Schema Collection.

This post assumes you (more...)

“In-Memory” Postgres?

Vor einigen Tagen hat sich Josh Berkus mit der kontroversen Aussage "In-memory" is not a feature, it's a bug zu Wort gemeldet. Darin definiert er In-Memory Datenbanken als solche, denen die Möglichkeit fehlt, Daten auf die Festplatte zu schreiben, was folglich ihre Wiederherstellbarkeit einschränkt: "So an 'in-memory' database is a database with a major limitation." Das klingt erst mal polemisch und ist sicher auch so gemeint; möglicherweise trifft es auch nicht ganz die Grundidee (more...)

Oracle Legacy to Mobile Winter Roadshow (If I’m not snowed in by then)!

I have to kick off this post with a huge apoIMG_4807logy to my dedicated readers for not posting recently. As I am sure you are all aware, the Northeast has been experiencing some crazy snow storms, and Boston has turned completely white. The almost constant snowfall has made my life incredibly hectic because school keeps getting canceled and chasing my 3 little ones (under the age of 6) it makes it hard to stay on top (more...)

dramatic differences of in memory scanning performance on range queries

Given following two identical tables, on which run the same SQL,  replicated in memory with oracle in-memory option - one table created out of the other.
each tables covers 24m rows.
Same structure ...


Prior to, DBMS_STATS.PURGE_STATS does a slow delete of stats before the parameterised input timestamp.

Why might you be purging? Here’s one such illustration:


This delete can be slow if these tables are large and there are a number of reasons why they might be so, notably if MMON cannot complete the purge within its permitted timeframe.

But note that if you’re happy to purge all history, there (more...)

APEX Best Practices Survey

Hi All,

I was inspired by Peter Raganitsch to use the Survey Builder packaged application to create a survey that will help with my "Evidence Based APEX" presentation.

I would appreciate 5-10 minutes of your time if you could fill out my survey:

How-to Geek

You'll find a small set of questions over five major topics.

  1. Instrumentation (debugging)
  2. Performance
  3. Security
  4. PL/SQL
  5. JavaScript
In time I'll discuss the results, I look forward to reading your responses.


SQL Brainteasers: Guess the Superhero

Here’s another six SQL brainteasers. This time the SQL is a clue to the power(s) of a superhero. Who is each superhero?

insert into body (skeleton)
values ('adamantium');

update person
set    strength = 'superhuman'
where  emotion = 'anger';

delete from powers
where  location = 'near Kryptonite';

update body
set    exoskeleton = 'ferrous material';

select *
from   women
where  equipment = 'noosed rope of veracity';

  insert into boy  (more...)

Functions bar NDS

My students asked if you could embed an OFFSET x ROWS FETCH NEXT y ROWS ONLY clause in a SQL Server T-SQL user-defined function. The answer is no, it isn’t Oracle (yes, you can do that in Oracle Database 12c with an NDS statement). There’s an example in Chapter 2 of my Oracle Database 12c PL/SQL Programming book if you’re interested. I also demonstrate a different approach to SQL Server T-SQL table functions in (more...)

Neue Features für Parallel Execution in 12c

Parallele Ausführungspläne lassen mich in der Regel sehr vorsichtig werden, weil ich dabei gerne entscheidende Details übersehe - aber damit bin ich vermutlich kein Einzelfall. "It’s easy to make mistakes, or overlook defects, when constructing parallel queries", schreibt Jonathan Lewis in seinem jüngsten Artikel Parallel Rownum, in dem er einen Fall vorstellt, in dem ein parallelisiertes Select - mit ergänzter Rownum-Spalte - auf eine Tabelle sowie ein im Rahmen der gleichen Query mit einem (more...)

Lets catch up at OTNYathra 2015

All, Its time to be at AIOUG stage once again and the event would be the OTNYathra 2015. The event has been a great success in the past and has been able to generate/receive wide recognition and appreciation. OTNYathra focuses to evangelize the Oracle technologies to a broader and passionate audience. OTNYathra is a grand tour which is conducted … Continue reading

Using Edition-Based Redefinition to Bypass Those Pesky Triggers

There’s a problem most people who’ve had to do production datafixes have encountered at some point: you need to update a dataset. Unfortunately there’s a trigger on the target table. The trigger either prevents the update outright or just has some unwanted side effects (firing off a business process, etc.). The trigger is necessary for the application to function correctly, so you can’t just drop it.

How do you apply the changes?

You can (more...)

Material zu XPLAN_ASH

Randolf Geist hat vor kurzem eine neue Version (4.21) seines nützlichen XPLAN_ASH Tools veröffentlicht und dazu noch erläuterndes Material - insbesondere Video-Tutorials - geliefert:

The 12 Steps to Faster Data Warehouse Success

Announcement! I have exciting news! With the help of my good friend Dan Linstedt (of LearnDataVault.com fame), we have just launched my first online training video based on my very popular white paper and talk: Agile Methods and Data Warehousing: How to Deliver Faster. Most of you will agree that data warehousing and business intelligence […]