正是标题所要求的。我正在浏览一些Ada代码并遇到了
SELECT
Id_P ,
Monthindex ,
(
SELECT
100 * (STDEV(ResEligible.num_valid) / AVG(ResEligible.num_valid)) AS Pre_Coef_Var
FROM
tbl_p a CROSS APPLY
(
SELECT
e.Monthindex ,
e.num AS num_valid
FROM
dbo.tbl_p e
WHERE
e.Monthindex = a.MonthIndex
AND e.Id_P = a.Id_P
UNION ALL
SELECT DISTINCT
B1.[MonthIndex ] ,
Tr.num AS num_valid
FROM
#tbl_pr B1
INNER JOIN
#tbl_pr B2
ON
B1.[Id_P] = B2.[Id_P]
AND B2.Rang - B1.Rang BETWEEN 0 AND 2
INNER JOIN
dbo.tbl_p Tr
ON
Tr.Id_P = B1.Id_P
AND Tr.Monthindex = B1.Monthindex
WHERE
a.Id_P = B1.[Id_P]
AND B2.[MonthIndex] =
(
SELECT
MAX([MonthIndex])
FROM
#tbl_pr
WHERE
[MonthIndex] < a.MonthIndex
AND [Id_P] = a.Id_P) ) AS ResEligible
WHERE
a.Id_P = result.Id_P
AND a.MonthIndex = result.MonthIndex) AS Coeff
FROM
tbl_p AS result
WHERE
1 = 1
AND MonthIndex = @CurrentMonth
GROUP BY
Id_P ,
Monthindex) AS CC
是什么意思?像C ++模板参数一样吗?
答案 0 :(得分:5)
Ada中的通用名称是package
,procedure
或function
,
具有一个或多个形式参数。形式参数可以是对象,类型,包或子程序。实例化泛型时,必须为所有形式参数提供实际值。
generic
type X is (<>); -- formal parameter
procedure Foo(Item : in X);
在此声明中,Foo
是泛型,X
是形式参数。 (<>)
意味着实例化Foo
时,X
的实际值必须是离散类型(有符号整数类型,模数类型或枚举类型):
procedure Bar is new Foo(Character);
Bar现在是通用过程Foo
的实例,可以用类型Character
的参数调用:
Bar('@');