RE: Newline inserted?



If your file has a '\n' in it, it cannot possibly be an issue with DBI
or Oracle v anything.

Are you processing individual SQL statements (does your file contain SQL
insert statements)? If so, DBI is not your best bet to do this. I
would rethink this and:

a. Use SQL*Plus to load the file:
sqlplus -L /nolog <eof
connect uid/pwd@db_name
@file
commit;
exit
eof

b. Consider getting a file of data (no SQL statemets) and use
SQL*Loader to load the data.

--
Ron Reidy
Lead DBA
Array BioPharma, Inc.

-----Original Message-----
From: Ward.P.Fontenot@xxxxxxxxxxxxxx
[mailto:Ward.P.Fontenot@xxxxxxxxxxxxxx]
Sent: Monday, October 24, 2005 12:01 PM
To: dbi-users@xxxxxxxx
Subject: Newline inserted?


I have the following sql insert statement in a file:

INSERT INTO message(FULLDATE,HOSTNAME,FACILITY,PRIORITY,MESSAGE,SHA1)
VALUES('2005-Oct-18 11:53:21','pkitest.wellsfargo.com','auth
','info','su(pam_unix)[3638]: session opened for user oracle by
root(uid=0)','H4vgmf+OJsT99kCfQuIpALY7k9k=');

When I attempt to load this file into Oracle 10g using the DBI I get the
following error:

DBD::Oracle::st execute failed: ORA-00911: invalid character (DBD ERROR:
error possibly near <*> indicator at char 238 in 'INSERT INTO
message(FULLDATE,HOSTNAME,FACILITY,PRIORITY,MESSAGE,SHA1)
VALUES('2005-Oct-18
11:53:21','pkitest.wellsfargo.com','auth','info','su(pam_unix)[3638]:
session opened for user oracle by
root(uid=0)','H4vgmf+OJsT99kCfQuIpALY7k9k=')<*>;')

This is the code that loads this file:

while (<SQL>) {
chomp;
$sql = qq{$_};

$sth = $dbh->prepare($sql); # Should these be outside the loop?
$sth->execute();
}

Od -cx FILENAME shows a "\n" character at the <*> point in the above
file. VI -b does not. Is this a known issue with DBI and 10g or am I
overlooking something?


Paul Fontenot
WFS - CAST Operations
Email: ward.p.fontenot@xxxxxxxxxxxxxx
Phone: (480) 437-7795

This message may contain confidential and/or privileged information. If
you are not the addressee or authorized to receive this for the
addressee, you must not use, copy, disclose, or take any action based on
this message or any information herein. If you have received this
message in error, please advise the sender immediately by reply e-mail
and delete this message. Thank you for your cooperation.

This electronic message transmission is a PRIVATE communication which contains
information which may be confidential or privileged. The information is intended
to be for the use of the individual or entity named above. If you are not the
intended recipient, please be aware that any disclosure, copying, distribution
or use of the contents of this information is prohibited. Please notify the
sender of the delivery error by replying to this message, or notify us by
telephone (877-633-2436, ext. 0), and then delete it from your system.

.



Relevant Pages

  • RE: how to invoke .sql file from dbi
    ... recommended changing all the SQL*Plus scripts into DBI calls. ... The sql statements are SELECT statements and we are expecting plain (no ... to just point the dbi to a sql file and dbi taking care of it. ...
    (perl.dbi.users)
  • Re: OLEDBCommand vs. SQLCommand
    ... You do not *have* to use OleDb for Oracle. ... SQL compliant - assuming that SQL is a general specification, ... Both of the above are considered to be SQL statements and both do the ...
    (microsoft.public.dotnet.languages.vb)
  • RE: Newline inserted?
    ... If you are on at least version 9 of Oracle, ... > Are you processing individual SQL statements (does your file contain SQL ... DBI is not your best bet to do this. ... Use SQL*Plus to load the file: ...
    (perl.dbi.users)
  • Re: how to invoke .sql file from dbi
    ... The sql statements are SELECT statements and we are expecting plain output from these statements. ... But it is little surprising that dbi doesn't support executing sql files directly. ... The anonymous PL/SQL block would be a way to avoid parsing all of it and executing it as individual statements, but still executing it via DBI without calling out to sql*plus. ...
    (perl.dbi.users)
  • how to invoke .sql file from dbi
    ... to just point the dbi to a sql file and dbi taking care of it. ... sql file is sqlplus feature and may not be applicable to dbi, ... Each sql file has multiple sql statements within it. ...
    (perl.dbi.users)