Search code examples
sqloracle-databaseplsql

ORA-22905 SQL_MACRO Table


I get an error when I call a function

CREATE OR REPLACE FUNCTION test_funct(v_var VARCHAR2) RETURN VARCHAR2 SQL_MACRO IS
BEGIN
   RETURN q'{SELECT DUMMY FROM DUAL WHERE DUMMY = v_var}';
END;
/
SELECT * FROM test_funct('X');

ORA-22905: cannot access rows from a non-nested table item

Oracle version 19c


Solution

  • Your code is correct, but SQL table macros do not work until version 19.7 according to the documentation.

    Typically, new Oracle features are introduced with a major release number. Occasionally, as in this case, a feature is added in a Release Update.