0select af.keynode into kn from APPFOUNDATION af where af.appid=aid and af.foundationid=fid.-- 有into,正确编译 0select af.keynode from APPFOUNDATION af where af.appid=aid and af.foundationid=fid.-- 没有into,编译报错,提示:Compilation Error: PLS-00428: an INTO clause is expected in this SELECT statement
3.在利用0select...into...语法时,必须先确保数据库中有该条记录,否则会报出"no data found"异常。
可以在该语法之前,先利用0select count(*) from 查看数据库中是否存在该记录,如果存在,再利用0select...into...
4.在存储过程中,别名不能和字段名称相同,否则虽然编译可以通过,但在运行阶段会报错
0select keynode into kn from APPFOUNDATION where appid=aid and foundationid=fid.-- 正确运行 0select af.keynode into kn from APPFOUNDATION af whereaf.appid=appidandaf.foundationid=foundationid.-- 运行阶段报错,提示 ORA-01422:exact fetchreturns more than requested numberof rows