当前位置: 代码迷 >> 综合 >> shell处理oracle或mysql
  详细解决方案

shell处理oracle或mysql

热度:35   发布时间:2024-02-07 06:51:55.0

处理oracle

a=`sqlplus -s 属主/密码@数据库  <<EOFset heading off feedback offselect 1+100 from dual;
exit;
EOF`
echo ${a} > test.txt

heading off // 回显时不显示前缀

feedback off // 回显不显示xxx rows selected. 

 

处理mysql

a=`mysql -h ip -P 端口 -u 用户名 -p 密码<<EOF${sql}
EOF`
echo ${a} > test.txt

 

  相关解决方案