[A] tab_a (4+4+4) -> tab_b (12)
From: John Claxton <75363.640_at_CompuServe.COM>
Date: 1995/10/20
Message-ID: <468oht$oeb$1_at_mhadf.production.compuserve.com>#1/1
Date: 1995/10/20
Message-ID: <468oht$oeb$1_at_mhadf.production.compuserve.com>#1/1
There was a post here recently about a table with a column (type
varchar) populated by values like '4+4+4', '3+1', '1+9+22+3+4'.
The poster wanted to know if there was a way to insert the
calculated sums of the entries into another table.
Something like:
insert into table_b (calc_sums)
select arith_string from table_a;
I'm a sys admin, not any Oracle coder, so I asked by DBA if he
knew of any function within Oracle which might perform such a
function. He did not.
If you're in unix (VMS has a similar capability) you could:
(1) select the columns into a spool file (spool.fil)
(2) use a shell script with the unix 'bc' command
to calculate the sum (or other valid arithmetic function. Sample Shell Script: #!/bin/sh #set -x arith_string=`echo "${1}" bc << abcdefg $arith_string abcdefg
[ more to follow ] Received on Fri Oct 20 1995 - 00:00:00 CET