除了选择字段,我想使用SQL代码来验证表[grlf_lig]是否存在,如何在notifyix上进行验证?
我使用Sheel代码进行验证,但是它很慢,因为它必须将文件记录在磁盘上并进行验证。
dbaccess sysmaster <<EOF > /dev/null 2> /dev/null
set isolation to dirty read;
unload to '$TMPFILE' delimiter "|"
select x0.sid,
x0.username,
x0.hostname,
x1.sqs_dbname,
dbinfo("UTC_TO_DATETIME",x0.connected) AS conn_dt
from
sysmaster:"informix".syssessions x0,
sysmaster:"informix".syssqlstat x1,
sysmaster:"informix".sysnetworkio n
where ( x0.sid = x1.sqs_sessionid ) and hostname is not NULL and
trim(hostname) <> ''
and trim(hostname) <> '-' AND sqs_dbname NOT LIKE 'sys%' AND sqs_dbname <>
'-' AND n.sid = x0.sid
EOF
for I in `cat $TMPFILE`; do
SID=`echo $I | awk -F'|' '{print $1}'`
BD=`echo $I | awk -F'|' '{print $4}'`
echo "" > $FILE
dbaccess $BD <<EOF > /dev/null 2> /dev/null
set isolation to dirty read;
unload to "$FILE" delimiter '|'
select first 1 sid_f_lig, max(dtlogin_f_lig), winuser_f_lig, tty_f_lig,
cod_capli from grlf_lig where
( sid_f_lig = '$SID' and dtlogout_f_lig is null )
group by sid_f_lig, winuser_f_lig, tty_f_lig, cod_capli
EOF
if [ -s $FILE ]; then
cat $FILE >> $FILE1
fi
done
我想快速获得结果,因为要花费很长时间才能获得结果。