Use the database to do the heavy lifting

Suppose you have data in your PL/SQL program stored in a collection. I am using the EMP table (14 records) but you should imagine you have many, many more records in your collection. If you want to order (sort) your collection in a different manner somewhere in your code you can of course write your own sorting routine but the Oracle database is doing this for ages and probably a lot smarter (after all these (more...)

Subtleties – Part 3 (more workarounds for COLLECT DISTINCT in PL/SQL)

In Part 1 we saw that the SQL function COLLECT with the DISTINCT option is not natively supported in PL/SQL, and saw two workarounds – using dynamic SQL and using the SET function.
In Part 2 we saw that the SET function can operate on Nested Table but not on Varray.
In this post we’ll see two more workarounds.

Inline View

We can first remove the duplicates in an inline view, and then use the (more...)

Oracle CURRENT_DATE Function with Examples

The Oracle CURRENT_DATE function is another Oracle function for returning a date from the system. Find out what it does and how it’s different from the other functions in this article. Purpose of the Oracle CURRENT_DATE Function The CURRENT_DATE function is used to return the current date in the session timezone. The session timezone is […]

Checkbox Item check / uncheck all

If you have an ordinary checkbox item based on a list of values, here is a function which will set all the values to checked or unchecked:

function checkboxSetAll (item,checked) {
  $("#"+item+" input[type=checkbox]").attr('checked',checked);
  $("#"+item).trigger("change");
}

For example:

checkboxSetAll("P1_ITEM", true); //select all
checkboxSetAll("P1_ITEM", false); //select none

It works this way because a checkbox item based on a LOV is generated as a set of checkbox input items within a fieldset.

Note: If it’s a (more...)

Kakuro Helper using SQL Query with the PowerMultiSet Function

When solving Kakuro it is essential to know for a given integer X and a given number of elements N all the combinations of N non-repeating digits [1-9] that their sum equals to X.

For example, there is only one combination for creating the number 7 from 3 elements:

1+2+4

And there are 6 combinations for creating the number 15 from 4 elements:

1+2+3+9
1+2+4+8
1+2+5+7
1+3+4+7
1+3+5+6
2+3+4+6

Let’s generate a list of all (more...)

Oracle USERENV Function with Examples

The Oracle USERENV function allows you to get information about the current session. Learn how to use the USERENV function in this article. Purpose of the Oracle USERENV Function The purpose of the USERENV function is to get information about your current session. It’s a simple function but can take a few different values for […]

Synchronous Dynamic Actions in APEX 5.1

If you've ever used a PL/SQL dynamic action with the default 'wait for result', you would have seen the following warning if you have the browser console open.

Text for bots: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience.

Consider this scenario of dynamic actions on change of P42_ITEM:

Synchronous vs Asynchronous server calls
First JavaScript takes value of P42_ITEM, concatenates a letter and places (more...)

Merge Operationen und überflüssige Spalten.

Vor ein paar Jahren hatte ich hier einen Artikel von Alexander Anokhin verlinkt, in dem erläutert wurde, dass die in der USING clause eines Merge verwendeten Spalten selbst dann in die workarea aufgenommen werden müssen, wenn sie weder im ON noch in der UPDATE-Spaltenliste erscheinen - obwohl es eigentlich durch eine semantische Analyse möglich sein sollte zu bestimmen, dass man diese Spalten gefahrlos ausklammern könnte. Jetzt hat Jonathan Lewis auf einen naheliegenden anderen Aspekt dieses (more...)

What Are Oracle SQL Analytic Functions?

In this article, I explain what Oracle SQL analytic functions are, how they are different from other functions, and show you some examples. What Are Oracle SQL Analytic Functions? Analytic functions are functions that calculate an aggregate value based on a group of rows. A recent article I wrote on SQL aggregate functions mention that […]

SQL Server Wait Typen und Latch Klassen

Zwei großartige Hilfsmittel hat Paul Randal vor wenigen Wochen in seinem Blog bekannt gemacht:

  • SQL Server Wait Types Library: eine Liste mit den seit Version 2005 im SQL Server vorkommenden Wait Typen und Erklärungen zu ihrer Bedeutung, ihrer Verfügbarkeit, ihrer Beziehung zu des Extendes Events, sowie Informationen zum Troubleshooting.
  • SQL Server Latch Classes Library: mit entsprechenden Informationen zu den Latch Klassen.
Diese Links könnten mir allerlei Suchoperationen in Books Online ersparen.

Misconceptions about (Regular) Views Revealed when Presenting Editioning Views

Sometimes when you present an advanced feature, questions from the audience reveal misconceptions about basic features.

It happens to me almost every time I talk about Edition-Based Redefinition. I present Editioning Views, and then I get questions that reveal misunderstandings about views in general.

One such misunderstanding is regarding what is kept in the view definition.

When we create a view as “select * from table”, the * is expanded to actual (more...)

It WAS the #Best #DataVault Event Ever!

Last week I had the pleasure of spending a few days in lovely Stowe, Vermont at the Stoweflake Mountain Resort and Spa attending the 3rd Annual World Wide Data Vault Consortium (#WWDVC). Not only was the location picturesque, the weather was near perfect, the beer was tasty, and the learning and networking were outstanding. We had 75 […]

APEX Survey Results: Which browser for development?

Next question in my 2015 survey, how many different ways can we all type "chrome"?

Q4: Which browser do you use for development?




The first free text question, with a long variety of unique results. I haven't analysed the complete list to get a truer result, but the pattern is clear. 3 of the top 5 are Chrome. APEX developers build in Chrome, the application builder is recommended for Chrome, especially during early adopter (more...)

Snowflake DB Cool Features – Automatic Query Optimization

Learn how Snowflake automatically optimizes SQL queries. It is all handled “auto-magically” via a dynamic optimization engine in our cloud services layer.

Datentypauswahl für Datumsangaben und ihre Wirkung auf den CBO

In Cost Based Oracle hat Jonathan Lewis dieses Thema bereits umfassend erläutert: Datumswerte sollten mit dem Datentyp DATE gespeichert werden, da der Optimizer nur für diesen Datentyp das Wissen besitzt, dass es zwischen den Monats- und Jahreswechseln keine großen Lücken gibt - dass also auf to_date('31.12.2016', 'dd.mm.yyyy') als nächster Tag to_date('01.01.2017', 'dd.mm.yyyy') folgt; und nicht 20161232 nach 20161231. Insofern enthält die aktuelle Artikelserie von Richard Foote zum (more...)

Can’t Display 256 Colors

If you’re reading this post, you most likely are trying to run the Oracle Database 11g or 12c runInstaller program, and it’s failing a critical dependency check and displaying an error like the one below. If so, choose n because if you choose y it won’t launch the Oracle Installer.

Starting Oracle Universal Installer...
 
Checking Temp space: must be greater than 500 MB.   Actual 30824 MB    Passed
Checking swap space: must be greater than  (more...)

Oracle 12c Pre-requisites

Installing any Oracle database is tedious, but the installing the pre-requisites can be tedious. This post tries to simplify the process by creating a single prereq.sh file for all the pre-requisite libraries. The file should contain the following:

yum install -y binutils \
               compat-libstdc++-33 \
               compat-libstdc++-33.i686 \
               gcc \
               gcc-c++ \
               glibc \
               glibc.i686 \
               glibc-devel \
               glibc-devel.i686 \
               ksh \
               libgcc \
               libgcc.i686 \
               libstdc++ \
               libstdc++. (more...)

Top N- queries: using the 12c syntax.

One of the new features with Oracle database 12c is the new syntax for Top N queries and pagination. Did we really need this? Should you choose for the new syntax over the way we used to do it, with an inline view? I think so, it simply adds syntactic clarity to the query, and in this blogpost I will show the difference between the "old" and the "new".

For the examples I will use (more...)

Linux User-Group Console

This post shows you how to add the menu option and GUI to set users and groups. It’s quite a bit easier than mastering all the command-line syntax. It makes setting up the required user and group accounts for an Oracle Enterprise or MySQL database solution much easier.

You add the utility by calling the yum (Yellowdog Updater, Modified) utility like this:

yum installed -y system-config_users

You should see the following:

Loaded plugins: langpacks
Usage:  (more...)

CBO Transformationen für count distinct Operationen

Anfang 2014 hatte ich hier einen Artikel angesprochen, der im High-Performance Blog von Persicope erschienen war und versprach, postgres Queries mit einer count distinct Operation um den Faktor 50 zu beschleunigen. Ich hatte damals selbst ein paar Tests mit Oracle durchgeführt, die zeigten, dass die Umformulierung auch dort nützlich ist, aber weitaus weniger dramatische Effekte hervorruft als bei postgres (was kurz darauf in einem weiteren Artikel bei Periscope ebenfalls angemerkt wurde. Außerdem hatte ich einen (more...)