/*执行一条insert语句并传参数*/
create or replace procedure p_test(i in number) as
begin
insert into t values (i’x||to_char(i));
commit;
end;
<%@ page language=”java” contentType=”text/html;charset=gb″%>
<%@page import=”javasql*”%>
<html>
<body>
<table>
<tr><td>aaa</td><td>bbb</td></tr>
<%
String driver = “oraclejdbcdriverOracleDriver”;
String strUrl = “jdbc:oracle:thin:@::db”;
ClassforName(driver);
Connection conn = DriverManagergetConnection(strUrl “scott” “tiger”);
String procedure = “{call p_test (?) }”;
CallableStatement cstmt = connprepareCall(procedure);
cstmtsetInt();
cstmtexecuteUpdate();
Statement stmt = conncreateStatement();
ResultSet rs = stmtexecuteQuery(”select * from t”);
while(rsnext())
{
outprintln(”<tr><td>” + rsgetString() + “</td><td>” + rsgetString() + “</td></tr>”);
}
rsclose();
stmtclose();
connclose();
%>
</table>
<p>
<%
outprint(connisClosed());
%>
</body>
</html>
</body>
</html>