【发布时间】:2015-10-11 19:43:43
【问题描述】:
我有一个表格产品,其中有 8 列,我必须计算不同的值。为此,我需要创建一个存储过程。
那么,如何创建呢?
这是我为两列编写的示例:
create or replace
PROCEDURE GET_COUNT
( count_prod OUT INT,
count_partner OUT INT) IS
BEGIN
SELECT
count(*),
count(distinct(BUSINESS))
INTO
count_prod,
count_partner from Product where ACTIVE Like 'Y';
END GET_COUNT;
这是对的还是我必须使用光标来做?
【问题讨论】:
-
您想要每列的
count或distinct values或仅Business列。 [假设您使用的是oracle]
标签: sql sql-server tsql stored-procedures oracle11g