PL/SQL provides three different types of collections to hold multiple items of data. They all come with different capabilities and limitations and since these are hard to remember, I provide a condensed showcase of the different collection types in one single code example.
Recursive CTEs (WITH-clause) is one addition to the SQL standard that makes the language incredibly powerful. Besides other things it can be used to generate data rows “from thin air” – for example a list of quarters by year.
SQL is your friend!
One of my favorite features of (Oracle-)SQL is how easy it is to turn relational data into other data formats like JSON or XML.
But what if you need to add a namespace to some of the nodes in your generated XML?
I struggled with that until I made a realization about the nature of the xlmns part in XML.
One of the probably most unnerving things in databases is dealing with NULLs, especially when comparing data. The necessary logic to deal with NULLs can lead to very verbose code – but if you’re using Oracle, there is a very neat function you can use.
SQLcl is a great tool, but it has its problems when it comes to environments other than English/US.
I show a couple of Problems and Strangenesses here and give examples how to work around them.
Sometimes we have data that is not split into columns and rows, but SQL can only really thrive on structured data.
But thanks to recursive queries we can split any string into rows – with pure SQL.