SSIS 采用 oracle 变量并在 SSIS 结果集中使用它们

SSIS take oracle variable and use them in a ssis resultset

我的一个 ssis 包中有一个执行 sql 任务。我需要检查我的某些表中是否有值并将结果存储在 variable.I 中,然后需要稍后在我的包中使用这些变量。我的问题是如何将 sql 任务中的那些 oracle 变量分配给 ssis 包中的用户变量。

我有这样的东西:

Variable
s5 NUMBER 
variable s6 number 
variable s7 number 
begin
select count(*) into s5 from GC_somethin where rownum < 100;
select count(*) into s6 from GC_somethingabc where rownum < 100;
select count(*) into s7 from GC_dddcccc where rownum < 100;
END;
select s5 AS 's51' from dual;

我还将我的结果集固定为单行,在结果集中我有像 s51 这样的变量名和我分配给它的变量名。它给了我以下错误:

[Execute SQL Task] Error: An error occurred while assigning a value to variable "TSERVADD_AFTER": "Exception from HRESULT: 0xC0015005".

尝试使用 SSIS 变量而不是 Oracle。

  1. 创建 3 个变量,即。 s5, s6, s6 整数类型。
  2. 为每个查询创建执行Sql任务,将结果集设置为单行并将结果集分配给先前创建的变量。
  3. 在 SSIS 中使用填充变量。

当然,将您的查询重新格式化为:

select count(*) as s5 from GC_somethin where rownum < 100

Sql 单个 Sql 任务的语句:

with cte as(
select count(*) as s5, null as s6, null as s7 from GC_somethin 
union all 
select null as s5, count(*) as s6, null as s7 from GC_somethingabc 
union all
select null as s5, null as s6, count(*) as s7 from GC_dddcccc 
)
select max(s5) as s5, max(s6) as s6, max(s7) as s7 from cte