From: | Melvin Davidson <melvin6925(at)gmail(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | Sachin Srivastava <ssr(dot)teleatlas(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Error in Update and Set statement |
Date: | 2016-01-20 14:37:13 |
Message-ID: | CANu8FiyUEGBQr4rGdQ94Nh0QhcAPX_2VopYzf+knDCh1uk8vRg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I believe the following will do what you want.
WITH poupd AS
(SELECT LINE_STATUS,
LINE_TYPE,
PROMISE_DATE,
LEAD_TIME,
ITEM_NUMBER,
ORDER_UOM_CODE,
ORDER_QTY
FROM ppo_master_detail ponum,
supplierdetail sd
WHERE ponum.subscriber_id = 65
AND ponum.row_number=sd.row_number
AND ponum.po_number=sd.po_number
AND ponum.company_id=sd.company_id
)
UPDATE ppo_master_detail pmd
SET LINE_STATUS = poupd.LINE_STATUS
LINE_TYPE = poupd.LINE_TYPE
PROMISE_DATE = poupd.PROMISE_DATE
LEAD_TIME = poupd.LEAD_TIME
ITEM_NUMBER = poupd.ITEM_NUMBER
ORDER_UOM_CODE = poupd.ORDER_UOM_CODE
ORDER_QTY = poupd.ORDER_QTY
FROM pmd,
supplierdetail sdu
WHERE pmd.po_number =poupd.po_number
and pmd.company_id=poupd.company_id
and pmd.subscriber_id = 65
and pmd.row_number=sdu.row_number;
NOTE: Please avoid using uppercase and camelcase objects as PostgreSQL will
convert them to lowercase
unless you quote them.
On Wed, Jan 20, 2016 at 5:47 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
wrote:
> Hi
>
> 2016-01-20 11:45 GMT+01:00 Sachin Srivastava <ssr(dot)teleatlas(at)gmail(dot)com>:
>
>> Boss !!
>>
>> I am using postgres 9.4, so how to handle this.
>>
>>
> I don't know Ora2Pg - try to find some option to generate in old format -
> or manually rewrite to supported syntax
>
> UPDATE tab SET a = x.a, ... FROM x
>
> Regards
>
> Pavel
>
>
--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2016-01-20 15:00:16 | Re: Syntax error for Function |
Previous Message | Sachin Srivastava | 2016-01-20 14:32:40 | Re: Syntax error for Function |