The docs for 23ai say that the possible values for column “SQL_MACRO” in “ALL_PROCEDURES” (and similar) view are:
SCALAR
: The procedure is a SQL macro for a scalar expression
TABLE
: The procedure is a SQL macro for a table expression
NULL
: The procedure is not a SQL macro
(See https://docs.oracle.com/en/database/oracle/oracle-database/23/refrn/ALL_PROCEDURES.html )
However, possible values appear to be:
- ‘SCALAR’ : The procedure is a SQL macro for a scalar expression
- ‘TABLE’ : The procedure is a SQL macro for a table expression
- NULL (empty): The procedure is a package or a trigger
- ‘NULL’ (the string): The procedure is a TYPE or a PROCEDURE or a FUNCTION that is not a macro
So both NULL and the string ‘NULL’ is used for stuff that is not a sql macro
The docs make it appear as if the column is null (empty/not available) for functions that are not a sql macro.
On top of that: for some but not all objects that can't be a sql macro the column is null (empty).
I think this is a) confusing and b) inconsistent
IMHO everything that's not a sql macro should hav ethe same value in this column.
They should all be empty or, if null (empty) is not desired they should all have a differend status like ‘NO’ or ‘NONE’ or ‘NOTAMACRO’ or whatever. Not ‘NULL’, and definitly not 2 different ways of saying the same thing.
Also: if the string ‘NULL’ is what it will be after all, the docs should make it clear that it's the string, not “empty”.
select sql_macro
, case
when -- standalone functions/procedures
object_type in ('FUNCTION'
,'PROCEDURE'
)
or -- packaged functions/procedures
( object_type = 'PACKAGE'
and procedure_name is not null
)
then 'FUNCTION or PROCEDURE'
else object_type
end as type_of_object
, count(*) as macro_ind_count
from dba_procedures
group by sql_macro
, type_of_object
order by sql_macro desc nulls last
, type_of_object
;