473,473 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Distinct data type

1. I defined a distinct data type 'Surrogate_Key' using the below
statement:
set current schema Myschema;
CREATE DISTINCT TYPE Surrogate_Key AS INTEGER WITH COMPARISONS;

2. Created a table that uses the above data type
CREATE TABLE COV_TYPE (
COV_TYP_DT DATE,
COV_ID Myschema.Surrogate_Key
);

Now, when I do a 'describe table COV_TYPE' it shows LENGTH 0 for 'COV_ID'
column.
As a result, I am unable to insert any data into this column. Any solution
to get around this issue??
Thanks.

Cheers,
San.

May 19 '06 #1
4 1940
shsandeep wrote:
1. I defined a distinct data type 'Surrogate_Key' using the below
statement:
set current schema Myschema;
CREATE DISTINCT TYPE Surrogate_Key AS INTEGER WITH COMPARISONS;

2. Created a table that uses the above data type
CREATE TABLE COV_TYPE (
COV_TYP_DT DATE,
COV_ID Myschema.Surrogate_Key
);

Now, when I do a 'describe table COV_TYPE' it shows LENGTH 0 for 'COV_ID'
column.
As a result, I am unable to insert any data into this column. Any solution
to get around this issue??

Looks like a bug in CLP. Do: DESCRIBE SELECT * FROM COV_TYPE
that works..
(Note that you can use the ADMIN_CMD() procedure to integrate DESCRIBE
into any SQL interface).

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 19 '06 #2
Here are the results for 'describe table' and 'describe select * from
twd_company'
What should i do? It does not allow me to enter data into the user defined
distinct types 'surrogate_key'.

db2 => describe table twd_company

Column Type Type
name schema name Length Scale
Nulls
------------------------------ --------- ------------------ -------- -----
------
COMP_CDE SYSIBM CHARACTER 1 0
No
COMP_NK_ID SYSIBM INTEGER 4 0
No
COMP_STRT_DT SYSIBM DATE 4 0
No
COMP_DESC SYSIBM VARCHAR 30 0
Yes
COMP_END_DT SYSIBM DATE 4 0
Yes
COMP_SANCTION_EOY_IND SYSIBM CHARACTER 1 0
Yes
COMP_GRP_NUM SYSIBM VARCHAR 8 0
Yes
COMP_BNK_BSB_CDE SYSIBM VARCHAR 6 0
Yes
COMP_BNK_ACC_CDE SYSIBM VARCHAR 9 0
Yes
COMP_HI_ID DEVSTGEV SURROGATE_KEY 0 0
No
SRCE_SYS_CDE SYSIBM VARCHAR 9 0
No
LOAD_ID DEVSTGEV SURROGATE_KEY 0 0
Yes
CUR_REC_IND DEVSTGEV FLAG 0 0
Yes

13 record(s) selected.

db2 => describe select * from twd_company

SQLDA Information

sqldaid : SQLDA sqldabc: 1472 sqln: 26 sqld: 13

Column Information

sqltype sqllen sqlname.data
sqlname.length sqllonglen sqldatatype_name.data
sqldatatype_name.length
-------------------- ------ ------------------------------
-------------- ---------- ---------------------------
-----------------------
452 CHARACTER 1 COMP_CDE
8 0 SYSIBM .CHARACTER 18
496 INTEGER 4 COMP_NK_ID
10 0 SYSIBM .INTEGER 16
384 DATE 10 COMP_STRT_DT
12 0 SYSIBM .DATE 13
449 VARCHAR 30 COMP_DESC
9 0 SYSIBM .VARCHAR 16
385 DATE 10 COMP_END_DT
11 0 SYSIBM .DATE 13
453 CHARACTER 1 COMP_SANCTION_EOY_IND
21 0 SYSIBM .CHARACTER 18
449 VARCHAR 8 COMP_GRP_NUM
12 0 SYSIBM .VARCHAR 16
449 VARCHAR 6 COMP_BNK_BSB_CDE
16 0 SYSIBM .VARCHAR 16
449 VARCHAR 9 COMP_BNK_ACC_CDE
16 0 SYSIBM .VARCHAR 16
496 INTEGER 4 COMP_HI_ID
10 0 DEVSTGEV.SURROGATE_KEY 22
448 VARCHAR 9 SRCE_SYS_CDE
12 0 SYSIBM .VARCHAR 16
497 INTEGER 4 LOAD_ID
7 0 DEVSTGEV.SURROGATE_KEY 22
501 SMALLINT 2 CUR_REC_IND
11 0 DEVSTGEV.FLAG 13
May 21 '06 #3
ignore the mail above...
its working fine now, there was a RI issue due to which columns were not
being populated.
but i would still like the 'describe table' output to show INTEGER 4
rather than the distinct data type 'Surrogate_Key'.
Any solutions for this?

cheers,
sandeep.

May 22 '06 #4
shsandeep wrote:
ignore the mail above...
its working fine now, there was a RI issue due to which columns were not
being populated.
but i would still like the 'describe table' output to show INTEGER 4
rather than the distinct data type 'Surrogate_Key'.
Any solutions for this?

Yes, open a PMR...

Cheers
Serge

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
May 22 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: nfrodsham | last post by:
In Microsoft's help literature, it states: "You can filter out non-unique rows by using the DISTINCT option of an aggregate function" I am trying to do this in Access 2003 with the COUNT...
3
by: shsandeep | last post by:
Can a distinct data type be altered? Eg: Suppose 'Surrogate_Key' is defined as CHAR(1). Can it be altered to CHAR(2)? And will the changes be automatically propagated to all columns that use...
1
by: RussCRM | last post by:
I need some help getting unique records from our database! I work for a small non-profit homeless shelter. We keep track of guest information as well as what services we have offered for...
1
by: ebusiness | last post by:
I am trying to create nicknames for tables in a remote database. The federated database and remote database are both DB2 UDB V8.2, both OS are AIX. Could anyone tell me how to create a nickname...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.