We are working on DB2 9

advertisement
We are working on DB2 9.5 windows version. Our Server name is GENSD155 in that we
have created on Database named as ‘SAMPLE’
In Command editor we have added the SAMPLE database using the Add button .
We have created the Schema using the below statement.
CREATE SCHEMA WEBDEV
Schema is created successfully.
We have set the current schema as WEBDEV using following statement
SET CURRENT SCHEMA=’WEBDEV’
While creating table using following script it’s giving the error
CREATE TABLE WEBDEV.ADLLGIN (
-- SQL150B 10 REUSEDLT(*NO) in table ADLLGIN in WEBDEV ignored.
-- SQL1506 30 Key or attribute for ADLLGIN in WEBDEV ignored.
USRLG CHAR(25) CCSID 37 NOT NULL DEFAULT '' ,
PSWRD CHAR(25) CCSID 37 NOT NULL DEFAULT '' ,
NAME CHAR(25) CCSID 37 NOT NULL DEFAULT '' ,
COID CHAR(25) CCSID 37 NOT NULL DEFAULT '' ,
DHAST CHAR(5) CCSID 37 NOT NULL DEFAULT '' ,
DBOOK CHAR(5) CCSID 37 NOT NULL DEFAULT '' ,
STAT1 CHAR(2) CCSID 37 NOT NULL DEFAULT '' ,
STAT2 CHAR(2) CCSID 37 NOT NULL DEFAULT '' ,
COLOR CHAR(6) CCSID 37 NOT NULL DEFAULT '' ,
REGION CHAR(10) CCSID 37 DEFAULT NULL ,
DISTRICT CHAR(4) CCSID 37 DEFAULT NULL ,
LOCATIONID CHAR(10) CCSID 37 DEFAULT NULL )
RCDFMT ADLLGINR ;
The Error message is like below
[IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token "WEBDEV" was
found following "HOT FOR CREATE TABLE". Expected tokens may include: "JOIN".
SQLSTATE=42601
And Screen shot of the error message is here
If we remove the CCSID 37 from create table statement and RCDFMT
ADLLGINR then it’s creating the table without errors.
IF we want to create the label on table or column it’s giving error
The statement which we are executing is
LABEL ON TABLE WEBDEV.ADLLGIN
IS 'ADL Login'
The Error message is like below
[IBM][CLI Driver][DB2/NT] SQL0104N An unexpected token "IS" was found
following "TABLE WEBDEV.ADLLGIN". Expected tokens may include: "JOIN
<joined_table>". SQLSTATE=42601
And Screen shot of the error message is here
3. Allocate keyword is giving problem while creating the table. Below is the table create
statement :
CREATE TABLE WEBDEV.LOGINTEST (
USRLG CHAR(25) CCSID 37 NOT NULL DEFAULT '' ,
CUSID CHAR(10) CCSID 37 NOT NULL DEFAULT '' ,
PSWRD CHAR(10) CCSID 37 NOT NULL DEFAULT '' ,
NAME CHAR(25) CCSID 37 NOT NULL DEFAULT '' ,
STATS CHAR(1) CCSID 37 NOT NULL DEFAULT '' ,
BDESC CHAR(20) CCSID 37 NOT NULL DEFAULT '' ,
LOGNUM NUMERIC(7, 0) DEFAULT 0 ,
LOGDATE NUMERIC(8, 0) DEFAULT 0 ,
LOGTIME NUMERIC(4, 0) DEFAULT 0 ,
REF1 CHAR(255) CCSID 37 DEFAULT '' ,
REF2 CHAR(255) CCSID 37 DEFAULT '' ,
PRICE NUMERIC(1, 0) DEFAULT 0 ,
TARIFF NUMERIC(1, 0) DEFAULT 0 ,
SHIPGRID VARCHAR(500) CCSID 37 DEFAULT '' ,
QUOTEGRID VARCHAR(500) ALLOCATE(1) CCSID 37 DEFAULT ' ' ,
TRACKGRID VARCHAR(500) CCSID 37 DEFAULT '' ,
DEFSHIP DECIMAL(5, 0) DEFAULT 0 ,
DEFCON DECIMAL(5, 0) DEFAULT 0 ,
SPEC1 VARCHAR(79) ALLOCATE(1) CCSID 37 DEFAULT ' ' ,
SPEC2 VARCHAR(79) ALLOCATE(1) CCSID 37 DEFAULT ' ' ,
SPEC3 VARCHAR(79) ALLOCATE(1) CCSID 37 DEFAULT ' ' ,
SPEC4 VARCHAR(79) ALLOCATE(1) CCSID 37 DEFAULT ' ' ,
SPEC5 VARCHAR(79) ALLOCATE(1) CCSID 37 DEFAULT ' ' ,
SPEC6 VARCHAR(79) ALLOCATE(1) CCSID 37 DEFAULT ' ' ,
SPEC7 VARCHAR(79) ALLOCATE(1) CCSID 37 DEFAULT ' ' ,
SPEC8 VARCHAR(79) ALLOCATE(1) CCSID 37 DEFAULT ' ' ,
SPEC9 VARCHAR(79) ALLOCATE(1) CCSID 37 DEFAULT ' ' ,
INTLGRID VARCHAR(500) CCSID 37 DEFAULT NULL ,
DBID ROWID GENERATED ALWAYS ,
MYID NUMERIC(10, 0) NOT NULL ,
MYID2 NUMERIC(15, 0) GENERATED ALWAYS AS IDENTITY (
START WITH 1 INCREMENT BY 1
NO MINVALUE NO MAXVALUE
NO CYCLE NO ORDER
CACHE 20 )
)
The Actual Error Message is:
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "ALLOCATE" was found following "OTEGRID
VARCHAR(500)". Expected tokens may include: "DEFAULT". SQLSTATE=42601
SQL0104N An unexpected token "ALLOCATE" was found following "OTEGRID
VARCHAR(500)". Expected tokens may include: "DEFAULT
".
Explanation:
A syntax error in the SQL statement or the input command string for the
SYSPROC.ADMIN_CMD procedure was detected at the specified token
following the text "<text>". The "<text>" field indicates the 20
characters of the SQL statement or the input command string for the
SYSPROC.ADMIN_CMD procedure that preceded the token that is not valid.
As an aid, a partial list of valid tokens is provided in the SQLERRM
field of the SQLCA as "<token-list>". This list assumes the statement is
correct to that point.
The statement cannot be processed.
User response:
Examine and correct the statement in the area of the specified token.
sqlcode: -104
sqlstate: 42601
4. FOR COLUMN keyword is giving problem while creating the table. Below is the table
create statement
CREATE TABLE WEBDEV.TRCKLOG1 (
SITE VARCHAR(10) CCSID 37 DEFAULT NULL ,
USERID CHAR(25) CCSID 37 DEFAULT NULL ,
BILLTO CHAR(10) CCSID 37 DEFAULT NULL ,
WHERECLAUSE FOR COLUMN WHERE00001 VARCHAR(500) CCSID 37 DEFAULT
NULL ,
TIMERAN TIMESTAMP DEFAULT NULL ,
ID NUMERIC(5, 0) GENERATED ALWAYS AS IDENTITY (
START WITH 1 INCREMENT BY 1
NO MINVALUE NO MAXVALUE
NO CYCLE NO ORDER
CACHE 20 )
)
The Actual Error Message is:
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "COLUMN" was found following "LL ,
WHERECLAUSE FOR". Expected tokens may include: ",". SQLSTATE=42601
SQL0104N An unexpected token "COLUMN" was found following "LL ,
WHERECLAUSE FOR". Expected tokens may include: ",
".
Explanation:
A syntax error in the SQL statement or the input command string for the
SYSPROC.ADMIN_CMD procedure was detected at the specified token
following the text "<text>". The "<text>" field indicates the 20
characters of the SQL statement or the input command string for the
SYSPROC.ADMIN_CMD procedure that preceded the token that is not valid.
As an aid, a partial list of valid tokens is provided in the SQLERRM
field of the SQLCA as "<token-list>". This list assumes the statement is
correct to that point.
The statement cannot be processed.
User response:
Examine and correct the statement in the area of the specified token.
sqlcode: -104
sqlstate: 42601
Download