From: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: How to convert "output deleted/inserted into" in MySQL to Postgres |
Date: | 2015-02-20 22:06:07 |
Message-ID: | mc8b4j$903$1@ger.gmane.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Tong Michael wrote on 20.02.2015 21:59:
>
> hey guys, I'm kinda new to Postgres and I'm learning it now. I have work to convert some stored procedures in MySQL
>to Postgres and I came across an issue here that I can't solve:
>
> update db.user
> set Deleted = 1
> , UpdateTerminal = @UpdateTerminal
> , UpdateUser = @UpdateUser
> , UpdateDate = @UpdateDate
> output deleted.CreditTypeID
> , deleted.CreditID
> , deleted.Amount
> into @ReconDeleted
> where Deleted = 0
> and ClientID = @ClientID;
>
> I think it tried to update a couple of columns in table user and insert values in other 3 columns into another
>table ReconDeleted at the same time. I have issues converting "OUTPUT INTO" and "deleted" items,
>with my limited knowledge about Postgres, I don't think we have those in pg. Can someone tell me how to convert it?
That is not valid for MySQL it does not have an "OUTPUT DELETED" option for any DML statement.
Plus: MySQL does not have table variables.
The looks much more like SQL Server/T-SQL.
From | Date | Subject | |
---|---|---|---|
Next Message | Shanker Singh | 2015-02-20 22:26:27 | Re: parallel dump fails to dump large tables |
Previous Message | Paul Jungwirth | 2015-02-20 22:01:59 | Re: Re: How to convert "output deleted/inserted into" in MySQL to Postgres |