Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Posts
    25

    Unanswered: Auto Generated Column

    Hi, i have a table with 2 columns in it.

    CREATE TABLE PRODUCT
    (
    ProdNo Integer NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1,INCREMENT BY 1, NO MAXVALUE, NO CYCLE, ORDER),
    Prod_Name Varchar(30) NOT NULL,
    PRIMARY KEY(Prod_Name)

    );

    I am developing a JSP application that allows user to enter data into the datavbase. however i face a problem when i tried to insert in the data. I go the error telling me that no values were specified for the auto generated column. Is that anyway to solve this? It seems like the auto column is not able to insert a value before i insert my data.

  2. #2
    Join Date
    Sep 2003
    Posts
    84
    don't know how you are inserting your data from the jsp application .
    But if you were using simple sqls then your insert statement should not have any reference to the auto generated column and DB2 will generate th value for you. e.g. insert into product (prod_name) values ('test').

    Check whether running this bit of sql from the CLP generates the prodno value as 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •