Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SQL code -190

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Jun 08, 2011 4:22 pm    Post subject: SQL code -190
Reply with quote

Hello All,

I am finding strange problem. I have one table which have few column out of all two of them are

CAS4_ADJ_QTY decimal (15,0)
CAS7_ADJ_QTY decimal(15,0)
both are nullable . I want them to alter as decimal(15,3). Forgot to mention that my test table is empty. I am using below query.

Code:
alter table t6qjdbg.CLAIM_REMIT_CAS
alter column CAS4_ADJ_QTY
set data type decimal(15,3);


Code:
alter table t6qjdbg.CLAIM_REMIT_CAS
alter column CAS7_ADJ_QTY
set data type decimal(15,3);


For first query i received sqlcode -190

Code:
DSNT408I SQLCODE = -190, ERROR:  THE ATTRIBUTES SPECIFIED FOR THE COLUMN CAS4_ADJ_QTY ARE NOT COMPATIBLE WITH THE EXISTING
  COLUMN DEFINITION 


while next query executed successfuily.

What might be the reason. Please help. I know we can drop and recreate the table with new def of fields. but i want to work with Alter as prod data is huge.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10231
Location: italy

PostPosted: Wed Jun 08, 2011 4:34 pm    Post subject: Reply to: SQL code -190
Reply with quote

most probably the original column definitions are not the same !
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1280
Location: Belgium

PostPosted: Wed Jun 08, 2011 4:50 pm    Post subject:
Reply with quote

DECIMAL(p,s) to DECIMAL(q,t) : q>=p and (q-t)>=(p-s)
so (15,0) to (15,3) is not possible : (15 - 3) < (15 - 0)
(15,0) to (18,3) or (12,0) to (15,3) are possible

(Stating DB2 version is also nice)
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Wed Jun 08, 2011 7:14 pm    Post subject:
Reply with quote

Hello GuyC,

I m using DB2 V9.1. and i dont agree DECIMAL(P,S) is going to use P bytes do whether its decimal(p,s) or decimal(p,s+2) would not be any issue,The field length will not changed only the number of decimal places - so, the field is defined
here is a clip

Code:
Column Name        Col No Col Type Length Scale 
*                       * *             *      *
-----------------> ------ -------- ------ ------
CAS4_ADJ_QTY            9 DECIMAL      15      3 <===============  3 decimal places
CAS5_ADJ_RSN_CD        10 CHAR          5      0
CAS6_ADJ_AMT           11 DECIMAL      18      2
CAS7_ADJ_QTY           12 DECIMAL      15      0 <===============  0 decimal places
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 647
Location: Whitby, ON, Canada

PostPosted: Wed Jun 08, 2011 7:40 pm    Post subject:
Reply with quote

I agree that the size of the new column is the same, but DB2 disallows the change because of the risk of truncation. For example, if the existing column contains
Code:
999 999 999 999 999 (spaces shown for readabilty)
and DB2 allowed you to ALTER it to (15,3) the field would have to be truncated to
Code:
999 999 999 999 000 (decimal point implied)

The bottom line is that DB2 is preventing you from damaging your data.
Back to top
View user's profile Send private message
GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1280
Location: Belgium

PostPosted: Wed Jun 08, 2011 9:21 pm    Post subject:
Reply with quote

1) "DECIMAL(p,s) to DECIMAL(q,t) : q>=p and (q-t)>=(p-s) "
I didn't invent this. It's straight out of the SQL reference guide.

2) What don.leahy said
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts IMS region inactive - User abend code... gthmrj IMS DB/DC 5 Tue Mar 07, 2017 12:29 pm
No new posts CA Workload Automation event code help vinu78 CA Products 10 Wed Mar 01, 2017 10:05 am
No new posts MAX-RC 88 and Return code 606 in DFH0... lind sh CICS 2 Tue Jan 24, 2017 1:23 pm
No new posts How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 2 Thu Jan 12, 2017 12:02 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us