oracle存储过程into赋值,子查询等,来帮我看看
jianju number(20,4);变量
for r in (select * from( select * from tb_points where district_name='XMQ' and location_name='上行' and pyear='2003' and pmonth='04' order by milestone)where rownum=1) loop --没有问题
select * from (select milestone-r.milestone into jianju from tb_points where district_name=r.district_name and location_name=r.location_name and pyear=r.pyear and pmonth=r.pmonth and milestone > r.milestone order by milestone) where rownum=1 ; --有问题
红色地方into jianju 变量赋值。
第二红色地方 先milestone排序后, 取第一行。
dbms_output.put_line(jianju);输出,
Error: PL/SQL: ORA-01744: 不合理的 INTO 报错。
或者有什么方法 先排序好,然后取第一行,用into 取值。
或者有什么方法 for循环 r 怎么取下一条记录。