Klajdi
Klajdi

Reputation: 1

Calling pkg and Stored procedure, but it give me syntax error

I am trying to call the pkg and the procedure in java, as below:

public void rebuildIndexes() {
        Query query = getEntityManager().createNativeQuery("BEGIN BFPA_ARCHIVING.rebuild_archiving_indexes; END;");
        query.executeUpdate();
}

BFPA_ARCHIVING is the package and rebuild_archiving_indexes is the procedure. When I tried to test it, it gave me this error:

Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "BEGIN BFPA_ARCHIVING[*].REBUILD_ARCHIVING_INDEXES; END; "; SQL statement:
BEGIN BFPA_ARCHIVING.rebuild_archiving_indexes; END; [42000-167]
Error Code: 42000
Call: BEGIN BFPA_ARCHIVING.rebuild_archiving_indexes; END;
Query: DataModifyQuery(sql="BEGIN BFPA_ARCHIVING.rebuild_archiving_indexes; END;")
javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.6.4.v20160829-44060b6): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "BEGIN BFPA_ARCHIVING[*].REBUILD_ARCHIVING_INDEXES; END; "; SQL statement:
BEGIN BFPA_ARCHIVING.rebuild_archiving_indexes; END; [42000-167]
Error Code: 42000
Call: BEGIN BFPA_ARCHIVING.rebuild_archiving_indexes; END;
Query: DataModifyQuery(sql="BEGIN BFPA_ARCHIVING.rebuild_archiving_indexes; END;")
    at org.eclipse.persistence.internal.jpa.QueryImpl.executeUpdate(QueryImpl.java:308)

I am not finding the exact way to call the pkg, any idea?

Upvotes: 0

Views: 53

Answers (0)

Related Questions