SQLDaily
sqldaily.bsky.social
SQLDaily
@sqldaily.bsky.social
Daily Oracle SQL tips from the Oracle Developer Advocates for SQL
SQL Case Files

Learn #SQL while tackling detective investigations

Write queries to learn about suspects, uncover evidence, and close the cases

Play at buff.ly/ANG0hA4
December 12, 2025 at 12:04 PM
Schema annotations in Oracle AI Database enable you to add key-value metadata on

Tables
Views
Indexes
Domains

These help document your objects

@martindba.bsky.social shows how to add them to view columns with

ALTER VIEW ... MODIFY ( ANNOTATIONS ( ... ) )
Creating column-level annotations on views
While updating my slides covering “what’s new in Oracle AI Database 26ai” I noticed that examples how to annotate views are currently absent from the SQL Language Reference. While…
buff.ly
December 11, 2025 at 12:01 PM
Real-time SQL Plan Management in Oracle AI Database can

Detect plan changes in #SQL queries
Identify which of these plans is best
Ensure future runs use the best plan

Prashant Dixit shows it in action
How Oracle 23ai Fixes Bad Plans Instantly.. A Live Demo of Real-Time SPM
Recently, I did a quick round of testing in my lab with Oracle Database 23ai, focusing on its new SQL Plan Management (SPM) enhancements and the results were impressive. In 23ai, SPM can actually d…
buff.ly
December 10, 2025 at 12:02 PM
You can run code in the BEGIN/END block of a PL/SQL package

CREATE PACKAGE BODY ... AS
...
BEGIN
do_stuff();
END;

Take care: this only runs when initializing the package

@petefinnigan.bsky.social shows how security checks here can fail
Do Not Put Security Checks in an Oracle BEGIN END block
Pete Finnigan's Oracle security weblog
buff.ly
December 9, 2025 at 12:02 PM
Access attributes of JSON data stored in Oracle AI Database

Simple dot-notation - ...
JSON_VALUE ( column, '$..' )

Dot-notation returns NULL if it can't process the attribute,
JSON_VALUE gives full control over the behaviour

#SQL
December 8, 2025 at 12:01 PM
Aggregate functions in #SQL report totals across many rows

Common ones are

COUNT, SUM, AVG, MAX, MIN

Baraa Khatib Salkini explains how these work and how to use them to answer questions like

How many orders are there?
What's their total sales value?
SQL Aggregate Functions | COUNT, SUM, AVG, MAX, MIN | #SQL Course 21
Visually explained how SQL aggregate functions like COUNT, SUM, AVG, MAX, and MIN summarize data efficiently. 👉 Subscribe, Like, and Comment If you want more FREE Courses…
buff.ly
December 5, 2025 at 12:02 PM
AI agents can help you build schemas and create test data

@chrishoina.bsky.social shares an example prompt to store data about cars, trucks, motorcycles and their manufacturers

Then shows you how to use it with SQLcl MCP Server and Cline to make the tables
buff.ly
December 4, 2025 at 12:01 PM
Reposted by SQLDaily
The wait is (nearly) over!

Oracle AI Database 26ai EE for Linux x86-64 will be released on premises in the next RU (23.26.1), due January 2026

Read full details at blogs.oracle.com/database/ora...
December 3, 2025 at 4:02 PM
Reposted by SQLDaily
Finally … Oracle AI Database 26ai is going to be available on non-Oracle hardware

Many of you have read my blog post from October during Oracle AI World in Las Vegas about Oracle AI Database 26ai replacing Oracle Database 23ai. But the main question remained: When is it available on-prem on…
Finally … Oracle AI Database 26ai is going to be available on non-Oracle hardware
Many of you have read my blog post from October during Oracle AI World in Las Vegas about Oracle AI Database 26ai replacing Oracle Database 23ai. But the main question remained: When is it available on-prem on non-Oracle hardware? It's December now, and Christmas is coming soon, it is time for presents. Yes, finally ... Oracle AI Database 26ai is going to be available on non-Oracle hardware…
mikedietrichde.com
December 3, 2025 at 4:00 PM
Mouhamadou Diaw examines the differences between functions & procedures in PL/SQL

Functions

Return a value
Can be called in #SQL - DML must be in an autonomous transaction

Procedures

Use OUT parameters to return values
Can't be called in SQL directly
Overview Oracle Procedures vs Functions
When working with PL/SQL in Oracle, you will have to deal with procedures and/or functions. Unlike anonymous blocks, they are blocks stored inside the database (stored procedures). This is a common…
buff.ly
December 3, 2025 at 12:03 PM
Tracking changes to values over time is a common requirement

For example, recording price fluctuations for goods

Alexey Makhotkin steps through designing tables to store these changes, proposing template tables with

Anchor
Value
Valid from/to dates
Historized attributes: systematic table design
Author: Alexey Makhotkin [email protected]. (Word count: 3200). A common problem in business-oriented database design: keeping the history of values of a certain data attribute. For example, we may…
buff.ly
December 2, 2025 at 12:03 PM
Change the partitioning method for an Oracle table with:

ALTER TABLE ... MODIFY PARTITION BY ...

This can change

The partition method (RANGE/LIST/HASH)
The partition columns
Add/remove subpartitioning

Add the ONLINE clause to allow writes to continue while changing
December 1, 2025 at 12:02 PM
Like #SQL?

Like puzzles?

Try #SQuizL

A free, daily guess-the-SQL statement quiz

You have up to six attempts to complete the statement on the top left using the fragments below

