package jdbc;
import java.sql.*;
public class Proc_Call
{
public static void main(String[] args) throws ClassNotFoundException, SQLException
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con= DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "hr", "hr");
CallableStatement cst = con.prepareCall("{call proc_sum(?,?,?)}");
cst.setInt(1,100);
cst.setInt(2,500);
cst.registerOutParameter(3,Types.INTEGER);
cst.execute();
System.out.println("Sum Is: "+cst.getInt(3));
con.close();
}
}
import java.sql.*;
public class Proc_Call
{
public static void main(String[] args) throws ClassNotFoundException, SQLException
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con= DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl", "hr", "hr");
CallableStatement cst = con.prepareCall("{call proc_sum(?,?,?)}");
cst.setInt(1,100);
cst.setInt(2,500);
cst.registerOutParameter(3,Types.INTEGER);
cst.execute();
System.out.println("Sum Is: "+cst.getInt(3));
con.close();
}
}
No comments:
Post a Comment