i_e_dpi_jt_create.tcl 调用 perl脚本【BI】

2016-07-20 19:04:29来源:CSDN作者:hzdxw人点击

-rw-r--r--   1 etl        users           45 Jun 29 18:35 zz_8115118_20160629_6182265_4131_20160629183555.sql-rw-r--r--   1 etl        users            0 Jul  3 18:37 zz_8115118_20160703_6200857_4131_20160703183709.dat-rw-r--r--   1 etl        users           45 Jul  3 18:37 zz_8115118_20160703_6200857_4131_20160703183709.sql-rw-r--r--   1 etl        users            0 Jul  4 18:38 zz_8115118_20160704_6205769_4131_20160704183811.dat-rw-r--r--   1 etl        users           45 Jul  4 18:38 zz_8115118_20160704_6205769_4131_20160704183811.sqlDJTMAAPP1[/biapp/aiinsight/bin/odsprod]$ls -l i_e_dpi_jt*-rw-r--r--   1 etl        users         5585 Mar 21 16:52 i_e_dpi_jt_create.pl-rw-r--r--   1 etl        users          682 Sep  9  2014 i_e_dpi_jt_create.tclDJTMAAPP1[/biapp/aiinsight/bin/odsprod]$ls -l fui*fui* not foundDJTMAAPP1[/biapp/aiinsight/bin/odsprod]$ls -l inte*-rwxr-xr-x   1 etl        users         1584 Sep  9  2014 internal_audit_m.shDJTMAAPP1[/biapp/aiinsight/bin/odsprod]$cat i_e_dpi_jt_create.tcl# **  功能描述:        集团dpi数据TD库建表# **  创建者:          齐洁# **  创建日期:        20140821# **  修改日志:# **  修改日期          修改人          修改内容        # ** -------------------------------------------------------------------------------------# **#*****************************************************************************************proc Deal {} {        global ARG_OPTIME        puts "OP_TIME=$ARG_OPTIME"                                if { [ catch { exec perl /biapp/aiinsight/bin/odsprod/i_e_dpi_jt_create.pl $ARG_OPTIME } msg] } {                        LogMsg "perl exec error" "${msg}"                         LogAgentMsg "4" "perl exec error!"                         return ""        }                LogMsg "exec" "program execute successfully...."    LogAgentMsg "3" "程序运行成功!"        return 0}DJTMAAPP1[/biapp/aiinsight/bin/odsprod]$cat i_e_dpi_jt_create.pl#*****************************************************************************************# **  文件名称:        i_e_dpi_jt_create.pl# **  功能描述:        TD库建表# **  创建者:          齐洁# **  创建日期:        20140821# **  修改日志:# **  修改日期:20150507                修改人:李翔            修改内容:删除老版DPI建表程序   # **  修改日期          修改人          修改内容        # ** -------------------------------------------------------------------------------------# **#*****************************************************************************************use strict;use DBI;my $OP_TIME;my $NEXT_OP_TIME;my $LAST_OP_TIME;if ( $#ARGV < 0 ) {   exit(1);}# Get the first argument$OP_TIME = $ARGV[0];my $dbh = DBI->connect('dbi:ODBC:testdsn', 'edadba', 'eda_2014');#get now datemy $sqlText = "select cast (cast(cast('$OP_TIME' as date format 'YYYYMMDD' )  +1 as format 'YYYYMMDD') as char(8) );";my $sth=$dbh->prepare($sqlText);$sth->execute();my $NEXT_OP_TIME=$sth->fetchrow();$sth->finish();#create tablemy $sqlText = "CREATE TABLE CTBJ_EDA_INTEG.I_E_DPI_CDR_JT_$OP_TIME as CTBJ_EDA_INTEG.I_E_DPI_CDR_JT_YYYYMMDD with no data ";my $sth=$dbh->do($sqlText);if (!defined($sth)) {        print "create table  Error;/n";}else{        print "create table Success;/n";}#create viewmy $sqlText = "REPLACE VIEW CTBJ_EDA_VIEW.I_E_DPI_CDR_JT_$OP_TIME AS LOCKING CTBJ_EDA_INTEG.I_E_DPI_CDR_JT_$OP_TIME FOR ACCESS  SELECT * FROM CTBJ_EDA_INTEG.I_E_DPI_CDR_JT_$OP_TIME;";my $sth=$dbh->do($sqlText);if (!$sth) {        #error;        print "create VIEW  Error;/n";}else{        print "create VIEW Success;/n";}#create tablemy $sqlText = "create table CTBJ_EDA_INTEG.DW_U_USER_360_VIEW_D_$OP_TIME as  CTBJ_EDA_INTEG.DW_U_USER_360_VIEW_D_YYYYMMDD with no data";my $sth=$dbh->do($sqlText);if (!defined($sth)) {        print "create table  Error;/n";}else{        print "create table Success;/n";}##############################################################################################################################20150507#create dpi table#my $sqlText = "create table CTBJ_EDA_INTEG.S_TD_DPI_W_$OP_TIME as  CTBJ_EDA_INTEG.S_TD_DPI_W_YYYYMMDD with no data";#my $sth=$dbh->do($sqlText);#if (!defined($sth)) #{#       print "create table  Error;/n";#}#else#{#       print "create table Success;/n";#}##create dpi_cdr table#my $sqlText = "create table CTBJ_EDA_INTEG.I_E_DPI_CDR_$OP_TIME as  CTBJ_EDA_INTEG.I_E_DPI_CDR_YYYYMMDD with no data";#my $sth=$dbh->do($sqlText);#if (!defined($sth)) #{#       print "create table  Error;/n";#}#else#{#       print "create table Success;/n";#}##################################################################################################################################create ACCOUNT tablemy $sqlText = "create table CTBJ_EDA_GAT.G_ACCOUNT_$OP_TIME as  CTBJ_EDA_GAT.G0_ACCOUNT_YYYYMMDD with no data";my $sth=$dbh->do($sqlText);if (!defined($sth)) {        print "create table  Error;/n";}else{        print "create table Success;/n";}#create ACCT_INFO_ORDER tablemy $sqlText = "create table CTBJ_EDA_GAT.G_ACCT_INFO_ORDER_$OP_TIME as  CTBJ_EDA_GAT.G0_ACCT_INFO_ORDER_YYYYMMDD with no data";my $sth=$dbh->do($sqlText);if (!defined($sth)) {        print "create table  Error;/n";}else{        print "create table Success;/n";}#create BUSI_ORDER tablemy $sqlText = "create table CTBJ_EDA_GAT.G_BUSI_ORDER_$OP_TIME as CTBJ_EDA_GAT.G0_BUSI_ORDER_YYYYMMDD with no data";my $sth=$dbh->do($sqlText);if (!defined($sth)) {        print "create table  Error;/n";}else{        print "create table Success;/n";}#create CUST_INFO_ORDER tablemy $sqlText = "create table CTBJ_EDA_GAT.G_CUST_INFO_ORDER_$OP_TIME as CTBJ_EDA_GAT.G0_CUST_INFO_ORDER_YYYYMMDD with no data";my $sth=$dbh->do($sqlText);if (!defined($sth)) {        print "create table  Error;/n";}else{        print "create table Success;/n";}#create OFFER_MEMBER tablemy $sqlText = "create table CTBJ_EDA_GAT.G_OFFER_MEMBER_$OP_TIME as CTBJ_EDA_GAT.G0_OFFER_MEMBER_YYYYMMDD with no data";my $sth=$dbh->do($sqlText);if (!defined($sth)) {        print "create table  Error;/n";}else{        print "create table Success;/n";}#create OFFER_ORDER tablemy $sqlText = "create table CTBJ_EDA_GAT.G_OFFER_ORDER_$OP_TIME as CTBJ_EDA_GAT.G0_OFFER_ORDER_YYYYMMDD with no data";my $sth=$dbh->do($sqlText);if (!defined($sth)) {        print "create table  Error;/n";}else{        print "create table Success;/n";}#create OFFER_SERV tablemy $sqlText = "create table CTBJ_EDA_GAT.G_OFFER_SERV_$OP_TIME as CTBJ_EDA_GAT.G0_OFFER_SERV_YYYYMMDD with no data";my $sth=$dbh->do($sqlText);if (!defined($sth)) {        print "create table  Error;/n";}else{        print "create table Success;/n";}#create ORDER_LIST tablemy $sqlText = "create table CTBJ_EDA_GAT.G_ORDER_LIST_$OP_TIME as CTBJ_EDA_GAT.G0_ORDER_LIST_YYYYMMDD with no data";my $sth=$dbh->do($sqlText);if (!defined($sth)) {        print "create table  Error;/n";}else{        print "create table Success;/n";}#create PARTY tablemy $sqlText = "create table  CTBJ_EDA_GAT.G_PARTY_$OP_TIME as  CTBJ_EDA_GAT.G0_PARTY_YYYYMMDD with no data";my $sth=$dbh->do($sqlText);if (!defined($sth)) {        print "create table  Error;/n";}else{        print "create table Success;/n";}#create PROD_ORDER tablemy $sqlText = "create table  CTBJ_EDA_GAT.G_PROD_ORDER_$OP_TIME as  CTBJ_EDA_GAT.G0_PROD_ORDER_YYYYMMDD with no data";my $sth=$dbh->do($sqlText);if (!defined($sth)) {        print "create table  Error;/n";}else{        print "create table Success;/n";}#disconnect            if(defined($dbh)){        $dbh->disconnect();        print "断开数据库连接/n";    }else{        print "断开数据库连接:数据库连接为空/n";    }DJTMAAPP1[/biapp/aiinsight/bin/odsprod]$DJTMAAPP1[/biapp/aiinsight/bin/odsprod]$DJTMAAPP1[/biapp/aiinsight/bin/odsprod]$

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台