Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
Welcome to the Monastery
 
PerlMonks  

perl DBI special variable problem

by renu (Initiate)
on Apr 07, 2006 at 05:02 UTC ( [id://541821]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

renu has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,
My perl program includes the below line,
$ora_errstr="";
If i run the program following error is displayed, "Can't modify $DBI::&errstr special variable at Myprogram.pl line #"
But i don't want to remove "$ora_errstr="";" line from the program. Could you please help me out from this problem.
"They may only be read; a fatal error occurs if a program attempts to change them." is given in the DBD perldoc. The error shows the DBD module. But there was no error in my previous DBI and DBD version . Thanks in advance,
Ren"u.

Replies are listed 'Best First'.
Re: perl DBI special variable problem
by idle (Friar) on Apr 07, 2006 at 05:15 UTC
    It seems not related to $ora_errstr="", rather you have something like $DBI::errstr=$var in your code.
      $ora_errstr=""; and $DBI::errstr=""; give same error
        You can't set a value to a read-only variable, why are you trying?
        The error string for a given handle is reset at most DBI method calls, so you shouldn't need to reset it.
Re: perl DBI special variable problem
by derby (Abbot) on Apr 07, 2006 at 08:44 UTC

    I'm not a DBD::Oracle expert (but why should that stop me from commenting!). Looking at the doc and source for DBD::Oracle, I see no mention of $ora_errstr. Are you aliasing it somewhere in your code (*ora_errstr = $DBI::errstr)?

    -derby
Re: perl DBI special variable problem
by runrig (Abbot) on Apr 07, 2006 at 12:44 UTC
    ora_errstr is from oraperl. oraperl is perl with Oracle libraries compiled in from before the days of DBI and DBD::Oracle. If you use one (oraperl or DBI) you shouldn't need the other in the same program (and you should only need oraperl if you need to support legacy code). You shouldn't need to set the errstr in either, it is just something that is automatically set (sort of, see this) after an error. So you can print it (or something) after you detect an error.

    Update: Oraperl is also a compatibility module from DBD-Oracle (to make oraperl programs transparently use DBI) so $ora_errstr is likely an alias for $DBI::errstr. Previous comments that you shouldn't need to set the errstr still apply.

    Another update: Apparently Oraperl is no longer supported. I suggest transitioning to pure DBI.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://541821]
Approved by Corion
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.