Advertisement
Guest User

Untitled

a guest
Feb 26th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. my $dbh = DBI->connect( 'dbi:Oracle:'.$dbname,
  2. $dbusername,
  3. $pass,
  4. { PrintError => 0,
  5. RaiseError => 1
  6. }
  7. ) || die "Erreur lors de la connexion: $DBI::errstr";
  8.  
  9. print ("Connexion à la base de données $dbname avec $dbusername OK n");
  10.  
  11. $requete = "select distinct to_char(date_appli,'yyyymmdd') from DATE_APPLI ".
  12. "where frequence = 'Q' and actif = 1";
  13.  
  14. $sth_sql = $dbh->prepare($requete);
  15. $sth_sql->execute();
  16. @row=$sth_sql->fetchrow_array;
  17. $datesitu=@row[0];
  18.  
  19. $sth_sql->finish;
  20. print "La date de situation est $datesitu n";
  21.  
  22. # SQL to get validation script and table names
  23. $requete = "select SCRIPT_NAME, table_name from fdf_scripts";
  24.  
  25. $sth_sql = $dbh->prepare($requete);
  26. $sth_sql->execute();
  27. $sth_sql->bind_columns(undef, $script_name, $table_name);
  28.  
  29. while ($sth_sql->fetch()) {
  30.  
  31. $script_sql="$sql_path\"."FDF_Test_scripts\".$script_name.".sql"; #validation script path
  32. $script_log="$log_path\".$script_name.".log"; #log files path
  33. $rep_file_name="$sql_path\"."FDF_Test_scripts\".$table_name.".sql"; #reports SQL path
  34. $csv_file="$sql_path\"."FDF_Test_scripts\".$table_name.".csv"; #report CSV path
  35.  
  36. #Load data into validation tables using validation scripts
  37.  
  38. $CmdText="sqlplus -s $connect @$script_sql $script_log";
  39.  
  40. print "Inserting data into table : $table_name n";
  41.  
  42. #system ("$CmdText");
  43.  
  44. $col_sql = "select COLUMN_NAME from all_tab_cols where TABLE_NAME = upper('$table_name')n";
  45.  
  46. print "$col_sqln";
  47.  
  48. $sth_sql = $dbh->prepare($col_sql);
  49. $sth_sql->execute();
  50. $sth_sql->bind_columns(undef, $COLUMN_NAME);
  51.  
  52. while ($sth_sql->fetch()) {
  53.  
  54. print "$COLUMN_NAMEn";
  55.  
  56. }
  57.  
  58.  
  59.  
  60. if (open (my $fh, '<:encoding(UTF-8)', $script_log)){
  61. while (my $line = <$fh>){
  62. if ($line=~m/bERRORb/){
  63. print "Error While Loading $table_name table Please Check log file for errors at: $script_log n";
  64. }
  65. }
  66. }
  67. else {
  68. warn "Could open file: $script_log n"
  69. }
  70.  
  71. }
  72.  
  73. DBD::Oracle::st fetch failed: ERROR no statement executing (perhaps you need to call execute first) [for Statement "select COLUMN_N
  74. AME from all_tab_cols where TABLE_NAME = upper('FDF_Bond_validation_results')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement