I have a query like this:
select samplePackage.prepareMessage(t.message) as text
from
sampleSchema.sampleTable t;
sampleTable has large data (number of rows 30M)
prepareMessage is a java stored procedure.
private static String prepareMessage(String message) {
//do some things...
return preparedMessage;
}
I’m trying to execute this query in parallel. How can i do it?
Thanks.
I’ve never tried it with Java function myself. But the approach should be as followos:
Run your query with the PARALLEL hint:
To successfully execute the SELECT in parallel, Oracle needs to know that your Java function is safe for that. So you have to declare it either as PARALLEL_ENABLE or provide RESTRICT_REFERENCES.
The query then becomes:
There are further restrictions that apply to the function, e.g. it may not execute DML statements. Otherwise, a parallel execution isn’t possible.
As I said: I haven’t tried it with Java. But that’s the direction to go.
Update: I’ve changed the code from using a package to using a function. It should be simpler like this.