Solved

INSERT with PerlIsql

Posted on 2001-07-12
2
156 Views
Last Modified: 2012-06-21
Hi gals and guys,

I got the following error with the script described below :

load_eur_selection.pl DEV9_DS ARBOR_DB arborad arborad 3
Can't find string terminator "EOF;" anywhere before EOF at
        load_eur_selection.pl line 38 (#1)
   
    (F) Perl strings can stretch over multiple lines.  This message means that
    the closing delimiter was omitted.  Because bracketed quotes count nesting
    levels, the following is missing its final parenthesis:
   
        print q(The character '(' starts a side comment.);
   
    If you're getting this error from a here-document, you may have
    included unseen whitespace before or after your closing tag. A good
    programmer's editor will have a way to help you find these characters.
   
Uncaught exception from user code:
        Can't find string terminator "EOF;" anywhere before EOF at load_eur_selection.pl line 38.


Code :

#Retrieve accounts defined with the currency FF
$base->send_query(<<"EOF;");
SELECT account_no, currency_code FROM CMF
WHERE account_no NOT IN (SELECT ncu_account_no FROM EUR_SELECTION)
AND currency_code IN (1, 2)
go
EOF;

$base->get_result(\%result);

foreach $row (@{$result{data}})
{
     if (!exists($accounts{@$row[0]})) { $accounts{@$row[0]} = @$row[1]; }
}

foreach $account_no (sort keys %accounts)
{
     if (($account_no == 2) || ($account_no == 20))
     {
          print "account_no = $account_no, currency = $accounts{$account_no}\n";
          $base->send_query(<<"EOF;");
          INSERT INTO EUR_SELECTION ($account_no, '20011001', 'eur05', 0, NULL, '', 0)
          go
          EOF;
     }
}

It failed with the INSERT query.

Thanks in advance
0
Comment
Question by:Richard Coffre
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
amandeep earned 50 total points
ID: 6278684
pyxos,

Ur code should be :

#Retrieve accounts defined with the currency FF
$base->send_query(<<"EOF;");
SELECT account_no, currency_code FROM CMF
WHERE account_no NOT IN (SELECT ncu_account_no FROM EUR_SELECTION)
AND currency_code IN (1, 2)
go
EOF;

$base->get_result(\%result);

foreach $row (@{$result{data}})
{
    if (!exists($accounts{@$row[0]})) { $accounts{@$row[0]} = @$row[1]; }
}

foreach $account_no (sort keys %accounts)
{
    if (($account_no == 2) || ($account_no == 20))
    {
         print "account_no = $account_no, currency = $accounts{$account_no}\n";
         $base->send_query(<<"EOF;");
         INSERT INTO EUR_SELECTION ($account_no, '20011001', 'eur05', 0, NULL, '', 0)
         go
EOF;
    }
}

-------- OR U can also write as ----------------

#Retrieve accounts defined with the currency FF
$query=qq{
SELECT account_no, currency_code FROM CMF
WHERE account_no NOT IN (SELECT ncu_account_no FROM EUR_SELECTION)
AND currency_code IN (1, 2)
go
};

$base->send_query($query);

$base->get_result(\%result);

foreach $row (@{$result{data}})
{
    if (!exists($accounts{@$row[0]})) { $accounts{@$row[0]} = @$row[1]; }
}

foreach $account_no (sort keys %accounts)
{
    if (($account_no == 2) || ($account_no == 20))
    {
         print "account_no = $account_no, currency = $accounts{$account_no}\n";
         $query=qq{
         INSERT INTO EUR_SELECTION ($account_no, '20011001', 'eur05', 0, NULL, '', 0)
         go
         };
         $base->send_query($query);
    }
}


0
 
LVL 1

Author Comment

by:Richard Coffre
ID: 6279792
Thanks a lot.
Your second solution is perfect.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question