Skip to Main Content

Oracle Database Free

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Column "sql_macro" in "%_procedures" views inconsistent

Erik van RoonSep 29 2024

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 
; 

Comments
Post Details
Added on Sep 29 2024
2 comments
177 views