【发布时间】:2020-03-25 15:13:38
【问题描述】:
对于下面的需要将 SQL server 中的代码转换为 PostgresSQL。我确实尝试了与 SQL Server 中相同的方法,但它确实有效。
declare @ID table (ID int)
insert into MyTable(ID)
output inserted.ID into @ID
values (1)
所以上面的代码在 SQL Server 中运行良好,但在 Postgres 中它不起作用。
有人可以帮助将此代码转换为 Postgres 吗?也有人可以帮助我获得 Postgres 中带有 inout 和 out 参数的示例 SP。
【问题讨论】:
-
"Postgres 中带有 inout 和 out 参数的示例 SP" 不要在过程中使用 OUT 参数来返回某些内容。如果要返回某些内容,请使用函数。您需要接受 SQL Server 与 Postgres(或基本上任何其他 DBMS)非常不同Migrate your mindset too
标签: postgresql stored-procedures