Hello,
Shell Script
#! /bin/bash
sqlplus -s <username>/<passwd>@dbname << EOF
set echo on
set pagesize 0
set verify off
set lines 32000
set trimspool on
set feedback off
SELECT *
FROM <dbname>.<tablename1> tr
LEFT JOIN <tablename2> t2 ON t2.id2 = tr.id1
LEFT JOIN <tablename3> t3 ON t3.id2 = tr.id1
LEFT JOIN <tablename4> t4 ON t4.id2 = tr.id1
WHERE tr.TIMESTAMP > SYSDATE - 75 / 1440
AND tr.TIMESTAMP <= SYSDATE - 15 / 1440
AND t2.value in ( value1, value2, etc...)
ORDER BY timestamp;
exit;
EOF
Now, the purpose is to read 32000 values in t2.value column. These values are only numbers like 1234,4567,1236, etc. I guess i should put these numbers in a separate file and then reading that file in t2.value. But i want the SQL to be excuted only once not 32000 times. can you please advise how is that possible ? How can i get the values (separated by commas) in t2.value (by some loop, reading line probably) ?