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

Hello Support, I am connecting through a perl script to an Oracle database using:

use DBI; $dbh = DBI->connect("dbi:Oracle://<ALIAS>:1531/<SID>",$user, $password +, { RaiseError => 1, AutoCommit => 0 }); my $sql ="select ....";
but i noticed that query's result is different if i run it manually through SQL developer client. So i would like to align script's behavior to SQL developer one (correct one), and for doing it i would like to ask you how to modify perl connection string to use java method (example orai18n.jar file) instead of DBI library method. Please let me know if you have any other suggestion about this scenario. Thanks. Regards, Fabrizio

Replies are listed 'Best First'.
Re: Perl connection string to Oracle Database
by runrig (Abbot) on Oct 26, 2015 at 15:20 UTC
    i noticed that query's result is different if i run it manually through SQL developer client.

    Different, how? There is nothing in either client that should change query results, except perhaps the formatting of the results.

      I could imagine that the collation order and/or other characterset related things can happen if one connection is configured differently from the other. For example, if Latin-1 data is inserted, the database needs to be told in some way that the data should be interpreted as Latin-1.

      In absence of the relevant statements and/or the relevant data and error causes though, this is all idle speculation.

        Thanks for the answers. My query is selecting records on Oracle 11G database, based on some attributes and timestamp. I know that it's very strange, infact also comparing SQL developer and TOAD oracle client they result (same query) different output. I don't know how this difference could happen, but at the moment i would like to try changing connection string from DBI to Java one if exist (i would like to set into perl script a new database connection like sql developer client do). Thanks. Regards, Fabrizio
Re: Perl connection string to Oracle Database
by kennethk (Abbot) on Oct 26, 2015 at 15:00 UTC
    Off topic, so sorry. I don't know of an easy way to do what you say by way of a connection string alone. You could do it using Inline::Java, but I don't know how helpful that would be.

    Bigger problem is why you are getting differences, which presumably is why you are asking this question. Can you go into greater depth how your queries are different?


    #11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.