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

Bad table design reflected using Severely damaged urban buildings after a landslide in Mocoa, Colombia, showcasing destruction

Bad vs Good Table design

Introduction As a DBA, data modeling is part of the job; working with developers, reviewing table design, implementing proper constraints and much more. In an earlier post about performance tuning, I talk about some practical steps that can be taken to fix performance problems. However, sometimes those problems could be “self-inflicted” and I ended that

Bad vs Good Table design Read More »

book, calendar, paper, calendar, calendar, calendar, calendar, calendar

Calendar Functions and Date Dims in Oracle Database 26ai

Introduction Calendar functions, introduced in 23.26.1, provide us with the ability to format dates into standard year/quarter/month/week/day text for these calendars: Each formatted calendar function returns a VARCHAR2 value representing the input date at a particular level of the calendar hierarchy. In this post, I will discuss the Calendar type functions and how to use

Calendar Functions and Date Dims in Oracle Database 26ai Read More »

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 »