0
create or replace function f_get_ids(p_user in nvarchar2)
return nvarchar2 sql_macro(table)
as
begin
  return q'[select id from table1 where user=p_user]';
end;

while executing the above code in oracle 19.0.0.0.0 version getting the below error.

Error(1,27): PLS-00103: Encountered the symbol "(" when expecting one of the following: ; is default authid as cluster order using external deterministic parallel_enable pipelined aggregate result_cache accessible rewrite

1
  • 2
    I think you need at least 19.7 to be able to use SQL macros Commented Feb 14, 2022 at 16:08

1 Answer 1

1

Simple fix once you get to the right patch level on 19c.

Because there is only ONE type of macro in 19c, you don't need to quantify which type, eg

SQL> create or replace function f_get_ids(p_user in nvarchar2)
  2  return nvarchar2 sql_macro(table)
  3  as
  4  begin
  5    return q'[select id from table1 where user=p_user]';
  6  end;
  7  /

Warning: Function created with compilation errors.

SQL>
SQL>
SQL> create or replace function f_get_ids(p_user in nvarchar2)
  2  return nvarchar2 sql_macro     
  3  as
  4  begin
  5    return q'[select id from table1 where user=p_user]';
  6  end;
  7  /

Function created.

Same as when you asked here as well :-)

https://asktom.oracle.com/pls/apex/asktom.search?tag=error-while-executing-sql-macro-in-19c

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.