oracle----------取列数据的乘积
---------------------------------------------------------------建表
----------------判断表是否存在
declare num number;
begin
select count(1) into num from user_tables where table_name='TEST';
if num>0 then
execute immediate 'drop table TEST';
end if;
end;
----------------建表
CREATE TABLE TEST(
ValueCol numeric
);
----------------第一部分测试数据
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);
INSERT INTO TEST VALUES(6);
COMMIT;
--select * from test;
---------------------------------------------------------------行的乘积
select exp(sum(ln(ValueCol))) from TEST;
--------------- 删除实体
DROP TABLE TEST;
----------------判断表是否存在
declare num number;
begin
select count(1) into num from user_tables where table_name='TEST';
if num>0 then
execute immediate 'drop table TEST';
end if;
end;
----------------建表
CREATE TABLE TEST(
ValueCol numeric
);
----------------第一部分测试数据
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);
INSERT INTO TEST VALUES(6);
COMMIT;
--select * from test;
---------------------------------------------------------------行的乘积
select exp(sum(ln(ValueCol))) from TEST;
--------------- 删除实体
DROP TABLE TEST;
【推荐】2025 HarmonyOS 鸿蒙创新赛正式启动,百万大奖等你挑战
【推荐】博客园的心动:当一群程序员决定开源共建一个真诚相亲平台
【推荐】开源 Linux 服务器运维管理面板 1Panel V2 版本正式发布
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步