条件:
1.Java代码调用的时候有一下几个参数:
String []vestAreaName,String problemTypeName,StringproductionTypeName,String samTime,String[]handleDept,
String []sheetTime2.查询数据的SQL语句:
SELECT * 
  FROM (SELECT t.main_sheet_flow_no,t.mobile_tele_no,'这里为数组vestAreaName的值','这里为samTime'FROM tbl_main_sheet t,tbl_departments m where t.main_status='22' and t.sheet_category_id in ('1','3') 
  and to_date(t.deal_time,'yyyy-mm-dd hh24:mi:ss') >= to_date('这里为数组sheetTime[0]','yyyy-mm-dd hh24:mi:ss') 
  and to_date(t.deal_time,'yyyy-mm-dd hh24:mi:ss') < (to_date('这里为数组sheetTime[1]','yyyy-mm-dd hh24:mi:ss')+10) 
  and t.handle_dept= m.department_id 
  and (t.handle_dept='handleDept数组[0]' or t.handle_dept='handleDept数组[1]' or t.handle_dept='handleDept数组[2]') 这里可能为两个 t.handle_dept 所以要判断
  ORDER BY dbms_random.value)
  WHERE rownum <= 10end;
3.在存储过程中要将查询出来的值插入到另外一张表TBL_MAIN_SHEET_SAMPLING中
···················解决问题的大哥,100全给。

解决方案 »

  1.   

    存储过程我就不写了,就给简单思路吧
    pl/sql存储过程的in变量就oracle那么几个类型
    所以string数组要先转化成oracle认识的,你自己可以定格式
    其他的cursor exe_immadiatexxx
    查查资料就会写了
      

  2.   

    其实我在Java中用代码都实现了,但是由于用的Hibernate1,所以他执行
    SELECT *  
      FROM (SELECT t.main_sheet_flow_no,t.mobile_tele_no,'这里为数组vestAreaName的值','这里为samTime'FROM tbl_main_sheet t,tbl_departments m where t.main_status='22' and t.sheet_category_id in ('1','3')  
      and to_date(t.deal_time,'yyyy-mm-dd hh24:mi:ss') >= to_date('这里为数组sheetTime[0]','yyyy-mm-dd hh24:mi:ss')  
      and to_date(t.deal_time,'yyyy-mm-dd hh24:mi:ss') < (to_date('这里为数组sheetTime[1]','yyyy-mm-dd hh24:mi:ss')+10)  
      and t.handle_dept= m.department_id  
      and (t.handle_dept='handleDept数组[0]' or t.handle_dept='handleDept数组[1]' or t.handle_dept='handleDept数组[2]')   ORDER BY dbms_random.value)
      WHERE rownum <= 10
    会报错,而且这条SQL语句就是Hibernate中打印出来的,可以在数据库中查询并且插入,就是通过程序调用报错,没有办法解决,所以寻求存储过程的思路,