PL/SQL (MOSC)

MOSC Banner

inconsistent ORA-56901 error message for a PIVOT query

in PL/SQL (MOSC) 4 commentsAnswered

Hello and happy new year 2026.

My DB version is 19.29.

I get the following error while trying to compile a package within which I use a pivot query :

ORA-56901: non-constant expression is not allowed for pivot|unpivot values"

The error comes from the fact that I'm not using literals for the pivot values, but CONSTANTs defined in the package specification. So I find the error's label a bit contradictory. Perhaps it would be better renaming it "non-literal value is not allowed for pivot|unpivot values".

Here's the test code:

create or replace package test_pkg
is
c_id1 CONSTANT number(1) := 1;
c_id2 CONSTANT number(1) := 2;

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center