永发信息网

plsql 语句ora_00103错误

答案:2  悬赏:80  手机版
解决时间 2021-03-09 14:26
  • 提问者网友:十年饮冰
  • 2021-03-09 03:14
declare
i integer;
n integer;
deviceid gxx01.sys_device.device_id%type;
regionid gxx01.sys_device.region_id%type;
devicename gxx01.sys_device.device_name%type;
devicetype gxx01.sys_device.device_type_id%type;
begin
for i in 1..100000
loop
select device_id, region_id,device_name,device_type_id into deviceid,regionid,devicename,devicetype from gxx01.sys_device;
for n in reverse (select count(*) from gxx01.sys_device)
loop
insert into rpt_history_data_201304(region_id,device_id,standard_id,signal_time,signal_value)
values (regionid,deviceid,'7188',to_date('2013-06-22 00:00:00','yyyy-mm-dd hh24-mi-ss')+i,'380');
end loop;
end loop;
commit;
end;
/
结果显示ora_00103错误,各位大侠帮忙
最佳答案
  • 五星知识达人网友:往事埋风中
  • 2021-03-09 04:19
这个要是有多个结果,则INTO 会出错。
select device_id, region_id, device_name, device_type_id
into deviceid, regionid, devicename, devicetype
from gxx01.sys_device;
以下FOR 缺少一个范围,且你的变量N在后边的代码也没用到。
for n in reverse (select count(*) from gxx01.sys_device) loop 

应该直接说出你要做什么,大家才好帮你。
全部回答
  • 1楼网友:轮獄道
  • 2021-03-09 05:45
else if --> elsif salary||''||grade -->salary||''||to_char(grade) 改后这样: declare salary acount.acount%type; grade char(1); begin select acount into salary from acount where num=1; if salary >=1000 then grade:='a'; elsif salary >=800 then grade:='b'; else grade:='c'; end if; dbms_output.put_line(salary||''||to_char(grade)); exception when others then dbms_output.put_line(sqlerrm); end;
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