MERGE & ODBC

Connectivity
Enthusiast

MERGE & ODBC

Are there any restrictions using MERGE via ODBC? I have MERGE statement which returns an error:

"[NCR][ODBC Teradata Driver][Teradata Database] The search condition must fully specify the Target table primary index and partition column(s) and expression must match INSERT specfication primary index and partition column(s)."

But when I replaced placeholders with any values (e.g. "ON id = ?" replaced with "ON id = 1") then it works.
Tags (1)
4 REPLIES
Enthusiast

Re: MERGE & ODBC

The error appears to be from the Teradata SQL parser, so it is probably not specific to ODBC. Prior to 12.0, the syntax of the merge statement was rather limited. If you post the complete merge statement that you attempted and indicate which Teradata version you are using, I may be able to tell you more.
Enthusiast

Re: MERGE & ODBC

MERGE INTO JEZIORAOUT USING byleco
ON jezioraout.id = ?
WHEN MATCHED THEN UPDATE SET nazwa = 'E'
WHEN NOT MATCHED THEN INSERT ('E' , ? )

The problem is that Teradata need to have the same value in
"ON jezioraout.id = ?"
and in
"INSERT('E', ?)",
but there are placeholders so values can be different.

Is there any way to use placeholders in such statement?
Enthusiast

Re: MERGE & ODBC

I forgot: my Teradata version is 12.

Re: MERGE & ODBC

pls exclude the update of primery index and
add join condition for primary index.
i did that its working for me