SQL编译错误:表达式类型与列数据类型不匹配,期望为VARIANT,但列ATTRIBUTES为VARCHAR(3038)。有人可以帮助您更正查询吗?
MERGE INTO "W_TESTTABLE" T USING (SELECT * FROM (VALUES ('{"type":"issue__c", "url":"/services/data/v42.0"}','a0E2v00001jiirTEAQ','00590000005myFsAAI','false','test account','2019-12-18T14:15:06.000000+05:30','00590000005myFsAAI','2019-12-18T14:15:06.000000+05:30','00590000005myFsAAI','2019-12-18T14:15:06.000000+05:30',NULL,'2019-12-18T14:15:07.000000+05:30','2019-12-18T14:15:07.000000+05:30',NULL,NULL,NULL,NULL,NULL) AS UNUSED_ALIAS ("ATTRIBUTES","ID","OWNERID","ISDELETED","NAME","CREATEDDATE","CREATEDBYID","LASTMODIFIEDDATE","LASTMODIFIEDBYID","SYSTEMMODSTAMP","LASTACTIVITYDATE","LASTVIEWEDDATE","LASTREFERENCEDDATE","ASSIGNED_BY__C","FIELD11111111111111111111111111111111111__C","RFIELD1111111111111111111111111111111111__C","ISSUE_ID__C","ORDERSTEST__C"))) S ON (T."ID" = S."ID") WHEN MATCHED THEN UPDATE SET T."ATTRIBUTES"=S."ATTRIBUTES",T."OWNERID"=S."OWNERID",T."ISDELETED"=S."ISDELETED",T."NAME"=S."NAME",T."CREATEDDATE"=S."CREATEDDATE",T."CREATEDBYID"=S."CREATEDBYID",T."LASTMODIFIEDDATE"=S."LASTMODIFIEDDATE",T."LASTMODIFIEDBYID"=S."LASTMODIFIEDBYID",T."SYSTEMMODSTAMP"=S."SYSTEMMODSTAMP",T."LASTACTIVITYDATE"=S."LASTACTIVITYDATE",T."LASTVIEWEDDATE"=S."LASTVIEWEDDATE",T."LASTREFERENCEDDATE"=S."LASTREFERENCEDDATE",T."ASSIGNED_BY__C"=S."ASSIGNED_BY__C",T."FIELD11111111111111111111111111111111111__C"=S."FIELD11111111111111111111111111111111111__C",T."RFIELD1111111111111111111111111111111111__C"=S."RFIELD1111111111111111111111111111111111__C",T."ISSUE_ID__C"=S."ISSUE_ID__C",T."ORDERSTEST__C"=S."ORDERSTEST__C" WHEN NOT MATCHED THEN INSERT ("ATTRIBUTES","ID","OWNERID","ISDELETED","NAME","CREATEDDATE","CREATEDBYID","LASTMODIFIEDDATE","LASTMODIFIEDBYID","SYSTEMMODSTAMP","LASTACTIVITYDATE","LASTVIEWEDDATE","LASTREFERENCEDDATE","ASSIGNED_BY__C","FIELD11111111111111111111111111111111111__C","RFIELD1111111111111111111111111111111111__C","ISSUE_ID__C","ORDERSTEST__C") VALUES (S."ATTRIBUTES",S."ID",S."OWNERID",S."ISDELETED",S."NAME",S."CREATEDDATE",S."CREATEDBYID",S."LASTMODIFIEDDATE",S."LASTMODIFIEDBYID",S."SYSTEMMODSTAMP",S."LASTACTIVITYDATE",S."LASTVIEWEDDATE",S."LASTREFERENCEDDATE",S."ASSIGNED_BY__C",S."FIELD11111111111111111111111111111111111__C",S."RFIELD1111111111111111111111111111111111__C",S."ISSUE_ID__C",S."ORDERSTEST__C")
我尝试为VALUES做PARSE_JSON
MERGE INTO "W_TESTTABLE" T USING (SELECT * FROM (VALUES (PARSE_JSON('{"type":"issue__c", "url":"/services/data/v42.0"}')....
但出现错误VALUES子句中的无效表达式[PARSE_JSON('{“ type”:“ issue__c”,“ url”:“ / services / data / v42.0 / sobjects / issue__c / a0E2v00001jiirTEAQ”}')]:
我能够成功插入查询
INSERT INTO DEMO_DB.public.W_TEST(ID, ATTRIBUTES) SELECT 2, PARSE_JSON('{"first_name":"Mickey","last_name":"Mouse"}')
但是我的要求是 MERGE查询
表架构 Schemapart1
答案 0 :(得分:0)
尝试下面的代码
ExampleDialog