把你所有形参前面的冒号全去掉。create or replace procedure proc_grm_transgress
( stationid in varchar2,
starttime in date,
endtime in date,
startfreq in number,
endfreq in number)
as
select a.* from grm_basetz_stat a,
(select * from grm_result_levelcount
where stationid_execute = stationid and starttime >= starttime and
endtime<=endtime and freq >= startfreq and freq <= endfreq) b ,
(select stlong, stlat from grm_base_station
where stationid = stationid) c
where
uf_grm_stationtz( a.longi, a.lati, c.longi, c.lati)) < 50 ;
( stationid in varchar2,
starttime in date,
endtime in date,
startfreq in number,
endfreq in number)
as
select a.* from grm_basetz_stat a,
(select * from grm_result_levelcount
where stationid_execute = stationid and starttime >= starttime and
endtime<=endtime and freq >= startfreq and freq <= endfreq) b ,
(select stlong, stlat from grm_base_station
where stationid = stationid) c
where
uf_grm_stationtz( a.longi, a.lati, c.longi, c.lati)) < 50 ;
举例说明:
create table temp(a number);create or replace procedure pp
(a number)--这时a的值是1
as
begin
update temp set a=a;
end;
你的本意是想改a=1的那条记录。而实际的结果是改了所有的记录。因为pl/sql是先检测列,后检测变量。
我改成如下:还是不行
create or replace procedure proc_grm_transgress
( v_stationid in varchar2,
d_starttime in date,
d_endtime in date,
n_startfreq in number,
n_endfreq in number)
as
select a.* from grm_basetz_stat a,
(select * from grm_result_levelcount where stationid_execute=v_stationid and starttime>=d_starttime and
endtime<=d_endtime and freq>=n_startfreq and freq<=n_endfreq) b ,
(select stlong, stlat from grm_base_station where stationid=v_stationid) c where
uf_grm_stationtz( a.longi, a.lati, c.longi, c.lati)) < 50 ;
select ... into ... from ...
改成这样
Cursor c_test is
select a.* from grm_basetz_stat a,
(select * from grm_result_levelcount
where stationid_execute = stationid and starttime >= starttime and
endtime<=endtime and freq >= startfreq and freq <= endfreq) b ,
(select stlong, stlat from grm_base_station
where stationid = stationid) c
where
uf_grm_stationtz( a.longi, a.lati, c.longi, c.lati)) < 50 ;
wangybyangxr(王永斌) ; tian00weiwei(weiwei) ; liuyi8903(甜脆夹心) ; beckhambobo(beckham);
GerryYang(轻尘) ;yown(yong)