shell sql 顺序执行命令
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了shell sql 顺序执行命令相关的知识,希望对你有一定的参考价值。
#!/bin/bash
echo "clear start....."
DATE=$1:-`date -d "6 months ago" +'%Y-%m-%d'`
echo "clear befor $DATE data "
sqlplus system/oracle<<EOF
--select a."index" from DEV_SOAINFRA."test_clear" a where a."date"<TO_DATE('$DATE', 'YYYY-mm-dd');
--DELETE DEV_SOAINFRA."test_clear" A WHERE A."date"<TO_DATE('$DATE', 'YYYY-mm-dd');
--COMMIT;
delete from DEV_SOAINFRA.composite_instance ci where ci.ecid in (select t.ecid from DEV_SOAINFRA.cube_instance t WHERE t.creation_date < to_date('$DATE','YY
YY-mm-dd'));
commit;
delete from DEV_SOAINFRA.cube_scope cs where cs.cikey in (select t.cikey from DEV_SOAINFRA.cube_instance t WHERE t.creation_date < to_date('$DATE','YYYY-mm-
dd'));
commit;
delete from DEV_SOAINFRA.audit_trail at where at.cikey in (select t.cikey from DEV_SOAINFRA.cube_instance t WHERE t.creation_date < to_date('$DATE','YYYY-mm
-dd'));
commit;
delete from DEV_SOAINFRA.audit_details ad where ad.cikey in (select t.cikey from DEV_SOAINFRA.cube_instance t WHERE t.creation_date < to_date('$DATE','YYYY-
mm-dd'));
commit;
delete from DEV_SOAINFRA.cube_instance t WHERE t.creation_date < to_date('$DATE','YYYY-mm-dd');
commit;
exit;
EOF
我想知道 这里面的sql 是按顺序执行的吗
如果不是,怎么才能让其按顺序执行(从上至下)
如果使用了if else 或者while true那就 要注意了,如果看
是否满足条件,由条件决定执行的顺序。 参考技术A 是顺序执行的
以上是关于shell sql 顺序执行命令的主要内容,如果未能解决你的问题,请参考以下文章