1

クエリでエラーが発生します。このクエリはOKで、データを返します(selectsとrownumsはページネーション用です):

select *
from (select a.*, rownum rnum
from (select id_edition, id_document, name, extension, creation_date, url, 
(select inscription_date from edition_student_d0 where id_edition = 12345 and id_third =     12345) inscription_date
from upd_edition_doc_d0
where id_edition = 1071591
order by creation_date desc) a
where rownum <= 10 )
where rnum >= 1

今、私は「case when」を含めて、特定の状況でのみURLを取得しようとしているので、caseブロックを含めて次の変更を行います。

select *
from (select a.*, rownum rnum
from (select id_edition, id_document, name, extension, creation_date, 
(select inscription_date from edition_student_d0 where id_edition = 12345 and id_third = 12345) inscription_date,
case
when trunc(inscription_date + 90) <= trunc(sysdate) then null
else url
end url
from upd_edition_doc_d0
where id_edition = 1071591
order by creation_date desc) a
where rownum <= 10 )
where rnum >= 1

Oracleは次のエラーを起動します。

ORA-00904: "INSCRIPTION_DATE": invalid identifier

これは、inscription_dateを要求し、同じクエリレベルで使用しているためだと思いますが、これに対処する方法がわかりません。

また、自分が作ろうとしているものをどうやって作ることができますか?つまり、特定の条件下でのみURLを取得します。

誰でも助けることができますか?

前もって感謝します。

4

1 に答える 1