View previous topic :: View next topic |
Author |
Message |
coolguy Beginner
Joined: 01 Dec 2004 Posts: 82 Topics: 28
|
Posted: Thu Mar 15, 2007 8:27 am Post subject: -540 Sqlcode when trying to insert into a newly created tbl |
|
|
Hi
I have creared one Table in Db2 with primary keys and views, while insering some values or trying select from the table
i am getting the error msg
Code: |
DSNT408I SQLCODE = -540, ERROR: THE DEFINITION OF TABLE TRP01.EMP
IS INCOMPLETE BECAUSE IT LACKS A PRIMARY INDEX OR A REQUIRED UNIQUE
INDEX
DSNT418I SQLSTATE = 57001 SQLSTATE RETURN CODE
DSNT415I SQLERRP = DSNXOTL SQL PROCEDURE DETECTING ERROR
DSNT416I SQLERRD = -550 0 0 -1 0 0 SQL DIAGNOSTIC INFORMATION
DSNT416I SQLERRD = X'FFFFFDDA' X'00000000' X'00000000' X'FFFFFFFF'
X'00000000' X'00000000' SQL DIAGNOSTIC INFORMATION |
Could you please provide me what are the steps we need to do to cretare that table in DB2 and
how to connect with new DB2 table with our cobll db2 program
PS: we are started the proj from the begining
jsut now we have creted the database and table space
pls provide me your valuable ideas
Thanks
cool |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Thu Mar 15, 2007 8:46 am Post subject: |
|
|
Can you post the DDL for your table creation so that we can see exactly what you are doing? _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
coolguy Beginner
Joined: 01 Dec 2004 Posts: 82 Topics: 28
|
Posted: Thu Mar 15, 2007 9:06 am Post subject: |
|
|
Pls find the below ddl
Code: |
CREATE TABLE TRP01.TPAS_DLY_TRN_SMY
(PLNNUM CHARACTER(6) FOR SBCS DATA not NULL
,PAPRD CHARACTER(2)FOR SBCS DATA NOT NULL
,PADTRADE DATE NOT NULL
,EXL_TAX_TYP_CD CHARACTER(3) FOR SBCS DATA NOT NULL
,DYA_TRN_CD CHARACTER(4) FOR SBCS DATA NOT NUll
,TRN_SBT_CD DECIMAL(2,0) nOT NULL
,PASRC CHARACTER(1) FOR SBCS DATA NOT null
,TRN_ADJ_IN CHARACTER(20) FOR SBCS DATA NOT NULL
,ADJ_FIN_DT DATE wITH DEFAULT NULL
,TRN_DLR_AM DECIMAL(17,2) NOT NULL
,TRN_SHR_QT DECIMAL(15,3) NOT NULL
,TRN_CST_AM DECIMAL(17,2) WITH DEFAULT NULL
,NET_TRN_AM DECIMAL(17,2) NOT NULL
,NET_TRN_SHR_QT DECIMAL(15,3) NOT NULL
,TRN_CSH_AM DECIMAL(17,2) NOT NULL
,VCH_NU DECIMAL(9,0) WITH DEFAULT NULL
,ORG_USR_NU CHARACTER(8) FOR SBCS DATA NOT NULL
,ORG_USR_ACV_TS TIMESTAMP NOT NULL WITH DEFAULT
,LTS_UPD_USR_NU CHARACTER(8) FOR SBCS DATA NOT NULL
,LTS_UPD_USR_TS TIMESTAMP NOT NULL WITH DEFAULT
, PRIMARY KEY (PLNNUM
,PAPRD
,PADTRADE
,EXL_TAX_TYP_CD
,DYA_TRN_CD
,TRN_SBT_CD
,PASRC) )
IN TRPDB.TRPTS01; |
This is my ddl
Thanks
Cool |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Mar 15, 2007 9:15 am Post subject: |
|
|
coolguy,
The table is marked as unavailable until its primary index is explicitly created unless the CREATE TABLE statement is processed by the schema processor. In that case, DB2 implicitly creates an index to enforce the uniqueness of the primary key and the table definition is considered complete.
First go and create index on the primary key before you perform any inserts/updates
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
videlord Beginner
Joined: 09 Dec 2004 Posts: 147 Topics: 19
|
Posted: Thu Mar 15, 2007 2:24 pm Post subject: |
|
|
Hi kolusu,
Do you have any experience of "schema processor" mentioned in your reply?
Or do you have any document/reference link about it?
Thanks. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
coolguy Beginner
Joined: 01 Dec 2004 Posts: 82 Topics: 28
|
Posted: Thu Mar 15, 2007 11:52 pm Post subject: |
|
|
Could you please provide me how to connect with new DB2 table with our cobll db2 program Or do you have any document/reference link about it?
Please help in that |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Fri Mar 16, 2007 2:45 am Post subject: |
|
|
Which manuals have you referred to and which bits of them do you not understand, or are confusing you? _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
coolguy Beginner
Joined: 01 Dec 2004 Posts: 82 Topics: 28
|
Posted: Fri Mar 16, 2007 6:23 am Post subject: |
|
|
I in the appliction side only ,i am not having much idea about the DBA activity ,while doing this one i facing this problem that's reason i asked for some useful links
Cool |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Fri Mar 16, 2007 6:59 am Post subject: |
|
|
Your DB2 programming course should have covered this - it is not DBA activity. But you need the programming guide - (DB2 V7 Application Programming and SQL Guide) accessible via the link at the top. And Section 5 is probably the best answer to your query. _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
|
|