Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 16 Oct 2002 @ 12:17:41 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


Subj:   Re: Perl Scipts and BTEQ
 
From:   Geoffrey Rommel

  Does anyone use BTEQ to interface with Teradata and a Perl Script? If so, how would you do this? Are there more efficient or better ways to access data from Teradata within a Perl Application?  



SO glad you asked!

For BTEQ, this is the basic technique I use:

open (BTEQ, "bteq 2>&1 < .logon $DB_usernm,$DB_passwd


sql statements go here;

.quit
ZZ
|") or die "Could not run bteq: $!";

 my @output = ();
 while () {
    print if /Failure|Error/i;
    next unless /^\w+\s+(\d|\?)/; # Search for the lines that contain your output
    ($var1, $var2) = split;
    push @output, [ $var1, $var2 ]; # Store output in your Perl array
 }

DBD::ODBC is acceptable but slow, IMHO. There are other ways. Modesty and the rules of this forum prevent me from mentioning them, but if you write to me directly I shall reveal all.


--wgr



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023