If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Issuing creating self defined data types in DB2 v8.2, n00b question.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-11-07, 16:34
mr_coffee mr_coffee is offline
Registered User
 
Join Date: Aug 2007
Posts: 28
Talking Issuing creating self defined data types in DB2 v8.2, n00b question.

Hello everyone.

I'm trying to make a undefined data type (UDT) in DB2 v8.2
but there seems to be an error at line 3 it says.

CREATE SCHEMA"M";

CREATE DISTINCT TYPE OBJECTLINK AS DECIMAL (9,2);

CREATE TABLE "M".
"agent"
(
"aIndMACAddress"
OBJECTLINK
,
"EventCorrelator"
VARCHAR(1024)
...
....

Any ideas on the syntax or what I'm doing wrong? I'm putting this in the .ddl and loading it with Rational Software Architect.

If I take out the UDT OBJECTLINK everything works fine.
Reply With Quote
  #2 (permalink)  
Old 09-11-07, 16:52
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
What happens if you fully qualify the type_name?

Andy
Reply With Quote
  #3 (permalink)  
Old 09-11-07, 16:53
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Also what is the exact error you are getting?

Andy
Reply With Quote
  #4 (permalink)  
Old 09-11-07, 17:45
mr_coffee mr_coffee is offline
Registered User
 
Join Date: Aug 2007
Posts: 28
Ahh, N/M I fixed it kinda....

I didn't want it to be decimal I just had an example to see if it worked.

But If I changed the code to
CREATE DISTINCT TYPE OBJECTLINK AS DATALINK;

It loads into Rational Software Architect just fine! thanks!
__________________
IBM: Tivoli zSeries Co-op
Reply With Quote
  #5 (permalink)  
Old 09-12-07, 03:35
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Btw: UDT stands for "user-defined type".
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #6 (permalink)  
Old 09-12-07, 09:18
mr_coffee mr_coffee is offline
Registered User
 
Join Date: Aug 2007
Posts: 28
ahh, thanks!

I don't know why I was calling it undefined hah, oh well.
__________________
IBM: Tivoli zSeries Co-op
Reply With Quote
  #7 (permalink)  
Old 09-16-07, 22:14
mr_coffee mr_coffee is offline
Registered User
 
Join Date: Aug 2007
Posts: 28
Hm....

I'm running into another problem:

I don't understand why this works:
CREATE DISTINCT TYPE OBJECTLINK AS DATALINK;

But right under this line I put:
CREATE DISTINCT TYPE Anoymous254 AS VARCHAR(254);



The script file was successfully reverse engineered with the following error messages. Click Finish to generate the model file.
There are problems in parsing the script file.

<<================================================ ============

Parser error on:



Token Kind : 10

StartOffset : 79

Line Number : 2

Col Number : 34

Length : 2

Token Text : AS

Error Msg : "LONG"expected after this token



================================================== ==========>>



Any ideas Why this will work with DATALINK but not VARCHAR(252);


In the .ddl I have:

CREATE DISTINCT TYPE OBJECTLINK AS DATALINK;
CREATE DISTINCT TYPE Anoymous254 AS VARCHAR(254);

CREATE TABLE "MSM".
"bridgeLink"
(
"nodeAddress"
--1.3.18.0.0.3315.8.7.2
Anoymous(254)
,
"relatedBridgeFunction"
--1.3.18.0.0.3573
OBJECTLINK
,
"aSegmentNumber"
--1.3.18.0.0.5273
VARCHAR(1024)
...
...
);


What I don't understand is:
This is the correct syntax after looking it up:

CREATE DISTINCT TYPE T_SHOESIZE AS CHAR(2)
WITH COMPARISONS


So why does it like mine if this is okay?

Hm....it seems to be,
if I use the name like ANO_NAME , it works, but without the underscore its upset.
__________________
IBM: Tivoli zSeries Co-op

Last edited by mr_coffee; 09-16-07 at 22:28.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On