Reputation: 31
I am creating a one-time procedure to update a newly added column in a target table from an existing source. I created the update statement, tested it in SQLDeveloper, and confirmed it does exactly what I want. However, when I add this code into a procedure task, it is giving me an ORA-00933 (SQL Command not properly ended) error. I attached the sql statement in question along with some explanation of the options I am picking.
Already done:
Tried (no difference):
Target Command:
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)
Target Command Settings:
Technology: Oracle
Transaction Isolation: No Change
Context: Execution Context
Logical Schema: TARGET_SCHEMA
Transaction: Autocommit
Commit: Undefined
Error message:
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
Upvotes: 0
Views: 1829
Reputation: 31
So the issue wasn't exactly the code itself, but it was the fact that I was not regenerating my scenario in-between code changes. My own fault, I am mostly self taught in ODI and didn't think to try that...
Thanks to Marmite Bomber, your comment is what made me look into the problem more and realize the "generated" code wasn't updated any time I made a change.
Upvotes: 3
Reputation: 184
Since there are invalid characters in the posted code that I expect are supposed to be replaced by the target table owner and table_name in the code passed to Oracle for execution, I suspect the generated SQL is not correct. Is there anyway you can capture the code being passed to Oracle?
Upvotes: 0