[askdba] Re: Update SQL

  • From: Abraham Kurian <kurian24@xxxxxxxxx>
  • To: askdba@xxxxxxxxxxxxx
  • Date: Fri, 11 Mar 2005 12:21:39 +0530

hi ,
I think its most likely to hit ORA-01427 

This is what i did .....

SQL> update emp b set b.deptno = (select a.deptno
  2  from dept a
  3  where a.deptno = b.deptno);

14 rows updated.

SQL> update emp b set (b.comm,b.sal) = ( select sum(b.comm) , sum(b.sal)
  2  from emp b
  3  group by empno , deptno);
update emp b set (b.comm,b.sal) = ( select sum(b.comm) , sum(b.sal)
                                    *
ERROR at line 1:
ORA-01427: single-row subquery returns more than one row

Regards
Kurian

On Thu, 10 Mar 2005 15:09:33 -0800, VuCanDo <vuquyen@xxxxxxxxx> wrote:
> what's wrong with this update SQL spy_mart 12.5 millions and
> spy_proc_prov 2.4 millions. It's take me 17 hours already and still
> going now on Oracle 9.2 Solaris Sun
> 
> update spy_proc_prov p
> set (p.paid_total,p.claim_ct) = (select sum(m.paid_amt),
> count(m.proc_cd) from spy_mart m where p.prov_id = m.prov_id and
> p.proc_cd=m.proc_cd group by prov_id, proc_cd)
> 
> Thanks,
> 
> Vu
> 
>

Other related posts: