Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Problem With Merge Statement
On 5 Apr 2006 15:08:30 -0700, pankaj_wolfhunter_at_yahoo.co.in wrote:
>MERGE INTO ext_category t_dest
>USING ( SELECT * FROM category) t_src
>ON (t_dest.name = t_src.name
> and t_dest.exp_date IS NULL
> and t_dest.exp_time IS NULL
> )
>WHEN MATCHED THEN
> UPDATE SET t_dest.exp_date=t_src.exp_date,
>t_dest.exp_time=t_src.exp_time
>WHEN NOT MATCHED THEN
> INSERT(name, exp_date, exp_time, flg)
> VALUES(t_src.name, t_src.exp_date, t_exp_time, t_src.flg);
>
>But its giving me the error that I cannot update the columns referenced
>
>in ON clause.
>
>Can anyone please tell me a workaround. I'll be happy if it's still
>possible to
>do it using MERGE statement or any other workaround?
No workaround needed if you would try to understand the error message and adjust the statement accordingly.
-- Sybrand Bakker, Senior Oracle DBAReceived on Thu Apr 06 2006 - 00:09:06 CDT