Close

LDAP – TNS service name package v2.3

I’ve released version 2.3 of my service name maintenance package for LDAP servers implementing the OID schema. I’ve exposed the get_entry function both as a stand alone function the opens, reads, and closes a connection to the ldap server, and as an API accepting an already established connection and using it. Along with the function…

How to put an “IF” inside SQL

Developers coming from a procedural coding background are familiar with traditional IF-THEN-ELSE constructs, possibly extended to SWITCH or CASE blocks that group a series of conditions. Depending on the language, those could either evalute the conditions until the first TRUE is found or until the first result breaks out. They might also be comfortable with…

The 8-Queens Puzzle in PL/SQL

Several months ago I used the classic 8-Queens chess puzzle as an illustration of using a little bit of math to determine intractable problems. In that article I teased a code solution for the puzzle but never followed up… until now. There are 92 distinct solutions, including rotations and reflection duplicates. The package’s demo procedure…

Connection Basics

Before you can dig into your data with SQL and PL/SQL you must first get connected to your database. While there are many architectures, tools, and drivers for connecting such as JDBC, ODBC, ROracle, node-oracledb, Oracle Provider for OLE DB, OCI, cx_Oracle, etc. They essentially all boil down to just two methods: either the Oracle…

Data type quirks in Oracle

In my previous article I stressed the importance of using correct data types. However in some cases you may be forced to choose one type when you really need to use two or more. Also, in some cases, you may think you’re using consistent data types but Oracle will insist on changing them anyway, using…

Using Correct Data Types

One of the fundamental aspects of many programming languages is the notion of data types. SQL and PL/SQL are no exception. This article is not an argument one way or the other on whether strongly-typed languages are superior to weakly-typed, or untyped languages. The argument is moot. If you’re working with an Oracle database, you…

Oracle and the Ends of Time

Contemplating the beginning and ending of time can be a complicated exercise in the mathematics of cosmology. Within the realms of an Oracle database though it’s much easier to get our heads around. By definition within Oracle, the beginning of time is -4712-01-01 00:00:00.The end of time is 9999-12-31 23:59:59.999999999. Thus all of time, past…

CQ Notification deregistration with java

The Oracle Change Notification or Continuous Query Notification functionality is a useful means of triggering events in remote sessions when a transaction commits. Sometimes though a client may set up a registration and then disappear leaving orphaned registrations. Using the DBMS_CHANGE_NOTIFICATION package (documented by it’s synonym DBMS_CQ_NOTIFICATION) these old entries can be removed easily with…

Licensing changes for Spatial and Advanced Analytics/Machine Learning

Today, Oracle announced both the “Oracle Spatial and Graph” as well as the “Oracle Machine Learning” (formerly Advanced Analytics) database options are now included at no additional cost for on-premises installations of Enterprise Edition and Enterprise Edition on Engineered Systems. These options provide a wealth of functionality that were formerly extra cost options. You can…

Password paper update

I added an appendix for special user accounts that don’t follow the normal password rules to my paper describing the password hashing and storage. Some users have no hash at all but are instead stored with fixed values. ANONYMOUS – SYS.USER$.PASSWORD has a value of exactly 16 spaces.  The SPARE4 column is NULL.  Since the…

Dynamic SQL Templates

Frequently, when dynamic sql is used it takes a form similar to this: v_sql := ‘select ‘ || CASE WHEN choice1 IN (‘A’, ‘B’) THEN ‘col1, col2’ WHEN choice = ‘C’ THEN ‘col2,col3’ ELSE ‘col4,col5’ END || ‘ from ‘ || CASE WHEN choice2 IN (‘X’, ‘Y’, ‘Z’) THEN ‘table1’ ELSE ‘table2’ END || ‘…

Bug in JSON_OBJECT with FORMAT JSON

Normally, when syntax is listed as “optional” there should be no functional difference between the inclusion or omission of that syntax. However, with the JSON_OBJECT function, the optional “FORMAT JSON” clause not only changes functionality if you include it, it actually causes the resulting json output to be invalid! This easily verified with a simple…

Extracting APEX Access Control Users

From the APEX Developer’s Guide: When you export an application with the Access Control feature, the application roles, Administrator, Contributor, and Reader, are exported.  However, the users assigned to these roles are not exported. [spelling correction “your”-“you” mine] If the export option won’t put the users into a script for deployment, the obvious question then…

DDL dump of multiple schemas

A few weeks ago I received a question about how to generate DDL for all the tables, procedures, functions, and packages of a set of schemas. Furthermore, the asker wanted each object’s script to be in a distinct file within a directory hierarchy. Specifically, given a base directory, each schema should have its own subdirectory…

Goodbye to another great Collaborate.

Thank you to all that attended my presentations this year both live or in the virtual conference. As promised here are the links to my slides. https://www.dropbox.com/s/d7kjh5rp70ucul0/2019_352_Stuber_ppt.pptx?dl=0 https://www.dropbox.com/s/lqqhb6m8b3vrv0p/2019_354_Stuber_ppt.pptx?dl=0 For session 354, I mentioned expanded versions of some of the dictionary queries. Those maybe found at the following links… https://seanstuber.com/2018/03/08/who-is-using-temp-and-what-are-they-doing/ https://seanstuber.com/2018/03/04/who-is-blocking-whom-and-what-are-they-doing/ Thank you again to all…

Using collections to create variable parameter functions.

If you’re familiar with java, c, c# (or, I’m sure other languages as well) then you’ve probably encountered functions that allow a variable number of input parameters without requiring a fixed set of overloading. Java int my_variable_function(String str, int …intlist) c int my_variable_function(char *str, …) c# int my_variable_function(string str, params int[] intlist) PL/SQL does not…