IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

moving date from host variable to oracle DB


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Fri Jan 17, 2014 10:14 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jan 17, 2014 11:22 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jan 17, 2014 11:22 pm
Reply with quote

What error?
Back to top
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Tue Feb 11, 2014 11:53 am
Reply with quote

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
Code:
yyyy-mm-dd
format.
The host vairable for the same column was generated by ORACLE utility option with
Code:
PIC X(29)
just like the option we have in DB2I to crreate DCLGEN.

But while executing INSERT or UPDATE SQLs, i used to move date in
Code:
 yyyy-mm-dd
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
Code:
'dd-mmm-yyyy'
e.g. 12-FEB-2014 only worked out through host variable and then only we got the success
Code:
SQLCODE = 0
.

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
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Tue Feb 11, 2014 2:31 pm
Reply with quote

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
View user's profile Send private message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 206
Location: Globe, India

PostPosted: Tue Feb 11, 2014 4:53 pm
Reply with quote

Very useful info.
Thanks.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top