IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SQLCODE = -20183 while creating a partitioned table


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

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

Hello,

Look here:
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: 1020
Location: India

PostPosted: Fri Feb 12, 2010 2:57 pm
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
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: 1020
Location: India

PostPosted: Fri Feb 12, 2010 3:36 pm
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
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: 1020
Location: India

PostPosted: Fri Feb 12, 2010 4:06 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top