View previous topic :: View next topic
|
Author |
Message |
rohanthengal
Active User
Joined: 19 Mar 2009 Posts: 206 Location: Globe, India
|
|
|
|
i want to move host variable ( PIC X(29) ) populated custom date to ORACLE DB (datatype DATE).
Can anyone please help ?
I am getting error while inserting into table. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You need to post the actual data that you tried to insert along with the diagnostic info generated by the attempt.
Posting "it didn't work" is the biggest waste of time on the forum . . . |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
What error? |
|
Back to top |
|
|
rohanthengal
Active User
Joined: 19 Mar 2009 Posts: 206 Location: Globe, India
|
|
|
|
Sorry due to lack of time i could not post the details. Here we go with the details of that scenario...
The ORACLE table was having a column of datatype DATE.
While executing SELECT SQL i.e.
Code: |
SELCT <COLUMN> INTO <HOST VARIABLE> from <TABLE> |
was working fine and i was able to get the date in host variable in
format.
The host vairable for the same column was generated by ORACLE utility option with
just like the option we have in DB2I to crreate DCLGEN.
But while executing INSERT or UPDATE SQLs, i used to move date in
format into host variable to be further used in SQL. But it was failing with the error saying - 'invalid month'.
Then i tried all the date format options (Brute Force way) to move into host vairable and finally the format
e.g. 12-FEB-2014 only worked out through host variable and then only we got the success
.
I still didnt understand why ORACLE behaves different while executing SELECT v/s INSERT/UPDATE SQLs. Being a mainframer, i did not have much visibility over the mocrofocus COBOL and ORACLE communication and hence was stuck up. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
Quote: |
Oracle's default (external) format for DATE is "DD-MON-YY"
When you start an instance, Oracle Database establishes globalization support based on the values of initialization parameters that begin with "NLS". You can query the dynamic performance table V$NLS_PARAMETERS to see the current globalization attributes for your session.
The default datetime formats are specified either explicitly with the initialization parameter NLS_DATE_FORMAT or implicitly with the initialization parameter NLS_TERRITORY. You can change the default datetime formats for your session with the ALTER SESSION statement. |
|
|
Back to top |
|
|
rohanthengal
Active User
Joined: 19 Mar 2009 Posts: 206 Location: Globe, India
|
|
|
|
Very useful info.
Thanks. |
|
Back to top |
|
|
|