上面是这样声明的
TEMP CRMS_TEMP_BIZ_APPROVE_INFO%ROWTYPE下面是这样放到temp
select
trunc(reply_date) as reply_date ,
report_date,
APPROVE_ORG_CD into temp
from 表 。但是当 查询出没数据的时候,这里就会报个“没数据的错误”。要怎么解决这个问题呢
TEMP CRMS_TEMP_BIZ_APPROVE_INFO%ROWTYPE下面是这样放到temp
select
trunc(reply_date) as reply_date ,
report_date,
APPROVE_ORG_CD into temp
from 表 。但是当 查询出没数据的时候,这里就会报个“没数据的错误”。要怎么解决这个问题呢
select
* into temp
from 表 。 或select * into temp from
(select
trunc(reply_date) as reply_date ,
report_date,
APPROVE_ORG_CD into temp
from 表)
应该是先定义游标
declare
cusor cur is select
trunc(reply_date) as reply_date ,
report_date,
APPROVE_ORG_CD
from 表 ;
temp cur%rowtype;begin
...
CURSOR CUR_查询
is
select
trunc(reply_date) as reply_date ,
report_date,
APPROVE_ORG_CD into temp
from 表
;
然后就是open cursor,
fetch CUR_查询 into temp
这个时候判断no_data_found,然后做没数据的处理。
最后别忘close cursor
这样其实有点烦,习惯了以后结构就感觉挺清晰的。