For Programmers: Free Programming Magazines  


Home > Archive > PERL CGI Beginners > April 2005 > Errors while inserting into long data type









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Errors while inserting into long data type
Mallik

2005-04-11, 3:55 pm

Hi Friends,

I am using oracle database and I have column of long data type. I insert the
data into this column thru perl script. If the inserted data exceeds 4000
chars, it is giving me the following error.

DBD::Oracle::st execute failed: ORA-01704: string literal too long (DBD
ERROR: OCIStmtExecute) at MT/TACDbManager.pm line 445.

Whereas we can insert upto 2GB of data in long data type.

Pl. help me out to solve this.

Thanks & Regards,
Mallik.
Ovid

2005-04-11, 8:55 pm

Oh, and I see you *did* send this to the DBI list. Never mind my
previous comment :)

Cheers,
Ovid
--- Mallik <mkodiche@cisco.com> wrote:
> Hi Friends,



--
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/
Ovid

2005-04-11, 8:55 pm

Hi Mallik,

I suspect you'll get more help on a DBI list, but right off the bat,
I'm wondering why it says "string literal too long". Are you adding
the data directly to an SQL query? In other words, are you doing
something like this?

INSERT INTO TABLE (name) VALUES ('$some_var');

Not only is that a potential security hole if done incorrectly, but I
believe some DBD's will choke if $some_var is too large. Try using a
bind variable and see if that avoids the problem:

my $sth = $dbh->prepare("INSERT INTO TABLE (name) VALUES (?)");
$sth->execute($some_var);

Cheers,
Ovid

--- Mallik <mkodiche@cisco.com> wrote:
> Hi Friends,
>
> I am using oracle database and I have column of long data type. I
> insert the
> data into this column thru perl script. If the inserted data exceeds
> 4000
> chars, it is giving me the following error.
>
> DBD::Oracle::st execute failed: ORA-01704: string literal too long
> (DBD
> ERROR: OCIStmtExecute) at MT/TACDbManager.pm line 445.
>
> Whereas we can insert upto 2GB of data in long data type.
>
> Pl. help me out to solve this.
>
> Thanks & Regards,
> Mallik.
>
> --
> To unsubscribe, e-mail: beginners-cgi-unsubscribe@perl.org
> For additional commands, e-mail: beginners-cgi-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>
>


--
If this message is a response to a question on a mailing list, please send
follow up questions to the list.

Web Programming with Perl -- http://users.easystreet.com/ovid/cgi_course/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com