Five Stars

Querry fails in cMessageEndpoint

Why does this querry fails with this error?

"sql:UPDATE TLD_VP_DIM_CONTRACTS SET TLD_INSERT_DATE = (CURRENT_TIMESTAMP) WHERE ID =:#CONTRACT_ID?dataSource=myDataSource"
, StackTrace: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: ORA-00904: "URRENT_TIMESTAMPHERE": invalid identifier

	at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231)
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:645)
...

But this querry doesnt fail:

"sql:UPDATE TLD_VP_DIM_CONTRACTS SET TLD_INSERT_DATE = (CURRENT_TIMESTAMP) WHERE ID =261?dataSource=myDataSource"

And the header in both cases

Headers: {breadcrumbId=ID:<xxx>, CamelSqlRowCount=1, CONTRACT_ID=261,
12 REPLIES
Eight Stars

Re: Querry fails in cMessageEndpoint

Hi,

 

Could you try this syntax ?

"sql:UPDATE TLD_VP_DIM_CONTRACTS SET TLD_INSERT_DATE = (CURRENT_TIMESTAMP) WHERE ID =:#${header.CONTRACT_ID}?dataSource=myDataSource"

 

Eric

Five Stars

Re: Querry fails in cMessageEndpoint

Fails with the same error.

Eight Stars

Re: Querry fails in cMessageEndpoint

It works on mine... My studio version is 6.2.1 and my camel version is 2.16.3. What are yours ?

Five Stars

Re: Querry fails in cMessageEndpoint

how do I see Camel Version?
Five Stars

Re: Querry fails in cMessageEndpoint

Talend 6.3.1
Eight Stars

Re: Querry fails in cMessageEndpoint

Regarding camel version, you can see it in module view (Pick up any camel module)

Five Stars

Re: Querry fails in cMessageEndpoint

Camel-aws-2.17.jar
Eight Stars

Re: Querry fails in cMessageEndpoint

What is your ID field type in database ? String ? Integer ?

Five Stars

Re: Querry fails in cMessageEndpoint

Number(8,0)
Five Stars

Re: Querry fails in cMessageEndpoint

Works

"sql:UPDATE TLD_VP_DIM_CONTRACTS SET TLD_INSERT_DATE = (CURRENT_TIMESTAMP) WHERE ID ='261'?dataSource=myDataSource"
"sql:UPDATE TLD_VP_DIM_CONTRACTS SET TLD_INSERT_DATE = (CURRENT_TIMESTAMP) WHERE ID =261?dataSource=myDataSource"

Doesn't work

"sql:UPDATE TLD_VP_DIM_CONTRACTS SET TLD_INSERT_DATE = (CURRENT_TIMESTAMP) WHERE ID =:#${header.CONTRACT_ID}?dataSource=myDataSource"
"sql:UPDATE TLD_VP_DIM_CONTRACTS SET TLD_INSERT_DATE = (CURRENT_TIMESTAMP) WHERE ID =:#CONTRACT_ID?dataSource=myDataSource"
Five Stars

Re: Querry fails in cMessageEndpoint

Is this a bug and something for Talend Support to solve ?
Five Stars

Re: Querry fails in cMessageEndpoint

A collegue pointed out the solution. The problem were the empty spaces around '='.