java调用存储过程问题。。。。。。。。。。。。。。。。。。。。。。。
create or replace procedure p
as
begin
execute immediate 'select * from interface_info';
end p;
怎样获取查询出来的值啊?这样调报错,
PLS-00222: no function with name 'P' exists in this scope
Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@ip保密:1521:数据库保密", "账号保密", "密码保密"); CallableStatement cs = con.prepareCall("{? = call p() }"); cs.registerOutParameter(1, oracle.jdbc.OracleTypes.CURSOR); cs.execute(); cs.getResultSet(); rs.close(); con.close();--按照部门编号查询部门信息Create Or Replace Procedure findDeptByDeptno(p_dno In dept.deptno%Type)Isv_deptrec dept%Rowtype;Begin Select * Into v_deptrec From dept Where deptno=p_dno; dbms_output.put_line('------------------------ '); dbms_output.put_line('部门编号: '||v_deptrec.deptno); dbms_output.put_line('部门名称: '||v_deptrec.dname); dbms_output.put_line('部门位置: '||v_deptrec.loc); dbms_output.put_line('------------------------ '); Exception When no_data_found Then dbms_output.put_line('该部门不存在...');End;
[解决办法]