0

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

Umar Sid
  • 1,317
  • 1
  • 17
  • 24
  • You should show us the actual Java code. – Tim Biegeleisen Feb 07 '18 at 02:09
  • @TimBiegeleisen The project don't have any java code. Just the POM and SQL files. I'll update the directory structure. – Umar Sid Feb 07 '18 at 02:28
  • 1
    Possible duplicate of [Maven: PL/SQL script with sql-maven-plugin throws error PLS-00103](https://stackoverflow.com/questions/7580165/maven-pl-sql-script-with-sql-maven-plugin-throws-error-pls-00103) – Tim Biegeleisen Feb 07 '18 at 02:35

1 Answers1

3

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.

Connor McDonald
  • 10,418
  • 1
  • 11
  • 16