I have two tables in database which contain URLS(almost ONE LAKH each).

Both tables may contain same URLS or different URLS.

So i need to copy these URLS in two different files from two tables and i have to compare those URLs.

So I planned to LOAD the URLS from database to TWO different files.But i am getting "OUT OF MEMORY!" error.

So initially i tried copying only 100URLS from database to each file.

Following is the code:

use DBI;

### The database handle

my $var;

my $var_ex;

my $dbh = DBI->connect( "dbi:ODBC:MSSQL");

my $dbh4 = DBI->connect( "dbi:ODBC:MSSQL");

### The statement handle

my $sth = $dbh->prepare("select Top 100 URLName from URL ORDER BY URLID DESC");

$sth->execute();

my $sth4 = $dbh4->prepare("select Top 100 URLName from URL_EXCLUDE");

$sth4->execute();

print "\n starts";

open(URLFHW,">Url.txt");

while($var = $sth->fetchrow_array )

{

print URLFHW "$var\n" ;

}

close(URLFHW);

print "\n 1st file ";

open(URLEXFHW,">Url_ex.txt");

while($var_ex = $sth4->fetchrow_array )

{

print URLEXFHW "$var_ex\n";

}

close(URLEXFHW);

print "\n 2nd file";

OUTPUT:

D:\perl> Copy_urls.pl

starts 1st file Out of memory! 2nd file

Result:

Two files(Url.txt,Url_ex.txt) created with each 100 URLS.But perl program getting terminated at second step itself it is not executing further if i write any code after second step.I have written some script for comparing URLS after second step.but it is not executing.

Can any one help me in this..

!!!!...Thanks in ADVANCE...!!!!


In reply to Out of memory! by santhosh.yamsani

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.