谁能给我写个例子
要求有一个输入参数,一个输出参数

解决方案 »

  1.   

      create procedure test(in id int,out name varchar(10)) begin  select * from student where id = 1;  set name='zhangsan';
      
      end;  
      

  2.   

    那我怎么用java调用啊?
    我用Navicat调用总是有这样的错误
    Procedure execution failed
    1318 - Incorrect number of arguments for PROCEDURE fundbusiness.test; expected 2, got 1
      

  3.   

    调用存储过程,要用CallableStatement
    假如
      Connection conn = Connect.getConnection();
      CallableStatement cst = null;
      ResultSet rs =  null;
       cst = conn.prepareCall("{call test()}");
        rs = cs.executeQuery();
       while(rs.next()){
         System.out.println(rs.getString(1));
       }
      

  4.   

    我也是新手,才看了一天而已
    create procedure getTotal(in inStr int,out outStr int)
    begin
    select count(*) into outStr from student where stu_id = inStr;
    end;            CallableStatement proc =con.prepareCall("{call getTotal(?,?)}");   
                proc.setInt(1, 1);
                proc.registerOutParameter(2,Types.INTEGER);
                proc.execute();
        System.out.print(proc.getInt(2));//打印总记录数
      

  5.   


    用Navicat 创建存储过程,直接 把代码贴到 查询 窗口就可以了,没必要跑到他存储过程 那个窗口创建