我正在尝试将数据插入/更新到表中但我得到的是ORA-00904 - 无效的标识符。
使用这样的表定义:
CREATE TABLE "TST"."R0_RL_EST_SHARE"
( "ID" NUMBER(19,0),
"BUILDING_SOCIETY_SHARE" CHAR(1 CHAR),
"EDITED_BY_USER" CHAR(1 CHAR),
"OBJECT_CREATED_ON" TIMESTAMP (6),
"OBJECT_TYPE" VARCHAR2(2048 CHAR),
"OBJECT_UPDATED_ON" TIMESTAMP (6),
"OBJECT_VERSION" NUMBER(19,0),
"REAL_ESTATE_SHARE_D" NUMBER(19,0),
"REAL_ESTATE_SHARE_N" NUMBER(19,0),
"MORTGAGE_OBJECT_ID" NUMBER(19,0),
"REAL_ESTATE_ID" NUMBER(19,0),
"SELLING_SHARE_OF_ID" NUMBER(19,0),
"PARTY_ID" NUMBER(19,0)
)
和
CREATE TABLE "TST"."PARTY_SHARE"
( "PARTY_ID" NUMBER(19,0),
"REAL_ESTATE_SHARE_ID" NUMBER(19,0)
)
两个表都有数千行。 TST.R0_RL_EST_SHARE中的PARTY_ID列为空 - 充满空值。我需要将PARTY_SHARE中的PARTY_ID数据插入到R0_RL_EST_SHARE,条件是R0_RL_EST_SHARE中的ID与PARTY_SHARE中的R0_RL_EST_SHARE_ID相同。
我尝试过很多东西,但它总是以ORA-00904结尾 - 标识符无效。
这是我的插页:
insert into R0_RL_EST_SHARE (PARTY_ID)
select PARTY_ID from PARTY_SHARE
where R0_RL_EST_SHARE.ID = PARTY_SHARE.REAL_ESTATE_SHARE_ID
及其错误代码:
Error starting at line : 6 in command -
insert into R0_RL_EST_SHARE (PARTY_ID)
select PARTY_ID from PARTY_SHARE
where "TST"."R0_RL_EST_SHARE".ID = PARTY_SHARE.REAL_ESTATE_SHARE_ID
Error at Command Line : 8 Column : 7
Error report -
SQL Error: ORA-00904: "TST"."R0_RL_EST_SHARE"."ID": neplatný identifikátor
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
感谢您的帮助......
答案 0 :(得分:2)
如果我正确理解您的问题,您实际上是在尝试update
您的数据,而不是insert
。
这是一种方式:
update R0_RL_EST_SHARE
set party_id = (
select party_id
from PARTY_SHARE
where R0_RL_EST_SHARE.id = PARTY_SHARE.REAL_ESTATE_SHARE_ID)