SQL AND PL/SQL

Everything From how to write simple SQL and PL/SQL  statements to new features of the language, Creating functions, Stored procedures, complex queries, solutions to real world challenges and much more. In this Category I will post about the Language that has been around for a while and is still going strong Oracle SQL and it’s procedural extension PL/SQL

Nested with clauses oracle 26ai

Nesting With Clauses in Oracle database 26ai

BACKGROUND Consider this post from stackoverflow. As seen above, Nesting of with clauses is not possible in oracle and while the examples in the answer are simple and straightforward allowing you to define multiple different subqueries, sometimes (and I know because I’ve been there) you actually need to or at least wish you would nest

Nesting With Clauses in Oracle database 26ai Read More »

Conditional Filter For Aggregates In Oracle Database 26ai

BACKGROUND Consider this problem from LeetCode: leetcode_db_1158, about figuring out for each user, the number of orders they made in 2019. The code below can create the sample data set needed for the question. Here’s an Oracle SQL solution to this problem Notice the left join to a subquery highlighted above! This is done to

Conditional Filter For Aggregates In Oracle Database 26ai Read More »

Non-Positional Inserts in Oracle AI Database 26ai

Background Oracle AI Database 26ai provides new, easier and self documenting syntax for insert statements: Non-positional Inserts. This makes use of the INSERT INTO SET  and BY NAME clauses The SET clause works similarly to the existing set clause for update statements, and the by name clause makes it easier to insert the results of

Non-Positional Inserts in Oracle AI Database 26ai Read More »

Simpler Update and Delete logic with direct joins in Oracle 26ai

Background Historically, updating a table based on values from another table in oracle database required developers to rely on correlated subqueries and or merge statements or other workarounds. Oracle ai database 26ai allows tables to be joined directly using an update and/or a delete statement. The result is cleaner SQL, more intuitive data modification queries,

Simpler Update and Delete logic with direct joins in Oracle 26ai Read More »