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",
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",
各位大大,支持下!
再用JAVA来调用..现在根本不知道是你存储过程写错了, 还是你JAVA程序写错了.
象这样的句子如果是char或varchar型的加一些单引号strSql := strSql ||' and flow='''|| flowIn||'''';