callablestatement
creation of oracle Stored Procedure:
Here text is the table with one column.Use Sp to insert the value in the DB
create or replace procedure procone
as
i number;
BEGIN
i:=443;
insert into test values(i);
end procone;
/
jdbc example use above stored procedure:
import java.sql.*;
class CStmtDemo1
{
public static void main(String[] args) throws Exception
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:xe","system","chandru");
System.out.println(" nected 2 DB.....");
CallableStatement cstmt=con.prepareCall("{call procone()}");
cstmt.execute();
}
}
0 comments:
Post a Comment