Results 1 to 3 of 3

Thread: Sequence

  1. #1
    Join Date
    Dec 2003
    Posts
    22

    Unanswered: Sequence

    Hi,

    I am trying to add some peoples detail's to my Oracle database, through ASP. I have set up the form, and text boxes for each indivdual fields, everything inserts fine apart from their ID, as this is a sequence in sql. So a number can be inserted automatically, rather than allowing the user to insert there own ID.

    Any ideas how to make my asp page generate the sequence for the new ID?

    Thanks

  2. #2
    Join Date
    Dec 2003
    Posts
    4

    Re: Sequence

    Hello,

    Why do you not have Oracle generate the sequence for you?

    Here is an example

    -- Start of DDL Script for Sequence SYSTEM.E_PROJECTS_ROW_ID_SQ
    -- Generated 28-Dec-2003 18:17:13 from SYSTEM@ORACLE

    CREATE SEQUENCE e_projects_row_id_sq
    INCREMENT BY 1
    START WITH 1
    MINVALUE 1
    MAXVALUE 999999999999999999999999999
    NOCYCLE
    NOORDER
    NOCACHE
    /


    -- End of DDL Script for Sequence SYSTEM.E_PROJECTS_ROW_ID_SQ

    Then your INSERT SP need to use the sequence.

    INSERT INTO E_PROJECTS (ROW_ID, other columns)
    VALUES E_PROJECTS_ROW_ID_SQ.NEXTVAL, other columns)

    I hope this is what you are looking for.

    Have fun!
    Ronan van Riet

  3. #3
    Join Date
    Jun 2003
    Posts
    34

    Re: Sequence

    I caution though... you might skip Sequence Number if you use Oracle sequence if this is Multi-user environment...
    Cheers!!!!!!!!!
    Originally posted by ronanvanriet
    Hello,

    Why do you not have Oracle generate the sequence for you?

    Here is an example

    -- Start of DDL Script for Sequence SYSTEM.E_PROJECTS_ROW_ID_SQ
    -- Generated 28-Dec-2003 18:17:13 from SYSTEM@ORACLE

    CREATE SEQUENCE e_projects_row_id_sq
    INCREMENT BY 1
    START WITH 1
    MINVALUE 1
    MAXVALUE 999999999999999999999999999
    NOCYCLE
    NOORDER
    NOCACHE
    /


    -- End of DDL Script for Sequence SYSTEM.E_PROJECTS_ROW_ID_SQ

    Then your INSERT SP need to use the sequence.

    INSERT INTO E_PROJECTS (ROW_ID, other columns)
    VALUES E_PROJECTS_ROW_ID_SQ.NEXTVAL, other columns)

    I hope this is what you are looking for.

    Have fun!
    Ronan van Riet

Posting Permissions

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