Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / May 2006

Tip: Looking for answers? Try searching our database.

Distinct data type

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
shsandeep - 19 May 2006 07:31 GMT
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.
Serge Rielau - 19 May 2006 07:41 GMT
> 1. I defined a distinct data type 'Surrogate_Key' using the below
> statement:
[quoted text clipped - 11 lines]
> 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

Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

shsandeep - 22 May 2006 00:51 GMT
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
shsandeep - 22 May 2006 01:38 GMT
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.
Serge Rielau - 22 May 2006 16:22 GMT
> 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

Signature

Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.