×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
On Wed, Apr 28, 2021 at 2:06 PM Rob Berendt <rob@xxxxxxxxx> wrote:
I'd like to know by what mathematical gymnastics they get a timestamp(0) column to take 7 bytes as I suspect that some of you will not believe IBM's documentation until you understand that.
Well, they explained it right in the link that you gave:
"The internal representation of a timestamp is a string of between 7 and 13 bytes."
https://www.ibm.com/docs/en/db2/10.5?topic=list-datetime-values
Quoted from there:
"The internal representation of a timestamp is a string of between 7
and 13 bytes. Each byte consists of 2 packed decimal digits. The first
4 bytes represent the date, the next 3 bytes the time, and the last 0
to 6 bytes the fractional seconds."
That same page also explains how a date is 4 bytes and a time is 3 bytes:
"The internal representation of a date is a string of 4 bytes. Each
byte consists of 2 packed decimal digits. The first 2 bytes represent
the year, the third byte the month, and the last byte the day."
"The internal representation of a time is a string of 3 bytes. Each
byte consists of 2 packed decimal digits. The first byte represents
the hour, the second byte the minute, and the last byte the second."
In other words, it's simply packed decimal, except with no storage
reserved for the sign (all values are of course positive). So whenever
you see 2 digits (in typical, human-readable form), that gets packed
into 1 byte.
John Y.
As an Amazon Associate we earn from qualifying purchases.