http://www.perlmonks.org?node_id=1043690


in reply to SQL vs Perl table comparing

Hi , Im working in ETL testing were i used to extract the data from Oracle 11g both Source and Target by running queries and put them result extracts into excel sheet and validate the same using excel macro . But i heard that , this can be done using python , perl , or Unix scripting . im looking forward suggestion / answers for my requirement . Any example script is welcome

Replies are listed 'Best First'.
Re^2: SQL vs Perl table comparing
by runrig (Abbot) on Jul 11, 2013 at 16:39 UTC

    You need to start learning one or more of those things you mentioned, try some things, and come back with a specific question (perl questions if you decided to go with perl). Also, it's not good form to cross-post without mentioning that you have cross-posted the question between forums.

    E.g., start learning perl, write something simple, come back with specific questions, learn how to use the DBI library to access data in databases, write something simple, and come back with more specific questions.

Re^2: SQL vs Perl table comparing
by roboticus (Chancellor) on Jul 11, 2013 at 11:46 UTC

    Something like this should do:

    use DBI; use Spreadsheet::WriteExcel; my $DB=DBI::connect( ... connection args for oracle DB ... ); my $ar = $DB->selectall_arrayref('select * from table'); my $XLWB = Spreadsheet::WriteExcel->new('table.xls'); my $XLWS = $XLWB->add_worksheet('table'); my $row = 0; $XLWS->write_row($row,0,$_) for @$ar;

    ...roboticus

    When your only tool is a hammer, all problems look like your thumb.

      Spreadsheet::WriteExcel is superceeded by Excel::Writer::XLSX.

      But I think the poster wants to avoid putting all the data in a spreadsheet where they currently run macros to compare data 8-) ... and wants you to write a generic table compare utility