SQL

APEX, SQL

Troubleshooting conversion errors

TweetShareSharePin0 SharesMy friend and Oracle maestro Daniel Ekberg wrote a post about ways to manage errors when converting data. Go read his post if you want to see how the errors you get can be better managed. I think he may be the person that first pointed out the feature to me that I want to show my use of. One common way to get data into APEX is to load a spreadsheet into a table. But often you get […]

SQL, Database, Oracle DB 23ai

23ai Syntactic sugar – IF [NOT] EXIST

TweetShareSharePin0 SharesIn the last post I talked about a form of syntactic sugar I’m not convinced we really needed. This post on the other hand is about one that I think I’ve needed since the first time I logged on to a SQL-based database. When you put together a test case it is often setup to create misc objects and populate them. The first time you run it it works fine but when you rerun it your create commands fail […]

SQL, Docker, Database, Property Graph

Your very first graph in Oracle Graph Server

TweetShareSharePin0 SharesHaving installed the Graph Server in the last post, lets set up and create your very first graph. This follows Oracles documentation. It however had different ways to do it and I struggled to figure out which would be the easiest. Having abandoned a couple for different reasons this is how I did it and I think it is pretty straight forward and uses the tool interactively as much as possible. We first need a user we’ll use to […]

PL/SQL, SQL, Machine Learning

Looking for AI? You already have it!

TweetShareSharePin0 SharesThese days I meet many people who talk about how they have a project to find an AI-plattform to use on-premises. Using it in the cloud on Autonomous it is pretty obvious that you use one in a handful of AI-services Oracle has at your disposal there. The question is what you should use to build AI-services on the data in your on-prem Oracle database. You don’t need to get anything. This blog post assumes you have an Oracle […]

SQL, Database, Oracle Cloud

Ignoring errors on “alter session set”

TweetShareSharePin0 SharesThis tip is especially useful when migrating to autonomous. The reason is that to enable the magic of the the autonomous database there are things that cannot be done. One such thing is that there are a lot of session settings you cannot use. To see what APIs you can no longer use you can look at the documentation. If you look at alter session there are a number of “alter session set …” that are available. But many […]

Oracle, PL/SQL, SQL

Using package variables in SQL

TweetShareSharePin0 SharesI often want to use the constants defined in packages also in my SQL. It has in the past never worked and it for the most part still does not. If I have a a package like this to simplify my code for what department it is I’m looking at. This now allows using dept_info.c_accounting in PL/SQL instead of just hardcoding 10 and having to remember what department 10 is. This is how we usually use PL/SQL and especially […]

Database, DBA, Performance, SQL

Add hint to SQL you cannot modify

TweetShareSharePin0 SharesThe last post showed how to lock the plan for a SQL that switched plan every now and then. Another common issue one can encounter is that of a SQL that uses a suboptimal plan and for which you’d want it to use a different plan. The way to instruct the optimiser to use a different plan is to use a hint to cause it to change how it accesses the table. But often the SQL is in application […]

DBA, Performance, SQL

Lock the plan for a SQL

TweetShareSharePin0 SharesA SQL that sometimes just uses a plan you prefer it to not use is fairly common. There are always reasons for unstable plans, but more important than knowing the reason is often to make it stick to a certain plan. This has historically been done with a lots of ways from changing the SQL, adding hints, adding incorrect stats to influence the optimizer, using any of the techniques that came before SQL Plan Management (SPM). All of these […]

SQL

Set operators – Union, intersect and minus

TweetShareSharePin0 SharesYou’ve probably combined two queries with “union”, but have you looked at the different options for how to combine queries? The set operators are more combining result sets than they are combining queries even if we often think about it is combined queries. Thy need to return the same number of columns of the same datatypes. The lengths of the columns can differ but not the datatypes. Let’s start with a couple of tables and data so you have […]

Database, SQL

Longs in SQL

TweetShareSharePin0 SharesUsing long datatype is a problem we seldom face with new applications. But some old may still have it if they have not managed to convert to somethings easier to work with. But where I most often encounter it is in Oracles tables. The place that by far most often pops up its ugly head is high_value in *_tab_partitions. Just the other day a colleague was stuck on how to grab a portion of its content in SQL. “You […]