我有一个带有以下区域查询的 oracle 顶点表格形式
select APEX_ITEM.DATE_POPUP2(1,sysdate,'DD-MM-YYYY') DIV_DATE,
APEX_ITEM.TEXT(2,null ,10,15,'style="width:100px;text-align:right"') CREDIT
from dual
union
select APEX_ITEM.DATE_POPUP2(1,DIV_DATE,'DD-MM-YYYY') DIV_DATE,
APEX_ITEM.TEXT(2,CREDIT,10,15,'style="width:100px;text-align:right"') CREDIT
from DIVIDENT_REG
where code=:MCODE and memno=:MEMNO and brcode=:BRCODE
order by DIV_DATE desc
我希望结果以列 DIV_DATE 的顺序排列。但是上面的 order by 子句不起作用。所以我使用了代码
order by to_date(DIV_DATE) desc
但它显示一个错误
ORA-01785: ORDER BY 项目必须是 SELECT 列表表达式的编号
有没有人有解决这个问题的想法?
编辑:我不能选择
select div_date,credit from(
select APEX_ITEM.DATE_POPUP2(1,sysdate,'DD-MM-YYYY') DIV_DATE,
APEX_ITEM.TEXT(2,null ,10,15,'style="width:100px;text-align:right"') CREDIT
from dual
union
select APEX_ITEM.DATE_POPUP2(1,DIV_DATE,'DD-MM-YYYY') DIV_DATE,
APEX_ITEM.TEXT(2,CREDIT,10,15,'style="width:100px;text-align:right"') CREDIT
from DIVIDENT_REG
where code=:MCODE and memno=:MEMNO and brcode=:BRCODE
order by DIV_DATE desc )
因为它会删除我的 apex_item 的属性