Q

Date/time calculations on non-date fields in a stored procedure

The start date and time and stop date and time fields in my DB is numeric (length of date fields are 8 and that of time field is 6.). I have to calculate duration for each record and return as a result dataset (with other fields) from a stored procedure. How can I do this? You would have to break the dates and times into the pieces, multiply them into seconds and subtract, giving you the seconds, then divide to get the pieces back together....

Alternatively, I would suggest calling an RPG or other HLL program inside the stored procedure to calculate the difference or use a different method altogether.

==================================
MORE INFORMATION ON THIS TOPIC
==================================

Check out this Search400.com Featured Topic: Database issues resolved

Search400.com's targeted search engine: Get relevant information on DB2/400.

The Best Web Links: Tips, tutorials and more.

This was first published in October 2004

Dig deeper on DB2 UDB (universal databases)

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchEnterpriseLinux

SearchDataCenter

Close