0

我有一个查询,它提取了许多 API 的性能测量值,以及我想随着时间的推移将它们保存到一个文件夹中的不同文件中。说每小时一次运行和一个输出文件。

Invantive 脚本语句

local export results as "${exportfilename}" format xml

exportfilename正确设置后可以执行此操作。

column ... new_value使用 Oracle SQL*Plus,您可以使用语法将查询结果存储在变量中。

如何exportfile使用 Invantive SQL 查询的结果进行设置?

4

1 回答 1

0

解决方案是使用如下${outcome:row,column}语法:

local define outfolder "c:\temp"

select sdy3.value || '-' || lpad(year(sysdate), 4, '0') || lpad(month(sysdate), 2, '0') || lpad(day(sysdate), 2, '0') || lpad(hour(sysdate), 2, '0') || lpad(minute(sysdate), 2, '0') ||'.xml' file_name
from   exactonlinerest..systemdatacontainerproperties sdy1
join   exactonlinerest..systemdatacontainerproperties sdy2
on     sdy2.data_container_alias = 'default'
and    sdy2.name = 'provider-description'
join   exactonlinerest..systemdatacontainerproperties sdy3
on     sdy3.data_container_alias = 'default'
and    sdy3.name = 'provider-short-name'
where  sdy1.data_container_alias = 'default'
and    sdy1.name = 'data-container-id'

local define exportfilename "${outfolder}\${outcome:0,0}"

<<< Run actual SQL>>>

local export results as "${exportfilename}" format xml

${outcome:...,...}语法将相应行号 (0..max) 和列号 (0..max) 的字符串表示形式作为值放入指定的变量名称中。

于 2016-11-30T17:28:18.223 回答