Link to home
Start Free TrialLog in
Avatar of Richard Coffre
Richard CoffreFlag for France

asked on

INSERT with PerlIsql

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
ASKER CERTIFIED SOLUTION
Avatar of amandeep
amandeep
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Richard Coffre

ASKER

Thanks a lot.
Your second solution is perfect.