Thumbnail image for Drop and Recreate All Foreign Keys on Oracle Table

Drop and Recreate All Foreign Keys on Oracle Table

You might need to reistate a dropped table in Oracle, and in doing so, restore the foreign keys as well. Here’s how to drop and recreate all foreign keys on an Oracle table.

Read the Full Article →
Thumbnail image for ORA-02449: Solving the DROP TABLE Dilemma

ORA-02449: Solving the DROP TABLE Dilemma

Quick workaround to error ORA-02449. When you want to drop and recreate an Oracle table, but Oracle does not let you do so due to foreign key references.

Read the Full Article →
Thumbnail image for INSERT ALL: Insert Multiple Rows with a Single INSERT Statement

INSERT ALL: Insert Multiple Rows with a Single INSERT Statement

A quick tip to get rid of the plodding way of inserting data into a table with multiple INSERT statements. Know what I mean? Say you have a table COLORS with this structure: And you want to create this data in the table COLORS: Hands up all who write insert statements this way:

Read the Full Article →
Thumbnail image for 15 Things You Should Know about the ORDER BY Clause

15 Things You Should Know about the ORDER BY Clause

What is the precedence of sorting in a multi-column ORDER BY? How does ORDER BY sort nulls? What does ORDER SIBLINGS BY do? Answers to these questions and more about Oracle’s ORDER BY clause.

Read the Full Article →
Thumbnail image for MERGE: Insert New Rows, Update Existing Rows in One Shot

MERGE: Insert New Rows, Update Existing Rows in One Shot

MERGE in Oracle combines the power of INSERT and UPDATE into one power-packed statement

Read the Full Article →
Thumbnail image for How to Manage those Pesky NULLs when Sorting Data

How to Manage those Pesky NULLs when Sorting Data

How to position NULL values in the sort column – send them to the top or the bottom in the result set with this ORDER BY NULLs FIRST or LAST.

Read the Full Article →
Thumbnail image for DISTINCT and How NOT To Use It

DISTINCT and How NOT To Use It

Oracle keyword DISTINCT restricts the result to unique rows from a query, but DISTINCT is often used as a quick fix to bad queries. Some practices to avoid when using DISTINCT.

Read the Full Article →
Thumbnail image for How to Add Table Column at Specific Position

How to Add Table Column at Specific Position

In Oracle, the ALTER TABLE command to add column appends the column to the end of all existing columns. What if you want the new column at a specific position in the table, not at the end? Here’s how to add a new column at a specific position.

Read the Full Article →
Thumbnail image for Unlock Database User Account in Oracle Express Edition

Unlock Database User Account in Oracle Express Edition

Quick tip to unlock database user account in Oracle Express Edition (XE) – this is among the first things you’d need to do when you start using Oracle XE.

Read the Full Article →
Thumbnail image for LTRIM and TO_CHAR…and a “Strange” Query

LTRIM and TO_CHAR…and a “Strange” Query

When we place the output of TO_CHAR(102.3, ‘000000.0’) as the input of the LTRIM function with ‘0’, we expect to get 102.3. That’s not how it works though – the zeroes on the left do not get trimmed. Can you tell why this is so? This article gives you the answer.

Read the Full Article →