Home > Database > Mysql Tutorial > body text

ETL调度开发(5)连接数据库执行数据库命令子程序

WBOY
Release: 2016-06-07 16:00:01
Original
1190 people have browsed it

ETL调度中读写数据信息,都需要连接数据库,下面的子程序通过传入的数据库连接字符串和数据库命令(或SQL)执行所需要的操作: #!/usr/bin/bash#created by lubinsu#2014source ~/.bash_profilevalues=`sqlplus -S $1 EOF set heading off feedback off page

ETL调度中读写数据信息,都需要连接数据库,下面的子程序通过传入的数据库连接字符串和数据库命令(或SQL)执行所需要的操作:

#!/usr/bin/bash
#created by lubinsu
#2014
source ~/.bash_profile
values=`sqlplus -S $1 << EOF
  set heading off feedback off pagesize 0 verify off echo off
    WHENEVER SQLERROR exit SQL.SQLCODE ROLLBACK 
    $2
    commit;
    exit 
EOF`
echo "${values}"
Copy after login
参数的参数依次是:数据库连接字符串,数据库命令(或SQL语句)
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!