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
 
Db2 interview Question

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
trushant.w

New User


Joined: 22 Sep 2013
Posts: 81
Location: pune india

PostPosted: Sat Mar 15, 2014 3:58 pm    Post subject: Db2 interview Question
Reply with quote

Multiple times i have come across below question in interview.

How to retive current date,time and timestramp from a table and how to recieve them in host varibales

I give them below answers but they wanted to retieve from the table
SELECT CURRENT_TIME FROM SYSIBM.SYSDUMMY1;
SELECT CURRENT_DATE FROM SYSIBM.SYSDUMMY1;
SELECT CURRENT_TIMESTAMP FROM SYSIBM.SYSDUMMY1;
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: Sun Mar 16, 2014 3:26 am    Post subject:
Reply with quote

Hello,

Quote:
but they wanted to retieve from the table


From which table? I don't understand.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Sun Mar 16, 2014 10:34 pm    Post subject:
Reply with quote

You could use:

Code:
select current_timestamp from <table-name> fetch first 1 rows only
or
Code:
EXEC SQL
SET :CURRENT-DATE-TIME = CURRENT TIMESTAMP
END-EXEC.
Back to top
View user's profile Send private message
Chetan Kumar

New User


Joined: 03 Dec 2012
Posts: 35
Location: India

PostPosted: Thu Oct 15, 2015 8:49 pm    Post subject: Reply to: Db2 interview Question
Reply with quote

Hi, you could use select query as below

SELECT CURRENT_TIME INTO :CURRENT-TIME FROM SYSIBM.SYSDUMMY1;
SELECT CURRENT_DATE INTO :CURRENT-DATE FROM SYSIBM.SYSDUMMY1;
SELECT CURRENT_TIMESTAMP INTO :CURRENT-TIMESTAMP FROM
SYSIBM.SYSDUMMY1;

Where Variable preceding colon (:) are called host variables.

Equivalent in COBOL is X(8), X(10) and X(26) respectively.
Back to top
View user's profile Send private message
Rohit Umarjikar

Senior Member


Joined: 21 Sep 2010
Posts: 1806
Location: NY,USA

PostPosted: Fri Oct 16, 2015 1:23 am    Post subject:
Reply with quote

Chetan, thats a year old post.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1894
Location: UK

PostPosted: Fri Oct 16, 2015 4:56 pm    Post subject:
Reply with quote

And that is exactly what was posted in the original post.
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts question about dfsms management clas... Hervey Martinez IBM Tools 0 Tue Oct 10, 2017 6:19 pm
No new posts Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am
No new posts QUESTION: RETURN CHANNEL pahiker CA Products 21 Thu Apr 20, 2017 12:31 am
No new posts The Last Two Question For You To Ask ... CaptBill Mainframe Interview Questions 0 Fri Apr 14, 2017 5:42 am
No new posts Asynchronous CICS Processing Question moezbud CICS 1 Mon Mar 06, 2017 6:13 pm

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