xcode使用sqlite3,如何检查数据库中存不存在某张表,请指点一下
1个回答
2015-02-10
展开全部
[root@yang testshell]# cat tabletest.sh
#!/bin/bash
su - oracle <<ok
fuckyou(){
sqlplus /nolog <<fuck
conn scott/yk123;
select table_name from user_tables;
exit;
fuck
}
fuckyou >>/home/oracle/output.txt;
exit
ok
#fuckyou >>/home/oralce/output.txt;
read -p "please input tablename: " -t 5 tablename
tn=$(echo ${tablename} |tr [a-z] [A-Z])
grep -l "${tn}" /home/oracle/output.txt && echo "the table ${tablename} exist.";
[root@yang testshell]#sh tabletest.sh
please input tablename: emp
/home/oracle/output.txt
the table emp exist.
[root@yang testshell]#
请仔细阅读。
#!/bin/bash
su - oracle <<ok
fuckyou(){
sqlplus /nolog <<fuck
conn scott/yk123;
select table_name from user_tables;
exit;
fuck
}
fuckyou >>/home/oracle/output.txt;
exit
ok
#fuckyou >>/home/oralce/output.txt;
read -p "please input tablename: " -t 5 tablename
tn=$(echo ${tablename} |tr [a-z] [A-Z])
grep -l "${tn}" /home/oracle/output.txt && echo "the table ${tablename} exist.";
[root@yang testshell]#sh tabletest.sh
please input tablename: emp
/home/oracle/output.txt
the table emp exist.
[root@yang testshell]#
请仔细阅读。
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询