inconsistent ORA-56901 error message for a PIVOT query
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;