The best thing to do is to create the pl/sql stored procedure in your schema and then execute the stored procedure from your java code using a CallableStatement . This is especially true if your writing a lot of pl sql code.