1

我正在尝试创建一个变量来帮助我定位检查点行,然后查询该检查点之后的行。

起初,我正在考虑使用 ROWID,但由于 ROWID 的形式是非整数。好像有点不合适。

无论如何,一个必需的过程是创建一个在 Oracle 中不方便支持的 Rows 偏移量:

我不断得到

ORA-00904: "ITEM"."ID": 无效标识符

该变量是 Item_ID,它是表 ITEM 中的 ID 列。

select ITEM.ID,ITEM.CREATEDDATE,ITEM.TYPEID,
        CAT_DIC_AUTHOR.DISPLAYENTRY,
        CAT_DIC_PUBLISHER.DISPLAYENTRY,
        CAT_DIC_KEYWORD.ACCESSENTRY,CAT_DIC_KEYWORD.DISPLAYENTRY,
        CAT_DIC_LANGUAGE.DISPLAYENTRY,CAT_DIC_LANGUAGE.NAMEVIET,
        CAT_DIC_SH.DISPLAYENTRY,
        CAT_DIC_ITEM_TYPE.ACCESSENTRY,CAT_DIC_ITEM_TYPE.TYPENAME 
from ( select rownum r,ITEM.ID from ITEM) 

LEFT JOIN ITEM_AUTHOR 
    ON ITEM.ID=ITEM_AUTHOR.ITEMID 
LEFT JOIN CAT_DIC_AUTHOR 
    ON ITEM_AUTHOR.AUTHORID=CAT_DIC_AUTHOR.ID 
LEFT JOIN ITEM_PUBLISHER 
    ON ITEM.ID=ITEM_PUBLISHER.ITEMID 
LEFT JOIN CAT_DIC_PUBLISHER 
    ON ITEM_PUBLISHER.PUBLISHERID=CAT_DIC_PUBLISHER.ID 
LEFT JOIN ITEM_KEYWORD 
    ON ITEM.ID=ITEM_KEYWORD.ITEMID 
LEFT JOIN CAT_DIC_KEYWORD 
    ON ITEM_KEYWORD.KEYWORDID=CAT_DIC_KEYWORD.ID 
LEFT JOIN ITEM_LANGUAGE 
    ON ITEM.ID=ITEM_LANGUAGE.ITEMID 
LEFT JOIN CAT_DIC_LANGUAGE 
    ON ITEM_LANGUAGE.LANGUAGEID=CAT_DIC_LANGUAGE.ID 
LEFT JOIN ITEM_SH 
    ON ITEM.ID=ITEM_SH.ITEMID 
LEFT JOIN CAT_DIC_SH 
    ON ITEM_SH.SHID=CAT_DIC_SH.ID 
LEFT JOIN CAT_DIC_ITEM_TYPE 
    ON ITEM.TYPEID=CAT_DIC_ITEM_TYPE.ID 

where r>100 and r<=200
4

1 回答 1

2

尝试ITEM在子查询后添加单词,如下所示:

select ITEM.ID,ITEM.CREATEDDATE,ITEM.TYPEID,
        CAT_DIC_AUTHOR.DISPLAYENTRY,
        CAT_DIC_PUBLISHER.DISPLAYENTRY,
        CAT_DIC_KEYWORD.ACCESSENTRY,CAT_DIC_KEYWORD.DISPLAYENTRY,
        CAT_DIC_LANGUAGE.DISPLAYENTRY,CAT_DIC_LANGUAGE.NAMEVIET,
        CAT_DIC_SH.DISPLAYENTRY,
        CAT_DIC_ITEM_TYPE.ACCESSENTRY,CAT_DIC_ITEM_TYPE.TYPENAME 
from ( select rownum r,ITEM.ID,ITEM.TYPEID, ITEM.CREATEDDATE from ITEM)  ITEM

LEFT JOIN ITEM_AUTHOR 
    ON ITEM.ID=ITEM_AUTHOR.ITEMID 
LEFT JOIN CAT_DIC_AUTHOR 
    ON ITEM_AUTHOR.AUTHORID=CAT_DIC_AUTHOR.ID 
LEFT JOIN ITEM_PUBLISHER 
    ON ITEM.ID=ITEM_PUBLISHER.ITEMID 
LEFT JOIN CAT_DIC_PUBLISHER 
    ON ITEM_PUBLISHER.PUBLISHERID=CAT_DIC_PUBLISHER.ID 
LEFT JOIN ITEM_KEYWORD 
    ON ITEM.ID=ITEM_KEYWORD.ITEMID 
LEFT JOIN CAT_DIC_KEYWORD 
    ON ITEM_KEYWORD.KEYWORDID=CAT_DIC_KEYWORD.ID 
LEFT JOIN ITEM_LANGUAGE 
    ON ITEM.ID=ITEM_LANGUAGE.ITEMID 
LEFT JOIN CAT_DIC_LANGUAGE 
    ON ITEM_LANGUAGE.LANGUAGEID=CAT_DIC_LANGUAGE.ID 
LEFT JOIN ITEM_SH 
    ON ITEM.ID=ITEM_SH.ITEMID 
LEFT JOIN CAT_DIC_SH 
    ON ITEM_SH.SHID=CAT_DIC_SH.ID 
LEFT JOIN CAT_DIC_ITEM_TYPE 
    ON ITEM.TYPEID=CAT_DIC_ITEM_TYPE.ID 
where r>100 and r<=200
于 2012-12-14T08:28:21.637 回答