0

Code below works properly:

BEGIN
    CTX_DDL.CREATE_STOPLIST('MY_STOPLIST', 'BASIC_STOPLIST');
END;
/

However, when trying to run it through EXECUTE IMMEDIATE:

BEGIN
    EXECUTE IMMEDIATE 'CTX_DDL.CREATE_STOPLIST(''MY_STOPLIST'', ''BASIC_STOPLIST'');';
END;
/

I get the error

ORA-00900: invalid SQL statement
ORA-06512: at line 2
00900. 00000 -  "invalid SQL statement"
*Cause:    
*Action:

FIXED (thanks @William Robertson):

BEGIN
    EXECUTE IMMEDIATE 'BEGIN CTX_DDL.CREATE_STOPLIST(''MY_STOPLIST'', ''BASIC_STOPLIST''); END;';
END;
/

NOTE: I really need to run it using EXECUTE IMMEDIATE.

Cássio
  • 329
  • 3
  • 11
  • 4
    PL/SQL calls need to be enclosed in `begin` and `end;` (or preceded by `call`). It's the same if you test with `dbms_output.put_line`. – William Robertson Oct 03 '18 at 16:08
  • 2
    Why on earth would you want to run `CTX_DDL.CREATE_STOPLIST` through dynamic SQL? – APC Oct 03 '18 at 16:29

0 Answers0