linux下执行sql脚本

来源:互联网 发布:查询药品的软件 编辑:程序博客网 时间:2024/04/29 02:58
insert into del_piid (id) select first 100 piid from process_instance_b_t where state=3;delete from scope_instance_b_t where piid in(select id from del_piid);delete from activity_instance_b_t where piid in(select id from del_piid);delete from est_complaint_stat where mainid in(select mainid from complaint_link_stat l, complaint_main_stat m where l.operatetime<(select date(current)-63 from systables where tabid=1)and l.mainid=m.id and m.status=1);update EST_LAST_OPER set last_operate_time=(select last_operate_time from EST_LAST_OPER where id=52) where id=5201;

shell脚本调用sql脚本 : del_sql.sh
#!/bin/cshsource /opt/informix/.cshrcdbaccess bpedb /opt/eoms/informix/del.sql

informix sql 脚本:del.sql

linux定时执行存储过程,crontab 命令,存储过程在数据库中
#!/bin/cshsource /opt/informix/.cshrcdbaccess eoms35 /opt/eoms/informix/sync_canceltime_1d.sql

informix sql 脚本:sync_canceltime_1d.sql
execute procedure sp_local_sync_canceltime(120,4);


查询存储过程:

select * from sysprocedures where isproc='f' order by procname 
SELECT tabname, colname   FROM systables a, syscolumns b WHERE a.tabid = b.tabid and b.colname = 'procname'
SELECT data, seqno   FROM sysprocbody a, sysprocedures b WHERE a.procid = b.procid   AND b.procname = 'ikeyextractcolno'   AND datakey = 'T' ORDER BY seqno



查询linux下sql脚本文件
bash-3.00$ find /  -name *.sql


if [ $# -lt 1 ]thenexit 0fi/usr/sbin/kdb5_util dump /var/krb5/slave_datatransfor kdc in $*do/usr/lib/krb5/kprop -f /var/krb5/slave_datatrans $kdcdone