All Forums Connectivity
piotrs 10 posts Joined 08/09
11 May 2010
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.

Jim Chapman 449 posts Joined 09/04
14 May 2010

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.

piotrs 10 posts Joined 08/09
19 May 2010

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?

piotrs 10 posts Joined 08/09
19 May 2010

I forgot: my Teradata version is 12.

23 Mar 2011

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

You must sign in to leave a comment.