Oracle存储过程
陕K流年 2006-04-20 09:22:13
<%@ page contentType="text/html; charset=GBK" import="java.sql.*,javax.naming.*,javax.sql.*,oracle.jdbc.driver.*"%>
<html>
<head>
<title>
jsp1
</title>
</head>
<body bgcolor="#ffffff">
<h1>
<%
try {
Context initCtx = new InitialContext();
DataSource ds = (DataSource) initCtx.lookup("jdbc/myoracle");
Connection conn = ds.getConnection();
CallableStatement stmt = conn.prepareCall("{call getEmp(?)}");
stmt.registerOutParameter(1,OracleTypes.CURSOR);
stmt.execute();
ResultSet rs = stmt.getResultSet();
while (rs.next()) {
out.println(rs.getString(1) + "\t" + rs.getString(2) + "<br>");
}
rs.close();
stmt.close();
conn.close();
}
catch (Exception ex) {
out.println(ex);
}
%>
</h1>
</body>
</html>
页面回抛出
java.sql.SQLException: ORA-06550: 第 1 行, 第 7 列: PLS-00201: 必须说明标识符 'GETEMP' ORA-06550: 第 1 行, 第 7 列: PL/SQL: Statement ignored