查询返回setof - 更新数据

时间:2016-02-06 09:17:53

标签: sql postgresql sql-update stored-functions

我有Postgres函数,返回setof。我可以使用 $.ajax({ type: "POST", url: "https://api.finicity.com/aggregation/v2/partners/authentication", dataType: "xml", contentType: "application/xml", data : '<credentials><partnerId>24455d81430647</partnerId><partnerSecret>v09TAUzbYgsfKnbTFOGn0</partnerSecret></credentials>', beforeSend: function (xhr) { xhr.setRequestHeader('Finicity-App-Key', 'a0874b0eda76ae7918c779f8eeef92c1a'); xhr.setRequestHeader('Content-Type', 'application/xml'); }, success: function(response){ alert(response); }, error: function(xhr,status,error){ alert("Error:" + JSON.stringify(xhr)); } }); 直接创建表格,但这不是我想要的。

INSERT INTO

我需要根据setof结果行更新现有表中的数据。我怎样才能做到这一点? 我需要像SELECT id, my_func() INSERT INTO data2

这样的东西

1 个答案:

答案 0 :(得分:2)

您没有告诉我们您的函数究竟返回了什么,但是这样的事情应该有效:

.serialize()

这假定函数返回两列,以便您可以针对函数结果加入目标表。