Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

moving date from host variable to oracle DB

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
rohanthengal

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Fri Jan 17, 2014 10:14 pm    Post subject: moving date from host variable to oracle DB
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

Site Director


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

PostPosted: Fri Jan 17, 2014 11:22 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7225

PostPosted: Fri Jan 17, 2014 11:22 pm    Post subject: Reply to: moving date from host variable to oracle DB
Reply with quote

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

Active User


Joined: 19 Mar 2009
Posts: 176
Location: Pune, Maharashtra, India

PostPosted: Tue Feb 11, 2014 11:53 am    Post subject: Reply to: moving date from host variable to oracle DB
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: 1278
Location: Belgium

PostPosted: Tue Feb 11, 2014 2:31 pm    Post subject:
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: 176
Location: Pune, Maharashtra, India

PostPosted: Tue Feb 11, 2014 4:53 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts Moving a PD to PD spoorni DFSORT/ICETOOL 8 Fri Oct 07, 2016 9:52 pm
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us