create or replace package utFlight_pack is
type search_results is ref cursor;
procedure utFlight_proc(cur_results_out out search_results, flightNo in varchar2, air_line in varchar2, flowIn in varchar2, statusIn in varchar2);
end utFlight_pack; create or replace package body utFlight_pack is
procedure utFlight_proc(cur_results_out out search_results, flightNo in varchar2, air_line in varchar2, flowIn in varchar2, statusIn in varchar2) is
 strSql varchar2(1000);
     begin
     
       strSql :='select flight_no,airline, flow, status from ut_flight where 1=1';
       
       if flightNo is not null then
         strSql := strSql || ' and flight_no='||flightNo;
       end if;
       if air_line is not null then
         strSql := strSql ||' and airline='|| air_line;
        end if;
       if flowIn is not null then
         strSql := strSql ||' and flow='|| flowIn;
       end if;
       if statusIn is not null then
         strSql := strSql ||' and status='|| statusIn;
       end if;
       
   open cur_results_out for strSql;
 end utFlight_proc;
end utFlight_pack; oracle存储过程,编译通过,执行出错:ORA-06512: 在 "EAF_MASTER.UTFLIGHT_PACK",

解决方案 »

  1.   

    自己抢沙发,少了一句,不好意思:java.sql.SQLException: ORA-00933: SQL 命令未正确结束
    各位大大,支持下!
      

  2.   

    utFlight_proc这个过程用 PL/SQL test script测试一下, 
    再用JAVA来调用..现在根本不知道是你存储过程写错了, 还是你JAVA程序写错了.
      

  3.   

    strSql := strSql ||' and flow='|| flowIn;
    象这样的句子如果是char或varchar型的加一些单引号strSql := strSql ||' and flow='''|| flowIn||'''';
      

  4.   

    检查下拼装的SQL语句中的空格是否正确。这种情况多数是因为sql语句不正确导致的。