sqldeveloper で oracle クエリを実行しています。
merge into invoices c using (select CUSTOMER_ID, INVOICE_NUMBER, INVOICE_DATE from dual where INVOICE_NUMBER = '123'
and CUSTOMER_ID = '456' and INVOICE_DATE = '19-APR-12') cd
on (c.INVOICE_NUMBER = cd.INVOICE_NUMBER)
when not matched then
insert (c.CUSTOMER_ID, c.INVOICE_NUMBER, c.INVOICE_DATE)
values ('987', '654','179-APR-12')
RA-00904 INVOICE_DATE 列が存在するにもかかわらず、RA-00904 無効な識別子を取得し続けます。describe invoices コマンドを実行し、実際に列名をコピーして確認しました。
describe invoices;
Name
----------------
CUSTOMER_ID
INVOICE_NUMBER
INVOICE_DATE
何が起きてる?
解像度
ヴァディムとジャスティンは正しいです。dual をテーブル名に置き換えることで問題を修正しました。
merge into invoices c using (select CUSTOMER_ID, INVOICE_NUMBER, INVOICE_DATE from invoices where INVOICE_NUMBER = '123'
and CUSTOMER_ID = '456' and INVOICE_DATE = '19-APR-12') cd
on (c.INVOICE_NUMBER = cd.INVOICE_NUMBER)
when not matched then
insert (c.CUSTOMER_ID, c.INVOICE_NUMBER, c.INVOICE_DATE)
values ('987', '654','179-APR-12')