There's a new statement to guess at every day at midnight UTC

Play now at buff.ly/Myg8265
November 28, 2025 at 12:00 PM
You can run in-database AI inference on Oracle Active Data Guard

@ludovico.bsky.social shows you how to do this to find images with semantic search

Loading an ONNX model & pictures
Creating PL/SQL to generate embeddings
Running this proc and searches on the standby
buff.ly
November 27, 2025 at 12:01 PM
When tuning #SQL, focus on the estimates for how many rows each operation will return

If these are off by an order of magnitude or more, there's a good chance a different plan is faster

@tanelpoder.com has built scripts to show misestimates in Oracle plans
xb.sql and xbi.sql - Explain Oracle Execution Plans Better! (Part 3 - Cardinality Misestimates) - Tanel Poder Consulting
Here’s part 3 of my xb.sql & xbi.sql article series that I started writing back in 2019 :-) Part 1 - Show and format execution plans by querying V$SQL_PLAN data directly Part 2 - Show plan line level…
buff.ly
November 26, 2025 at 12:01 PM
Oracle AI Database 23.26.0 developer features include

QUALIFY clause
GraphQL Table Function for SQL
SQL Objects and Collections in MLE JavaScript
PL/SQL RESETTABLE clause to avoid ORA-04068: existing state of packages has been discarded

@gvenzl.bsky.social
What’s new for Developers in Oracle AI Database 23.26.0
For more information on what’s new in Oracle Database 23.9, see: What’s new for Developers in Oracle Database 23.9 Oracle AI Database 23.26.0 brings some fantastic new features to developers—again!…
buff.ly
November 25, 2025 at 12:02 PM
Define schema-only accounts in Oracle AI Database with

CREATE USER ... NO AUTHENTICATION

=> you can't connect as this user

To run scripts as-if you're a schema-only account, use a proxy user

ALTER USER schema_only GRANT CONNECT THROUGH proxy

CONN proxy[schema_only]/<pwd>
November 24, 2025 at 12:01 PM
Want to find the Nth highest value in a table?

e.g. the 3rd highest salary/department?

Number the values with

DENSE_RANK () OVER ( PARTITION BY ... ORDER BY ... DESC )

Then filter where the output of this is 3

Manish Sharma demos
What's The BEST Way to Find the 3rd HIGHEST Salary in SQL?
Find nth highest salary interview questions are some of the trickiest SQL challenges you’ll face. In this video, I’ll show you how to solve the 3rd highest salary problem with NULL handling, a real…
buff.ly
November 21, 2025 at 12:03 PM
How do the data types of join columns affect query performance?

@danischnider.bsky.social compares using

Hashes as CHAR(32) and RAW(16)
Sequences as NUMBER

And finds in Oracle #SQL

NUMBER is faster than RAW
RAW is faster than CHAR
Data Types of Join Columns
The data type of primary key and foreign key columns has an impact on the query performance. This should be considered in the design decision of keys in a Data Vault schema.
buff.ly
November 20, 2025 at 12:01 PM
Triggered by traumatic DML errors?

@antikyte.bsky.social shows how to recover in Oracle AI Database when you accidentally remove data with

FLASHBACK TABLE ... TO
BEFORE DROP => restore a dropped table
TIMESTAMP => revert to a point in time
Fixing data faux pas with flashback table #JoelKallmanDay
Triggered by traumatic DML errors ? Well, here’s one flashback you won’t mind having…
buff.ly
November 19, 2025 at 12:02 PM
Triggers are a common way to audit DML changes

But writing these can be fiddly

To help you with this, @zorantica.bsky.social has built

Data JAM for Oracle (Journaling & Auditing Module)

An #orclAPEX app to automate audt tables and triggers

Get it at
GitHub - zorantica/data-jam: Zoran's Auditing Module
Zoran's Auditing Module. Contribute to zorantica/data-jam development by creating an account on GitHub.
buff.ly
November 18, 2025 at 12:02 PM
In PL/SQL

EXCEPTION WHEN OTHERS THEN

Catches all errors

Filling your code with this without reraising the error hides unexpected issues

So the compiler raises PLW-6009 to warn you

If you reraise in custom logging procedures use

PRAGMA SUPPRESSES_WARNING_6009

To skip this warning
November 17, 2025 at 12:02 PM
Get free access to Oracle AI Database at freesql.com

This browser-based tool enables you to run and share #SQL statements

Even better, you can now connect to your schema from clients on your machine using SQL*Net

So you can run SQL from your favourite IDE
November 14, 2025 at 12:01 PM
Oracle Virtual Private Database enables you to transparently add WHERE clauses to restrict what users can see

See what was added with DBMS_UTILITY.EXPAND_SQL_TEXT

But this may expose sensitive values!

@connormcd.bsky.social shows how to hide them with contexts
Security predicates exposed #JoelKallmanDay
Since way back in version 8.1 of the database, there has been a cool feature in Oracle called Virtual Private Database (VPD), which essentially lets you force predicates into SQL statements run by …
buff.ly
November 13, 2025 at 12:02 PM
Want to find the fastest-growing tables or LOBs in Oracle AI Database?

@viniciusdba.com.br has built a script that analyzes AWR data to show

The 20 segments with the largest total size increases
A breakdown of the increase per month for each

Get it at
dba_scripts/seggrowth.sql at master · vinidba/dba_scripts
Some Scripts that I use on my daily basis. Contribute to vinidba/dba_scripts development by creating an account on GitHub.
buff.ly
November 12, 2025 at 12:01 PM