Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 181
Location: Globe, 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: 7314

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: 181
Location: Globe, 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: 1281
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: 181
Location: Globe, 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 Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 1 Tue Nov 21, 2017 9:23 pm
No new posts Date in where clause - Windows Karthikeyan Subbarayan DB2 9 Wed Nov 15, 2017 9:07 pm
No new posts Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us