Oracle的新手,但我不知道为什么这不起作用,我有点疯了。
我的查询工作正常,但只要我添加第三个连接语句,它就会给我以下错误消息:
这是我的查询。一切看起来都拼写正确,表格和列都存在。 TS_ORDER_SEC_SPEC目录中只有一条记录
错误:
Number: 904
ErrorMessage: ORA-00904: "OSS"."ORDER_ID": invalid identifier
SQL:
select
o.from_crrncy as from_crrncy
, o.to_crrncy as to_crrncy
, o.trade_date as trade_date
, o.settle_date as settle_date
, o.order_id as order_id
, oa.exec_broker as oaexecbroker
, o.target_crrncy as given_ccy
From ts_order o
inner join ts_order_alloc oa on oa.order_id = o.order_id
inner join TS_ORDER_SEC_SPEC oss on oss.order_id = o.order_id
答案 0 :(得分:5)
从你的图片看,你似乎有小写列;试试引用:
select
o.from_crrncy as from_crrncy
, o.to_crrncy as to_crrncy
, o.trade_date as trade_date
, o.settle_date as settle_date
, o.order_id as order_id
, oa.exec_broker as oaexecbroker
, o.target_crrncy as given_ccy
From ts_order o
inner join ts_order_alloc oa on oa.order_id = o.order_id
inner join TS_ORDER_SEC_SPEC oss on oss."order_id" = o.order_id
在Oracle中创建对象时要小心;看一个例子:
SQL> create table noCase ( col number);
Table created.
SQL> select col from noCase;
no rows selected
SQL> select COL from noCase;
no rows selected
SQL> create table lowerCase ( "col" number);
Table created.
SQL> select col from lowerCase;
select col from lowerCase
*
ERROR at line 1:
ORA-00904: "COL": invalid identifier
SQL> select COL from lowerCase;
select COL from lowerCase
*
ERROR at line 1:
ORA-00904: "COL": invalid identifier
SQL> select "col" from lowerCase;
no rows selected
SQL> select "COL" from lowerCase;
select "COL" from lowerCase
*
ERROR at line 1:
ORA-00904: "COL": invalid identifier