Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: aggregate and update

Re: aggregate and update

From: Malcolm Dew-Jones <yf110_at_vtn1.victoria.tc.ca>
Date: 3 Feb 2005 16:38:52 -0800
Message-ID: <4202c41c@news.victoria.tc.ca>


Jan van Veldhuizen (jan_at_van-veldhuizen.nl) wrote:
: I am trying to update a table with aggregate values without creating a view.
: I am having more complicated tables, but I will show what am doing with some
: simple tables:

: create table counters (name varchar(10), cnt int);
: create table test (name varchar(10), val int);

: insert into counters values('john', 0);
: insert into counters values('peter', 0);
: insert into counters values('david', 0);

: insert into test values('john', 1);
: insert into test values('john', 3);
: insert into test values('peter', 10);

: I want to calculate the sum of the val column and store it in the cnt column
: of the counters table.
: And I want the cnt value of David to remain zero, and not nullified because
: it does not exists in the test table.

Can't you simply use NVL to convert null sums to zero?

--

This space not for rent.
Received on Thu Feb 03 2005 - 18:38:52 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US