Create a Package in Oracle for Test in Java

I create a package in oracle that need to be tested in java.  What am I supppose to do?

By Suman

It's not a tough thing.
Say for example you have a package pkg_manage_emp_info, and inside it there a proc/function sp_select_emp_leave(in,in,out,in out) that you need to be called from java class....

Need to import the following classes/interfaces:------>>>>
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import oracle.jdbc.internal.OracleTypes;
and ojdbc14.jar need to be in your project classpath. 
CallableStatement cstmt = 
String queryString = 
"{CALL pkg_manage_emp_info.sp_select_emp_leave(?,?,?,?)}"; 
Connection conn = 
conn = DriverManager.getConnection(
"jdbc:oracle:thin:@", "user_name", "password"); 
cstmt = conn.prepareCall(procedureString);
""//set the value of in parameter); 
""//set the value of 2nd in parameter); 
//for out or in/out param--- 
cstmt.registerOutParameter(3, Types.VARCHAR,
//if it is a ref_cursor type out var then use --OracleTypes.CURSOR); 
cstmt.registerOutParameter(4, Types.INT);
String empBalLeave = (String) cstmt.getObject(3);
//if it is a ref cursor then 
//ResulSet rs = (ResultSet)cstmt.getObject(3);
(Exception ex) 

Have a Oracle Question
Do you have an Oracle Question?

Oracle Books
Oracle Certification, Database Administration, SQL, Application, Programming Reference Books

Oracle Home
Oracle Database, SQL, Application, Programming Tips

All the site contents are Copyright © and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of or the content authors.