sqlplus - 如何将 txt 文件中的数据查询到 AspenTech IP21 Historian?
问题描述
我在 txt 文件中有这种格式的过程数据。
测试标签 testTag2
10 18
6 15
7 15
9 19
请帮助我构建一个 SQLPlus 脚本,以便每 5 秒后,这些值中的一个值应按顺序更新 testTag 和 testTag2 的 IP_INPUT_VALUE 字段。
可以在每 5 秒后重新安排查询的选项,以备不时之需。
请帮忙。
解决方案
多次尝试后,我自己解决了这个问题。我所要做的就是将 txt 格式更改为以下格式并运行查询
A B
NAME VALUE
----------------------------------------
testTag 10 6 7 9
testTag2 18 15 15 19
SQLPLus 查询:
local tagname char(24);
local value real;
local x,y integer;
y=2;
for x = y to 5 do
wait 00:00:05.00;
for (select line as ln from 'c:\data\Data.txt') do
tagname = substring(1 of ln between' ');
value = substring (x of ln between ' ');
UPDATE ip_analogdef SET IP_INPUT_VALUE = value,
QSTATUS(IP_INPUT_VALUE) = 'Good'
where name=tagname;
y=y+1;
end;
end;
推荐阅读
- css - Reactjs材料ui选择具有怪异风格的对话框内的项目
- google-apps-script - 如何将自定义组合图导入 Google 表格?
- php - 如何让 PhpStorm 自动导入命名空间函数?
- c++ - virtual 关键字如何影响内存位置?
- kubernetes - 您如何增加 K3S 中每个节点的最大 pod 数?
- next.js - 请求过多,请稍后重试。Next JS 无后端
- java - 在桌面上创建 jar 链接
- windows-installer - Windows 安装程序:注册表读取奇怪的行为
- ruby-on-rails - 在 slim 中,如何在脚本顶部嵌入样式?
- python - 使用变量从导入的模块中获取列表