DBMS_REDEFINITION: Convert Non-Partitioned Table to Partitioned [pre 12.2]

DBMS_REDEFINITION to partition a table

DBMS_REDEFINITION

Oracle 12.2 has introduced a number of new features that ease partitioning, the most-awaited perhaps is the ALTER TABLE MODIFY syntax to convert a non-partitioned table to partitioned.

What do you do if your database version is pre-12.2? Partitioning a non-partitioned table in pre-12.2 databases is trickier, not impossible. Try DBMS_REDEFINITION: here’s how.

Read more

In Which Package Is This Procedure Placed?

Stored Procedures in Packages

“In which package is this procedure placed?”

Typical scenario: in a project’s design phase, procedureA is meant to be placed in packageX. During implementation, packages are refactored:  packageX gets split into packageY and packageZ. All goes well — the application gets deployed and is running merrily – till a change request comes in.

A new developer refers to the design documentation to understand the change request.

The design documentation should have been updated to reflect the new package structure — but it isn’t.

Read more

What are SQLCODE and SQLERRM?

SQLCODE and SQLERRM in Oracle

SQLCODE and SQLERRM are Oracle’s built-in error reporting functions in PL/SQL.

When an error occurs in PL/SQL at runtime:

SQLCODE returns the number of the last encountered error.

SQLERRM returns the  message associated with its error-number argument. The error-number argument is optional: if omitted, SQLERRM returns the message associated with the current value of SQLCODE.

Read more