SSIS 命令行 - ORA-00907: 缺少右括号
SSIS Command line - ORA-00907: missing right parenthesis
我正在尝试从命令行 运行 一个 SSIS 包,但我一直收到这个
"ORA-00907: missing right parenthesis".
来自 SSDT 的包 运行 很好,我使用的查询也很简单。我确实尝试在 运行 时将值传递给查询。
变量声明:
我的查询使用表达式:
"SELECT country_id, city_id, name FROM cities where instr('" + @[User::p_cityID] + "' || ',', city_id || ',') > " + @[User::p_count]
最终查询:(运行很好)
SELECT country_id, city_id, name FROM cities where instr('DUBAI' || ',', city_id || ',') > 0
套餐调用:
Begin
declare @p_cityId varchar(10) = 'DUBAI'
declare @p_count varchar(10) = '0'
declare @query varchar(4000) =
'"C:\Program Files (x86)\Microsoft SQL Server0\DTS\Binn\DTExec.exe" /FILE C:\SSIS\pmtCity.dtsx /decrypt <mypass> /reporting V > C:\SSIS\log\citylog_'+
(replace(replace(replace(replace(convert(varchar(23), getdate(), 121),'-',''),':',''),' ',''),'.','')) +'.txt'
+ ' /SET \Package.Variables[p_cityID].Value;''' + @p_cityId + ''''
+ ' /SET \Package.Variables[p_count].Value;''' + @p_count + ''''
print @query
exec xp_cmdshell @query
End
我认为您遇到了 single/double 引号问题。尝试以下命令:
Begin
declare @p_cityId varchar(10) = 'DUBAI'
declare @p_count varchar(10) = '0'
declare @query varchar(4000) =
'"C:\Program Files (x86)\Microsoft SQL Server0\DTS\Binn\DTExec.exe" /FILE C:\SSIS\pmtCity.dtsx /decrypt <mypass> /reporting V > C:\SSIS\log\citylog_'+
(replace(replace(replace(replace(convert(varchar(23), getdate(), 121),'-',''),':',''),' ',''),'.','')) +'.txt'
+ ' /SET \Package.Variables[p_cityID].Value;"' + @p_cityId + '"'
+ ' /SET \Package.Variables[p_count].Value;"' + @p_count + '"'
print @query
exec xp_cmdshell @query
End
也尝试删除变量值周围的引号:
Begin
declare @p_cityId varchar(10) = 'DUBAI'
declare @p_count varchar(10) = '0'
declare @query varchar(4000) =
'"C:\Program Files (x86)\Microsoft SQL Server0\DTS\Binn\DTExec.exe" /FILE C:\SSIS\pmtCity.dtsx /decrypt <mypass> /reporting V > C:\SSIS\log\citylog_'+
(replace(replace(replace(replace(convert(varchar(23), getdate(), 121),'-',''),':',''),' ',''),'.','')) +'.txt'
+ ' /SET \Package.Variables[p_cityID].Value;' + @p_cityId
+ ' /SET \Package.Variables[p_count].Value;' + @p_count
print @query
exec xp_cmdshell @query
End
我正在尝试从命令行 运行 一个 SSIS 包,但我一直收到这个
"ORA-00907: missing right parenthesis".
来自 SSDT 的包 运行 很好,我使用的查询也很简单。我确实尝试在 运行 时将值传递给查询。
变量声明:
我的查询使用表达式:
"SELECT country_id, city_id, name FROM cities where instr('" + @[User::p_cityID] + "' || ',', city_id || ',') > " + @[User::p_count]
最终查询:(运行很好)
SELECT country_id, city_id, name FROM cities where instr('DUBAI' || ',', city_id || ',') > 0
套餐调用:
Begin
declare @p_cityId varchar(10) = 'DUBAI'
declare @p_count varchar(10) = '0'
declare @query varchar(4000) =
'"C:\Program Files (x86)\Microsoft SQL Server0\DTS\Binn\DTExec.exe" /FILE C:\SSIS\pmtCity.dtsx /decrypt <mypass> /reporting V > C:\SSIS\log\citylog_'+
(replace(replace(replace(replace(convert(varchar(23), getdate(), 121),'-',''),':',''),' ',''),'.','')) +'.txt'
+ ' /SET \Package.Variables[p_cityID].Value;''' + @p_cityId + ''''
+ ' /SET \Package.Variables[p_count].Value;''' + @p_count + ''''
print @query
exec xp_cmdshell @query
End
我认为您遇到了 single/double 引号问题。尝试以下命令:
Begin
declare @p_cityId varchar(10) = 'DUBAI'
declare @p_count varchar(10) = '0'
declare @query varchar(4000) =
'"C:\Program Files (x86)\Microsoft SQL Server0\DTS\Binn\DTExec.exe" /FILE C:\SSIS\pmtCity.dtsx /decrypt <mypass> /reporting V > C:\SSIS\log\citylog_'+
(replace(replace(replace(replace(convert(varchar(23), getdate(), 121),'-',''),':',''),' ',''),'.','')) +'.txt'
+ ' /SET \Package.Variables[p_cityID].Value;"' + @p_cityId + '"'
+ ' /SET \Package.Variables[p_count].Value;"' + @p_count + '"'
print @query
exec xp_cmdshell @query
End
也尝试删除变量值周围的引号:
Begin
declare @p_cityId varchar(10) = 'DUBAI'
declare @p_count varchar(10) = '0'
declare @query varchar(4000) =
'"C:\Program Files (x86)\Microsoft SQL Server0\DTS\Binn\DTExec.exe" /FILE C:\SSIS\pmtCity.dtsx /decrypt <mypass> /reporting V > C:\SSIS\log\citylog_'+
(replace(replace(replace(replace(convert(varchar(23), getdate(), 121),'-',''),':',''),' ',''),'.','')) +'.txt'
+ ' /SET \Package.Variables[p_cityID].Value;' + @p_cityId
+ ' /SET \Package.Variables[p_count].Value;' + @p_count
print @query
exec xp_cmdshell @query
End