【发布时间】:2017-05-30 18:27:22
【问题描述】:
我正在尝试从我的 SAS 工作 libref 中的表进行左连接并从 Oracle 中提取,但它给出了错误消息。
这是我的代码:
PROC SQL;
connect to oracle(user=&usuario pass=&pass_dwhprd path='@dtm');
create table base_rateio1 (compress=yes reuse=yes) as
select B.* from connection to oracle
(select
A.*,
substr(B.exem_cod_sog_scv,3,4) projeto
from work.BASE_KPI3_2 A
left join exo_ing_ems@lkdwh B
where exem_cod_cia >= 1
and exem_cod_idt_fil >= 1
and A.apolice = B.exem_apo_num
and A.contrato = B.exem_ctrs_cod
and A.filial = B.exem_cod_idt_fil
and A.cod_cia = B.exem_cod_cia
and B.exem_ems_cod = 1
)
as t1;
disconnect from oracle;
quit;
这是错误信息:
ERROR: ORACLE prepare error: ORA-00905: missing keyword. SQL statement: select A.*, substr(B.exem_cod_sog_scv,3,4) projeto from
work.BASE_KPI3_2 A, left join exo_ing_ems@lkdwh B where exem_cod_cia >= 1 and exem_cod_idt_fil >= 1 and A.apolice =
B.exem_apo_num and A.contrato = B.exem_ctrs_cod and A.filial = B.exem_cod_idt_fil and A.cod_cia = B.exem_cod_cia and
exem_ems_cod = 1.
我真的不知道是什么问题
【问题讨论】:
-
您不能在连接语句中使用 SAS 工作表。您需要进行隐式传递或将 SAS 表移动到 Oracle,然后使用连接语句。
-
@Kiran 没有其他方法可以做到这一点吗?我无权将 SAS 表移至 Oracle。这就是我尝试这个左连接的原因。
-
那么您没有进行隐式传递。请参阅下面答案中的第三步
-
从上面...您缺少用于左连接的
ON语句。基于错误:ORA-00905: missing keyword