报了一个标识符无效异常,执行了一下sql。
今晚在博客上写下 标识符无效异常 和分页查询写法
SELECT
*
FROM
(
SELECT
m.*,
rownum AS rnum
FROM
(
SELECT
*
WHERE
A.CIF_NO=C.CIF_NO
AND A.BAl>0.0
AND A.DEAL_FLAG = ‘2’
AND A.END_DATE >
(
SELECT
SYS_DATE
FROM
SYS_GLOBAL)
AND A.due_amt >0
AND A.REPAY_TYPE IN (‘3’,
‘4’)
AND A.MANG_NO=‘222222’
AND A.MANG_BRNO=‘2222’ ) m
WHERE
rownum < 11 )
WHERE
rnum >= 1
中间部分可以执行,但是到了全部就没办法执行了。
找到原因,是
SELECT
*
FROM
(
SELECT
m.*,
rownum AS rnum
FROM
(
SELECT
*
WHERE
A.CIF_NO=C.CIF_NO
AND A.BAl>0.0
AND A.DEAL_FLAG = ‘2’
AND A.END_DATE >
(
SELECT
SYS_DATE
FROM
SYS_GLOBAL)
AND A.due_amt >0
AND A.REPAY_TYPE IN (‘3’,
‘4’)
AND A.MANG_NO=‘222222’
AND A.MANG_BRNO=‘2222’ ) m
WHERE
rownum < 11 ) n
WHERE
rnum >= 1
因为没有给表起别名,但是数据库报错是某个字段标识符无效,把我误导以为字段问题。实际上是整个临时表没有起别名,导致错误