Hi,
I am pasting java code which is used to get data from database.
public ResultSet getData(Connection con, ArrayList proc)
{
ResultSet rs;
CallableStatement callStmt;
String procName = (String)proc.get(0);
proc.remove(0);
int noOfParams = proc.size();
StringBuffer temp = new StringBuffer("begin :1 := " + procName);
if ( noOfParams != 0 ) temp.append("(");
for(int i = 0; i< noOfParams;i++)
{
if ( proc.get(i) instanceof Integer )
{
temp.append(proc.get(i) + " ,");
}
else
{
temp.append("'" + proc.get(i) + "' ,");
}
}
if ( noOfParams != 0 )
{
temp.setLength(temp.length() - 1);
}
if ( noOfParams != 0 ) temp.append(")");
temp.append("; end;");
String sql = new String(temp);
try
{
callStmt = con.prepareCall(sql);
//System.out.println
callStmt.registerOutParameter(1,OracleTypes.CURSOR);
callStmt.execute();
rs = (ResultSet)callStmt.getObject(1);
return rs;
}
catch(SQLException e)
{
return null;
}
}
Looking forward to ur reply guys, peter and jamie,
Sankar