我的ddl脚本如下:
CREATE TABLE CPR_ENTITIES
(
ENTITY_ID NUMBER(20) NOT NULL,
SYSTEM_ID NUMBER(4),
ENTITY_TYPE_ID NUMBER(8),
GLOBAL_UID VARCHAR2(1000),
SYS_OBJ_UID VARCHAR2(1000),
ENTITY_NAME VARCHAR2(1000),
CAGE_CODE VARCHAR2(2000),
REVISION VARCHAR2(2000),
ENTITY_CREATION_DATE NUMBER(20),
ENTITY_MODIFICATION_DATE NUMBER(20),
RELEASE_DATE NUMBER(20),
.......................,
........................
CONSTRAINT "CPR_ENTITIES_PK" PRIMARY KEY ("ENTITY_ID"),
CONSTRAINT "CPR_ENTITIES_FK1" FOREIGN KEY ("SYSTEM_ID") REFERENCES CPR_SOURCE_SYSTEM_METADATA("SYSTEM_ID"),
CONSTRAINT "CPR_ENTITIES_FK2" FOREIGN KEY ("ENTITY_TYPE_ID") REFERENCES CPR_ENTITY_METADATA("ENTITY_TYPE_ID"));
CREATE TABLE CPR_ENTITY_ATTRIBUTE
(
VAL_ID NUMBER(20) NOT NULL,
ENTITY_ID NUMBER(20),
ATT_ID NUMBER(10),
STRING_VALUE VARCHAR2(4000),
NUM_VALUE NUMBER(10,2),
TIMESTAMP_VALUE TIMESTAMP,
CREATED_BY VARCHAR2(200),
MODIFIED_BY VARCHAR2(200),
CREATED_ON NUMBER(20),
MODIFIED_ON NUMBER(20),
IS_DELETED VARCHAR2(1),
CONSTRAINT "CPR_ENTITY_ATTRIBUTE_PK" PRIMARY KEY ("VAL_ID"),
CONSTRAINT "CPR_ENTITY_ATTRIBUTE_FK1" FOREIGN KEY ("ENTITY_ID") REFERENCES CPR_ENTITIES("ENTITY_ID"),
CONSTRAINT "CPR_ENTITY_ATTRIBUTE_FK2" FOREIGN KEY ("ATT_ID") REFERENCES CPR_ENTITY_ATTRIBUTE_METADATA("ATT_ID")
);
加入表达:
SELECT CPR_ENTITIES.ENTITY_ID, CPR_ENTITY_ATTRIBUTE.STRING_VALUE
FROM CPR_ENTITIES
LEFT JOIN CPR_ENTITIES
ON CPR_ENTITIES.ENTITY_ID = CPR_ENTITY_ATTRIBUTE.ENTITY_ID;
给出错误:
第1行的错误:ORA-00904:" CPR_ENTITY_ATTRIBUTE"。" ENTITY_ID": 无效的标识符
答案 0 :(得分:0)
也许是这样的?
SELECT CPR_ENTITIES.ENTITY_ID, CPR_ENTITY_ATTRIBUTE.STRING_VALUE
FROM CPR_ENTITIES
LEFT JOIN CPR_ENTITY_ATTRIBUTE
ON CPR_ENTITIES.ENTITY_ID = CPR_ENTITY_ATTRIBUTE.ENTITY_ID;
答案 1 :(得分:0)
尝试
SELECT CPR_ENTITIES.ENTITY_ID, CPR_ENTITY_ATTRIBUTE.STRING_VALUE
FROM CPR_ENTITIES
LEFT JOIN CPR_ENTITY_ATTRIBUTE
ON CPR_ENTITIES.ENTITY_ID = CPR_ENTITY_ATTRIBUTE.ENTITY_ID;