declare
N number;
far_lat varchar2(32);
far_lon varchar2(32);
cursor c_CI is select distinct CI from CICENTER;
c_row c_CI%rowtype;
begin
for c_row in c_CI
loop
select round(count(CI)*0.8) into N from CDL_ZX_20120315 where CI=c_row.CI and wso_sn=3 and (access_lat is not null or access_lon is not null);
select access_lat into far_lat from tmp_access_latlon where CI=c_row.CI and n=N;
select access_lon into far_lon from tmp_access_latlon where CI=c_row.CI and n=N;
DBMS_OUTPUT.put_line(c_row.CI||'--'||N||'--'||far_lat||'--'||far_lon);
END LOOP;
end;错误代码:
ORA-01422:exact fetch returns more than requested number of rows
ORA-06512:at line 14请高人帮看看这是什么原因出现的这个错误。谢谢
解决方案 »
- 各位帮忙啊,如何更改NLS中的参数呵
- 两个表相加的问题
- Oracle 存储过程。急!急!急!
- oracle 10g的表数据输入有可视化的界面吗?
- 在Unix下编译Pro*C源程序,为什么总提示找不到Make.defines文件?
- 急!80分SOS!! imp .dmp文件的同时,可以truncate 刚imp 的垃圾表吗?
- 请教,怎样在oracle 中用什么函数可以把 varchar型的数据为2004/12/02 上午 10:47:08 转成 日期型,以便我做查询比较.谢谢
- 安装问题2
- 数据库怎么创建不起来????
- 【求助】可否在VB中执行PL/SQL语句?
- sql 函数的运用问题 求解
- 请问spring+oracle转成spring+db2需要改些什么,做哪些工作?
查询出了多条数据,所有出错……采用max() min() sum() avg() 等等函数可以解决
具体根据自己的需求
declare
v_CI number;
n1 number;
far_lat varchar2(32);
far_lon varchar2(32);
cursor c_CI is select distinct CI from CICENTER;
c_row c_CI%rowtype;
begin
for c_row in c_CI
loop
DBMS_OUTPUT.put_line(c_row.CI);
select round(count(CI)*0.8) into N1 from CDL_ZX_20120315
where CI=c_row.CI and wso_sn=3
and (access_lat is not null or access_lon is not null);
DBMS_OUTPUT.put_line(N1);
select access_lat,access_lon from tmp_access_latlon a where a.CI=c_row.CI and a.n=N1; END LOOP; end;数据我一条一条的查询了。没有多啊。那上面的句子 报错:
ORA-06550:line 16,column 11;
PLS-00428:an INTO clause is expected in this SELECT statement
这又是什么原因?
这里的查询应该用Into子句放到变量里去。
select access_lat,access_lon from tmp_access_latlon a where a.CI=c_row.CI and a.n=N1;
这句,from前面得加上INTO啊:
select access_lat,access_lon INTO 变量1, 变量2 ....
我不插入变量 进行查询不可以么? into 变量1,变量2又回到上面的问题了。
查出来就一条啊……