我正在尝试将此更新语句添加到存储过程中,该存储过程前面有一些插入语句。当我尝试编译时,我得到了ORA-00933,但我没有看到任何问题。我会说我已经习惯了SQL Server,所以请原谅我,如果这对于Oracle的翻译来说是愚蠢的。
UPDATE
APEX_QC_TLINK_AGENTS
SET
I_FK_TLINK_TEAM = SHG_DATAW.APEX_QC_TLINK_TEAMS.I_SK_TLINK_TEAM
FROM
SHG_DATAW.APEX_QC_TLINK_AGENTS
LEFT JOIN
CMS_W_AGENT_DETAILS@SHG_SPECIALIST
ON
SHG_DATAW.APEX_QC_TLINK_AGENTS.A_FORENAME = CMS_W_AGENT_DETAILS.FIRST_NAME
AND
SHG_DATAW.APEX_QC_TLINK_AGENTS.A_SURNAME = CMS_W_AGENT_DETAILS.LAST_NAME
LEFT JOIN
SHG_DATAW.APEX_QC_TLINK_TEAMS
ON
CMS_W_AGENT_DETAILS.TEAM_NAME = SHG_DATAW.APEX_QC_TLINK_TEAMS.A_TEAMNAME
WHERE
SHG_DATAW.APEX_QC_TLINK_TEAMS.I_SK_TLINK_TEAM <> APEX_QC_TLINK_AGENTS.I_FK_TEAM;
如果有人需要,我可以提供(如果需要)整个存储过程。
一如既往地非常感谢:)
马库斯
答案 0 :(得分:1)
Oracle不支持SQL Server执行的UPDATE... FROM
构造。您应该使用MERGE statement代替。它应该是这样的:
MERGE INTO APEX_QC_TLINK_AGENTS A
USING
(
SELECT SHG_DATAW.APEX_QC_TLINK_TEAMS.I_SK_TLINK_TEAM
FROM
SHG_DATAW.APEX_QC_TLINK_AGENTS
LEFT JOIN
CMS_W_AGENT_DETAILS@SHG_SPECIALIST
ON
SHG_DATAW.APEX_QC_TLINK_AGENTS.A_FORENAME = CMS_W_AGENT_DETAILS.FIRST_NAME
AND
SHG_DATAW.APEX_QC_TLINK_AGENTS.A_SURNAME = CMS_W_AGENT_DETAILS.LAST_NAME
LEFT JOIN
SHG_DATAW.APEX_QC_TLINK_TEAMS
ON
CMS_W_AGENT_DETAILS.TEAM_NAME = SHG_DATAW.APEX_QC_TLINK_TEAMS.A_TEAMNAME
) B
ON (B.I_SK_TLINK_TEAM <> A.I_FK_TEAM)
WHEN MATCHED THEN
UPDATE SET A.I_FK_TLINK_TEAM = B.I_SK_TLINK_TEAM;