#UKOUG_Tech16: Ranges, Ranges Everywhere

I presented this topic on at Tech 16 on Monday afternoon. The latest version is on the Tech 16 website and on http://www.slideshare.net/StewAshton1/ranges-ranges-everywhere-oracle-sql Thanks to the organisers, staff, presenters and delegates who made this a great conference and a wonderful experience!

#UKOUG_Tech16: Advanced Row Pattern Matching

I presented this topic on Super Sunday. The latest version is now on the Tech16 site and on http://www.slideshare.net/StewAshton1/advanced-row-pattern-matching

Oracle LN Function with Examples

In this article, I’ll explain what the Oracle LN function is, and show you some examples. Purpose of the Oracle LN Function The purpose of the Oracle LN function is to calculate the natural logarithm of a number. if you’re not sure what the natural logarithm means, you can read more here. I’m not a […]

Oracle TAN Function with Examples

In this article, I’ll explain the Oracle TAN function, what it is, and show you some examples. Purpose of the Oracle TAN Function The purpose of the Oracle TAN function is to calculate the tangent of a number. The tangent is ratio of the length of the side opposite the angle to the length of the […]

Evaluating Cluster Dispersion in Oracle Data Mining

When working with the Clustering algorithms, and particularly k-Means, in the Oracle Data Miner tool there is no way of seeing how compact or dispersed the data is within a cluster.

There are a number of measures typically used in various tools and algorithms, but with Oracle Data Miner we are not presented with any of this information.

But if we flip from using the Oracle Data Miner tool to using SQL we can get (more...)

Oracle SIN Function with Examples

In this article, I’ll explain what the Oracle SIN function is and show you some examples. Purpose of the Oracle SIN Function The purpose of the SIN function is to calculate the sine of a number. The sine is the ratio of the length of the side of the triangle opposite the angle to the […]

Oracle COS Function with Examples

In this article, we look at the Oracle COS function and see some examples. Purpose of the Oracle COS Function The COS function will return the cosine of a number. If your knowledge of cosine is a bit rusty (like mine), then you might find this definition helpful.   Syntax The syntax of the COS […]

SQL Developer: Quick Outline with SQL statements

Most of you probably know the "Quick Outline" function you have inside the SQL Developer.
It helps you to easily jump between different functions/procedures inside a package.

My colleague Holger told me about a bug in SQL Developer 3.x where you could use the "Outline" view with normal SQL files, too. Unfortunately in version 4 it didn't work anymore. So he stayed with version 3 for a long while. Otherwise he would had to (more...)

Answer with SQL: How many weekdays a year?

I'm a big fan of generating data with dual, using a perk of the connect by syntax.

I think Tom Kyte was the originator of this technique. It's not necessarily the fastest method, but it's super convenient - no table required.

Today I wanted to know how many weekdays a year, so I defined 365 rows on the fly using sysdate to turn these into each day of the year. Then I ran a simple (more...)

Tablespaces verkleinern (TEMP, USER_TS, ORA-03297)

Die Select-Statements in diesem Blogpost habe ich von anderen Webseiten kopiert. Daher ist dieser Beitrag eher als Zusammenfassung unterschiedlicher Lösungsversuche zu sehen und dient mir als schnelle Hilfe bei der Verkleinerung eines zu großen Tablespaces. Schaut euch die Quellen an, die sehr viel detaillierter auf die jeweiligen Probleme eingehen.

Wer kennt nicht die Situation? Der DBA ruft an und meint der TEMP Tablespace verbraucht mehrere hundert Gigabyte an Speicher.

Was ist in solch einer (more...)

Friday Philosophy – Your Experience can Keep You Ignorant

This week I was in an excellent presentation by Kerry Osborne about Outlines, SQL profiles, SQL patches and SQL Baselines. I’ve used three of those features in anger but when I looked at SQL Patches I just could not understand why you would use them – they looked to me like a very limited version of SQL Profiles.

There is a prize for spotting Kerry without a baseball cap

There is a prize for spotting Kerry without a baseball cap

So I asked Kerry about it (more...)

#DOAG2016: Ranges, Ranges Everywhere!

Today I did my second presentation at DOAG2016. It was at 9:00 so I got to sleep in ;) The room was huge but there were enough people that I didn’t feel too lonely. The room and the technical help were top notch, and again there were questions at just the right time to remind me […]

#DOAG2016: Advanced Row Pattern Matching

DOAG2016 started today at 8:30, and I did too. There were so many great presentations at the same time as mine, I was surprised and pleased to get a nice audience.

Using the Identity column for Oracle Data Miner

If you are a user of the Oracle Data Miner tool (the workflow data mining tool that is part of SQL Developer), then you will have noticed that for many of the algorithms you can specify a Case Id attribute along with, say, the target attribute.


The idea is that you have one attribute that is a unique identifier for each case record. This may or may not be the case in your data model (more...)

A handful of articles

A little while ago a member of the Danish Oracle User Group DOUG asked if anyone had a bit of experience with use of R together with Oracle Database. I remembered an article I wrote for OTech Magazine on forecasting with R and Oracle and thought it would be a good primer for him. OTech Magazine is no longer active, sadly, but I thought I could send him a link anyway to my article. That (more...)

Distinguish Real SQL Execution Plans from Fake Ones!

Distinguish Real Execution Plans from Fake Ones!

As an Oracle DBA, one of our daily tasks is to optimize bad SQL statements that are affecting the system and causing performance degradation. First we identify the culprit SQL, then we extract the execution plan, after that, we start the cycle of SQL tuning and optimization as appropriate.


There are many methods to extract the execution plan for a specific SQL statement, however, not all these (more...)

I’m speaking at #DOAG2016 and #ukoug_tech16

This year I get to speak about advanced SQL twice at two different conferences. My first presentation is about row pattern matching with MATCH_RECOGNIZE and my second deals with ranges - including but not limited to Temporal Validity ranges.

How can we use Oracle to deduplicate our data

Dear Patrick,

We have gone through a merger at our company where we are trying to merge the databases. The problem now is that we have duplicate records in our tables. We can of course go through all the records by hand and check if they exist twice. Another option is to build an application to do this. But using the Oracle Database there must be a better way to do this. Any ideas?

Ramesh (more...)

OTN Appreciation Day: Analytic Functions

This is my contribution to the OTN Appreciation Day, which was initiated by Tim Hall.

One of my favorite features of the Oracle Database are Analytic Functions. They were introduced with Oracle Database 8.1.6 Enterprise Edition, and have been in the Standard Edition since version 9.

With analytic functions you can add inter-row calculations, aggegrate over multiple dimensions, rank assignments based on values. All this without a GROUP BY clause.
The syntax might (more...)

Restriction when column default is sequence.nextval

Oracle 12c introduced the ability to specify sequence.nextval as the default on a column, which is really nice – including the fact that it eliminates one of your excuses why you don’t decommission those old triggers.

Unfortunately it doesn’t work as you might expect if you use an INSERT ALL statement; it evaluates the default expression once per statement, instead of once per row.

Test case:

create sequence test_seq;

create table test_tab
( id number default  (more...)