Umar Sid
Umar Sid

Reputation: 1337

PL/SQL script in sql-maven-plugin throws invalid SQL statement

I am trying to update my materialized view using sql-maven-plugin but its says

Caused by: java.sql.SQLSyntaxErrorException: ORA-00900: invalid SQL statement
ORA-06512: at line 2

Query :

begin
    EXECUTE IMMEDIATE 'DBMS_MVIEW.REFRESH(''M_CUSTOMER'')';
end;

Even after spending hours and hours on this, i am not able to figure out the issue. Thanks in advance.

The queries I want to execute are not simple DDL queries but DBMS_MVIEW package or other packages. Other answers have the solution for DDL but not for package.

Project structure

enter image description here

Upvotes: 0

Views: 488

Answers (1)

Connor McDonald
Connor McDonald

Reputation: 11591

You have not enough or too many levels of indirection here :-)

You either want:

begin
    DBMS_MVIEW.REFRESH('M_CUSTOMER');
end;

or

begin
    EXECUTE IMMEDIATE 'begin DBMS_MVIEW.REFRESH(''M_CUSTOMER''); end;';
end;

with the former being the most likely.

Upvotes: 3

Related Questions