Hello Stephen,
Thanks for your help. You pointed me in the right direction.
I just used :>> unpack("H16" , $_) on the returned value from the column
and I have the right information
Thank you again
Sachin
Stephen Keller
<stephen.keller@webcri To: "'[EMAIL PROTECTED]'"
<[EMAIL PROTECTED]>
teria.com> cc: [EMAIL PROTECTED]
Subject: RE: SELECT \$moid FROM
xyz.abc
02/28/02 11:17 AM
Hi Sachin:
I wrote a little CLI program that executes the SQLGetTypeInfo against a DB2
7.1 database, and it says that a -2 type is CHAR field with the "FOR BIT
DATA" column specifier. The -2 should have tipped me off sooner, but I was
thinking about Perl and DBI problems, not deliberate database design
decisions. The describe command, BTW, does not report the presense of the
FOR BIT SPECIFIER unless you use the show detail version of the command:
> db2 describe table catevn.cattabl show detail
According to the docs, the FOR BIT DATA:
Specifies that the contents of the column are to be treated as bit
(binary)
data. During data exchange with other systems, code page conversions are
not
performed. Comparisons are done in binary, irrespective of the database
collating sequence.
You've effectively got an array of unsigned bytes, not ASCII text, stored
in
that column. You sometimes see these deployed with a trigger that stores
on
insert the result of a generate_unique() function call. You insert the
record without an id and the insert trigger generates a unique value to
stuff into the id field. Your system isn't doing that specifically,
because
your field is only 8 bytes long and the generate_unqiue function returns a
13 byte value. However, your application could also be generating the id
value to store as the identifier. It's tough to guess what the design
decision was.
The DB2 documentation has a little to say about programming for these,
browse around in the examples section. Also, Graeme Birchall talks about
their uses in the DB2 UDB V7 SQL Cookbook. The latter is available online
as a PDF file at Graeme's website:
http://ourworld.compuserve.com/homepages/Graeme_Birchall/HTM_COOK.HTM. It
is
an excellent resource for DB2 SQL developers.
Stph
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 28, 2002 6:16 AM
To: Stephen Keller
Cc: [EMAIL PROTECTED]
Subject: RE: SELECT \$moid FROM xyz.abc
Stephen,
Using DB2 V7.1 : DBI : 1.21 DBD::DB2 0.76
db2 describe table catenv.cattabl
Column name: $MOID Type name: CHARACTER Length: 8
This is different from the information I got Thru DBI
Column Name: $MOID Type: -2 (Which is SQL_BINARY) Precision: 8
So do I conclude a bug in DBD::DB2 ??
Any place to ask for more details or submit a problem report
Thanks
Sachin
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
**********************************************************************