简体   繁体   中英

Method to get only procedures from an oracle database using Java

I need to get only the procedures using java DatabaseMetaData but this method returns also the functions' names.

DatabaseMetaData dbmd=con.getMetaData();
ResultSet result = dbmd.getProcedures(null, Ousername, null); 

That happens because procedures and functions are basically the same in Oracle.

There is a column PROCEDURE_TYPE of the type short that will show the kind of procedure:

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

You can access that column as usual from the ResultSet :

result.getShort("PROCEDURE_TYPE")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM