我无法使用以下语法删除记录:
DELETE FROM "DB_NAME"."SCHEMA_NAME"."TABLE_NAME",LATERAL FLATTEN(INPUT => src:Records) rec WHERE Records.value:requestParameters:key is null;
请您帮我个好语法吗? 表源是一个变体表,如下所示:
{
"Records": [
{
"additionalEventData": {
"AuthenticationMethod": "xxxxxxxxxxxxxx",
"CipherSuite": "xxxxxxxxxxxxxxxxxx",
"SignatureVersion": "xxxxxxxxxxxx",
"bytesTransferredIn": xxxxxxxxxxxx,
...
答案 0 :(得分:1)
尝试以下模式:
delete from table_name a
using table_name b, lateral flatten(input => b.src:Records, recursive=>true) c
where a.src=b.src and c.key='key' and c.value::text is null
技巧是使用带有自连接的USING子句。 (递归选项不是必需的,只需相应地更新where子句即可。)