Lets Take Final touch on this...
The Following query will also work:
SELECT exp(sum(ln(num))) from test;
Have A great Day!!!
Thanks & Regards
Rajeev Sharma
R-Systems International
+919911755571
-----Original Message-----
From: Chelur Jayadas
[mailto:oracledba-ezmlmshield-x79983015.[Email address protected]
Sent: Friday, February 08, 2008 11:46 PM
To: LazyDBA Discussion
Subject: Another Friday Question
Hi Ed,
Here is a Friday question for you. This time it is in SQL (I am just a
developer, so pardon me for the blasphemy!).
Consider a table TEST having a single column called num which is of
dataype NUMBER. Assuming that the table has 5 rows, and all have
positive integers in the num column. There are no NULLs.
If one has to find the total of the num column for all the rows of the
table, it is quite simple. Use the aggregate function SUM().
But, if one has to find the product of the num column, how would you do
it ?
(It has to be done in a SQL query, and NOT a PL/SQL script or procedure)
Regards,
Jayadas
Here is the script to create the test environment :-
/* DROP TABLE TEST; */
CREATE TABLE TEST
(
num NUMBER NOT NULL
);
INSERT INTO TEST VALUES (1);
INSERT INTO TEST VALUES (2);
INSERT INTO TEST VALUES (3);
INSERT INTO TEST VALUES (4);
INSERT INTO TEST VALUES (5);
COMMIT;
---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post a
dba job: http://jobs.lazydba.com To Subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
--
This message has been scanned for viruses and dangerous content by
MailScanner, and is believed to be clean.
Oracle LazyDBA home page