我正在尝试从2个单独的模式中收集数据。由于单个查询的复杂性将导致所有数据都会使数据库服务器崩溃,我制作了单独的表并用我需要的所有数据填充它们。现在我只需要合并数据并匹配列,以便以后可以删除任何重复的行。下面是我创建的两个查询,用于返回我要查找的结果。我的问题是,当我运行第二个查询时,我收到以下错误:
Error at Command Line:7 Column:4
Error report:
SQL Error: ORA-00904: "BOF_FOR_CHUCKSIMPSON"."BATCH_ID": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action
有人可以帮我理解发生了什么吗?
查询1
CREATE TABLE BOF_FOR_CHUCKSIMPSON AS
SELECT
bbp.SUBCAR "Treadwell", HMM.LADLE "BOTTLE CAR",
bbp.BATCH_ID "Batch ID",
TO_CHAR(bbp.START_POUR, 'yyyy/mm/dd hh24:MI:ss') "Start Pour Time",
TO_CHAR(bbp.END_POUR, 'yyyy/mm/dd hh24:MI:ss') "End Pour Time",
TO_CHAR(hmm.sched_cast_date, 'yyyy/mm/dd hh24:MI:ss') "Sched Cast Date"
FROM bof_batch_pour bbp, rouge.hmm_iron_cast_ladle@idbs1 hmm
WHERE bbp.subcar=hmm.ladle
AND TO_CHAR(hmm.sched_cast_DATE, 'yyyymmddhh24MIss') = TO_CHAR(bbp.SCHED_CAST_DATE, 'yyyymmddhh24MIss')
AND bbp.START_POUR>='25-MAY-11';
CREATE TABLE BOF_FOR_CHUCKSIMPSON2 AS
SELECT bofcs.BATCH_ID "Batch ID", bofcs.sample_time "Sample Time",
bcs.SILICON "Si", bcs.SULPHUR S, bcs.MANGANESE "Mn", bcs.PHOSPHORUS P,
bofcs.TEMPERATURE "Temperature"
FROM bof_chem_sample bcs, bof_celox_sample bofcs
WHERE bofcs.SAMPLE_CODE = bcs.SAMPLE_CODE
AND bofcs.BATCH_ID = bcs.BATCH_ID
AND bofcs.TEMPERATURE > 0
AND bcs.SAMPLE_CODE = 'D1'
AND bofcs.SAMPLE_CODE = bcs.SAMPLE_CODE
AND bofcs.sample_time>'25-may-11'
AND bofcs.sample_time<sysdate
查询2
merge into bof_FOR_cHUCKSIMPSON2
using bof_FOR_cHUCKSIMPSON
on (bof_FOR_cHUCKSIMPSON.batch_id=bof_FOR_cHUCKSIMPSON2.batch_id)
when matched
then
update
SET bof_FOR_cHUCKSIMPSON.BATCH_ID = bof_FOR_cHUCKSIMPSON2.bATCH_ID
WHEN NOT MATCHED
THEN
INSERT (bof_FOR_cHUCKSIMPSON2.bATCH_ID
VALUES (99999);
答案 0 :(得分:3)
您在create table语句中使用双引号中的混合大小写名称,如下所示:
bbp.BATCH_ID "Batch ID"
因此,您在该表中没有一个名为BATCH_ID的列,而是一个名为“批次ID”的列,它只能被引用 - 即大小写混合和双引号。