Discussion:
Is there an equivalent for "alter session set NLS_DATE_FORMAT = 'dd-mm-yyyy'" in Informix?
(too old to reply)
Mathias
2003-11-05 15:30:49 UTC
Permalink
Hello everybody,

does anybody know, if there exists an alternative for

"alter session set NLS_DATE_FORMAT = 'dd-mm-yyyy'"

in Informix?


We found this statement in an application which uses an Oracle-DB. Now
we have to modify this application so that a Informix-DB can be used.
Unfortunately this statement causes a syntax error, because Informix
doesn't know "alter session ...".

To modity the environment variable DBDATE is not the solution we need,
because this has no effect when the database is already open. This
application offers the feature to modify the date-format within the
running applikation.

Best thanks
Mathias
Jonathan Leffler
2003-11-06 06:06:01 UTC
Permalink
Post by Mathias
does anybody know, if there exists an alternative for
"alter session set NLS_DATE_FORMAT = 'dd-mm-yyyy'"
in Informix?
Directly - no.
Post by Mathias
We found this statement in an application which uses an Oracle-DB. Now
we have to modify this application so that a Informix-DB can be used.
Unfortunately this statement causes a syntax error, because Informix
doesn't know "alter session ...".
To modity the environment variable DBDATE is not the solution we need,
because this has no effect when the database is already open. This
application offers the feature to modify the date-format within the
running applikation.
OK - in that case fetch the dates into a C 4-byte integer instead of a
string and format the string on the client side - there are formatting
functions to do what you need documented in the ESQL/C manual.

Or, if you are stuffing data into DATE columns, then you need to
convert the string into a 4-byte integer before sending it to the server.

Also, consider using the TO_CHAR or TO_DATE functions - they are
similar to Oracle's functions and will work much the same job.
--
Jonathan Leffler #include <disclaimer.h>
Email: ***@earthlink.net, ***@us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
Loading...