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
 

 

SQLCODE = -20183 while creating a partitioned table

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

New User


Joined: 16 Mar 2007
Posts: 6
Location: India

PostPosted: Fri Feb 12, 2010 12:52 pm    Post subject: SQLCODE = -20183 while creating a partitioned table
Reply with quote

Hi Experts,

I have a requirement for partitioning a table. I tried the below query in our shop -

Code:
CREATE TABLE ACEDB002.PARTTB   
( EMPNO SMALLINT,               
  FNAME CHAR(10),               
  STATE CHAR(2))               
PARTITION BY (EMPNO ASC)       
  (PARTITION 1 ENDING AT ( 100),
   PARTITION 2 ENDING AT ( 200),
   PARTITION 3 ENDING AT ( 300))
IN ACEDB002.ACESLOCL;


Below is the error that I am getting in SPUFI.

Code:
DSNT408I SQLCODE = -20183, ERROR:  THE PARTITIONED, ADD PARTITION, ADD 
         PARTITIONING KEY, ALTER PARTITION, OR ROTATE PARTITION CLAUSE 
         SPECIFIED ON CREATE OR ALTER FOR ACEDB002.PARTTB IS NOT VALID 
DSNT418I SQLSTATE   = 428FT SQLSTATE RETURN CODE                       
DSNT415I SQLERRP    = DSNXIPKY SQL PROCEDURE DETECTING ERROR           
DSNT416I SQLERRD    = 5 0  0  -1  0  0 SQL DIAGNOSTIC INFORMATION       
DSNT416I SQLERRD    = X'00000005'  X'00000000'  X'00000000'  X'FFFFFFFF'
         X'00000000'  X'00000000' SQL DIAGNOSTIC INFORMATION           

The DB2 version I am using is 8.1 which should support Table Controlled Partition. Following is the snapshot of -DIS GROUP

Code:
*** BEGIN DISPLAY OF GROUP(DSND01G ) GROUP LEVEL(810) MODE(N)
                  PROTOCOL LEVEL(2)  GROUP ATTACH NAME(D01G) 

Can you plase tell me why I am getting this error?
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Feb 12, 2010 1:04 pm    Post subject:
Reply with quote

Hello,

Look here:
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/dsnmcj10/2.1.6.504
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Fri Feb 12, 2010 2:57 pm    Post subject:
Reply with quote

MasterLock,

Try this,
Code:
CREATE TABLE ACEDB002.PARTTB   
( EMPNO SMALLINT,               
  FNAME CHAR(10),               
  STATE CHAR(2))                IN ACEDB002.ACESLOCL
PARTITION BY (EMPNO ASC)       
  (PARTITION 1 ENDING AT ( 100),
   PARTITION 2 ENDING AT ( 200),
   PARTITION 3 ENDING AT ( 300)) ;


Does ACESLOCL tablespace has 3 partitions ?

Masterlock you need to unlock & explore DB2 V8 - SQL REFERENCE manual.

Thanks,
Sushanth
Back to top
View user's profile Send private message
masterlock

New User


Joined: 16 Mar 2007
Posts: 6
Location: India

PostPosted: Fri Feb 12, 2010 3:10 pm    Post subject:
Reply with quote

Thanks everyone,

My initial query is working now. The problem was with the non-partitioned tablespace as you mentioned.

Can we use any scalar function in the PARTITION BY clause? For example if we need to partion based on the last two digits of an employee id.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Fri Feb 12, 2010 3:36 pm    Post subject:
Reply with quote

Quote:
Can we use any scalar function in the PARTITION BY clause?


Try, let us know if you have any errors.

Sushanth
Back to top
View user's profile Send private message
masterlock

New User


Joined: 16 Mar 2007
Posts: 6
Location: India

PostPosted: Fri Feb 12, 2010 3:51 pm    Post subject:
Reply with quote

I have tried as PARTITION BY (MOD(EMPNO,10) ASC) but it is not working. Just wanted to know if this feature is availabe in DB2 or not.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Fri Feb 12, 2010 4:06 pm    Post subject:
Reply with quote

Masterlock,

Hmm....

You can have index on expressions, in which you can use SCALAR functions. Combine it with index partitioning.

You will have what you want.

But, the problem is, to it i have be in v9.

Good news is last week IBM announced V10.

Thanks,
Sushanth
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 SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm
No new posts Command UNIQUE CONSTRAINT on any tabl... rohanthengal DB2 2 Thu Aug 18, 2016 3:48 pm
No new posts Updating online Db2 table kishpra DB2 3 Fri Aug 12, 2016 2:44 pm
No new posts Creating an 'Enter' event with IMS MF... dileep chirasani Java & MQSeries 1 Sat Aug 06, 2016 2:23 am


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