2

I have process data in this format in a txt file.

testTag testTag2

10 18

6 15

7 15

9 19

Please help me to build a SQLPlus script so that after every 5 seconds one of these values orderly should update IP_INPUT_VALUE field of testTag & testTag2.

Option to reschedule the query after every 5 seconds, can be used just in case required.

Please help.

iskbaloch
  • 187
  • 11

1 Answers1

2

This issue is resolved by myself after multiple attempts. All i had to do is changed the txt format to below format and run the query

      A                  B
    NAME               VALUE
 ----------------------------------------

 testTag        10      6       7       9


 testTag2       18      15      15      19

SQLPLus Query:

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;
JJIqbal
  • 630
  • 1
  • 8
  • 23
iskbaloch
  • 187
  • 11