Method to get only procedures from oracle database using Java

I need to get only procedures using java DatabaseMetaData, but this method also returns function names.

DatabaseMetaData dbmd=con.getMetaData(); ResultSet result = dbmd.getProcedures(null, Ousername, null); 
+5
source share
1 answer

This is because the procedures and functions in Oracle are the same.

There is a PROCEDURE_TYPE column of type short , which will show the type of procedure:

  • 1 means that there is no result, so this is a procedure.
  • 2 means that it returns a result, so it is a function.

You can access this column, as usual, from a ResultSet :

 result.getShort("PROCEDURE_TYPE") 
+7
source

All Articles