我正在创建一个一次性过程,以从现有源更新目标表中新添加的列。我创建了更新语句,在SQLDeveloper中对其进行了测试,并确认它完全符合我的要求。但是,当我将此代码添加到过程任务中时,它给了我ORA-00933(SQL命令未正确结束)错误。我附加了有问题的sql语句以及对我选择的选项的一些解释。
已经完成:
尝试(没有区别):
目标命令:
UPDATE <%=odiRef.getSchemaName( "TARGET_SCHEMA", "D")%>.TARGET_TABLE target
SET NEW_COLUMN = (SELECT source.EXISTING_COLUMN
FROM <%=odiRef.getSchemaName( "SOURCE_SCHEMA", "D")%>.SOURCE_TABLE source
WHERE target.SOURCE_KEY = source.PRIM_KEY)
WHERE EXISTS (
SELECT 1
FROM <%=odiRef.getSchemaName( "SOURCE_SCHEMA", "D")%>.SOURCE_TABLE source
WHERE target.SOURCE_KEY = source.PRIM_KEY)
目标命令设置:
技术:Oracle
事务隔离:无变化
上下文:执行上下文
逻辑架构:TARGET_SCHEMA
交易:自动提交
提交:未定义
错误消息:
ODI-1217: Session POPULATE_TARGET_TABLE_NEW_FLAG (123456789) fails with return code 933.
ODI-1226: Step Populate_target_table_new_flag fails after 1 attempt(s).
ODI-1232: Procedure Populate_target_table_new_flag execution fails.
ODI-1228: Task Procedure-Populate_target_table_new_flag-Populate target table with New Flag fails on the target connection SOURCE_SCHEMA.
Caused By: java.sql.SQLSyntaxErrorException: ORA-00933: SQL command not properly ended
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:495)
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:447)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1055)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:624)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:253)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:613)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:214)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:38)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:891)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1194)
at oracle.jdbc.driver.OracleStatement.executeInternal(OracleStatement.java:1835)
at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:1790)
at oracle.jdbc.driver.OracleStatementWrapper.execute(OracleStatementWrapper.java:301)
at oracle.odi.runtime.agent.execution.sql.SQLCommand.execute(SQLCommand.java:208)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:142)
at oracle.odi.runtime.agent.execution.sql.SQLExecutor.execute(SQLExecutor.java:28)
at oracle.odi.runtime.agent.execution.TaskExecutionHandler.handleTask(TaskExecutionHandler.java:52)
at oracle.odi.runtime.agent.execution.SessionTask.processTask(SessionTask.java:216)
at oracle.odi.runtime.agent.execution.SessionTask.doExecuteTask(SessionTask.java:127)
at oracle.odi.runtime.agent.execution.AbstractSessionTask.execute(AbstractSessionTask.java:886)
at oracle.odi.runtime.agent.execution.SessionExecutor$SerialTrain.runTasks(SessionExecutor.java:2225)
at oracle.odi.runtime.agent.execution.SessionExecutor.executeSession(SessionExecutor.java:610)
at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor$1.doAction(TaskExecutorAgentRequestProcessor.java:718)
at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor$1.doAction(TaskExecutorAgentRequestProcessor.java:611)
at oracle.odi.core.persistence.dwgobject.DwgObjectTemplate.execute(DwgObjectTemplate.java:203)
at oracle.odi.runtime.agent.processor.TaskExecutorAgentRequestProcessor.doProcessStartAgentTask(TaskExecutorAgentRequestProcessor.java:800)
at oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor.access$2700(StartScenRequestProcessor.java:85)
at oracle.odi.runtime.agent.processor.impl.StartScenRequestProcessor$StartScenTask.doExecute(StartScenRequestProcessor.java:917)
at oracle.odi.runtime.agent.processor.task.AgentTask.execute(AgentTask.java:180)
at oracle.odi.runtime.agent.support.DefaultAgentTaskExecutor$2.run(DefaultAgentTaskExecutor.java:108)
at java.lang.Thread.run(Thread.java:748)
Caused by: Error : 933, Position : 331, Sql = UPDATE TARGET_TABLE target
SET NEW_COLUMN = (SELECT source.EXISTING_COLUMN
FROM SOURCE_SCHEMA.SOURCE_TABLE source
WHERE target.SOURCE_KEY = source.PRIM_KEY)
WHERE EXISTS (
SELECT 1
FROM SOURCE_SCHEMA.SOURCE_TABLE source
WHERE target.SOURCE_KEY = source.PRIM_KEY);, OriginalSql = UPDATE
TARGET_TABLE target
SET NEW_COLUMN = (SELECT source.EXISTING_COLUMN
FROM SOURCE_SCHEMA.SOURCE_TABLE source
WHERE target.SOURCE_KEY = source.PRIM_KEY)
WHERE EXISTS (
SELECT 1
FROM SOURCE_SCHEMA.SOURCE_TABLE source
WHERE target.SOURCE_KEY = source.PRIM_KEY);, Error Msg = ORA-00933: SQL command not properly ended
at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:499)
... 30 more
答案 0 :(得分:2)
所以问题并不是代码本身完全,但是事实是我没有在代码更改之间重新生成方案。我自己的错,我大多是通过ODI自学的,因此不打算尝试...
多亏了Marmite Bomber,您的意见才使我更加着眼于问题,并意识到,无论何时进行更改,“生成的”代码都没有更新。
答案 1 :(得分:0)
由于在发布的代码中我希望应该传递给Oracle的代码中的目标表所有者和table_name替换无效的字符,因此我怀疑生成的SQL不正确。无论如何,您可以捕获传递给Oracle的代码吗?