把你所有形参前面的冒号全去掉。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 ;

解决方案 »

  1.   

    楼上说的对,同时建议你,形参的命名不要和列名相同。
    举例说明:
    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是先检测列,后检测变量。
      

  2.   

    楼上的哥们:
       我改成如下:还是不行
    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 ;
      

  3.   

    在过程体内怎能直接写select 语句,写成以下形式
    select ... into ... from ...
      

  4.   

    肯定出错.
    改成这样
    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 ;
      

  5.   

    你a,b,c 三個表的相互連接條件呢 ?
      

  6.   

    不能直接写select 语句,要变换形式,如写成select ..into... 或cursor
      

  7.   

    你可以用游标来处理.要不就如楼上的写成select ..into...
      

  8.   

    chentony:我的连接条件可以最后加的,这与procedure的语法错误无必然联系,十分感谢
     wangybyangxr(王永斌) ; tian00weiwei(weiwei) ; liuyi8903(甜脆夹心) ; beckhambobo(beckham);
     GerryYang(轻尘) ;yown(yong)