Stacy,

Alter session should work, i use it in my script.
Try with double quotes instead of single quotes in your code.

$dbh->do(qq{ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MM-YYYY'});

regs,
Ravi
[EMAIL PROTECTED] wrote:

>Greetings all;
>
>A question regarding setting NLS_DATE_FORMAT and getting DBI
>to obey it... With the code below, the statement fails to
>retrieve data although I know it is there. However, if
>I modify the SQL statement to the following:
>
>SELECT * FROM POSITIONS WHERE TO_CHAR(START,'DD-MM-YYYY') = ?
>
>The script works! Having the TO_CHAR negates the need for
>using the ALTER SESSION...
>
>Is this a bug?
>
>I'm using the following:
>
>Oracle8i (8.1.7) on Solaris 8/9
>DBI 1.30
>DBD::Oracle 1.12
>
>Regards,
>
>       Stacy Mader.
>
>
>
>use DBI;
>use Math::Trig;
>  
>my($dbh) = DBI->connect($orac_sid,$table,$passwd,'Oracle',
>                { RaiseError  => 1,
>                  AutoCommit  => 1,
>                  ChopBlanks  => 1});
>
>$dbh->do(q{ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MM-YYYY'});
>
>$sth = $dbh->prepare(qq{SELECT * FROM $table WHERE START = ?});
>
>$sth->execute('08-09-1999');
>
>while( @row = $sth->fetchrow ) {
>
>       print "@row\n";
>
>}
>
>$dbh->disconnect();
> 
>  
>

Reply via email to