Problem with Oracle sequence

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Problem with Oracle sequence

    I defined an Oracle sequence, which is used in my application to generate
    unique increasing numbers.
    I set it from 1 with increment also 1, expecting it to grow by 1.
    The definition in USER_SEQUENCES table is correct.

    When I test this sequence in SQL*Plus session it returns expected values in
    CURRVAL and NEXTVAL functions.

    To contrary, my CF application, which uses this sequence in it's SQL (via
    NEXTVAL), gets new numbers in different unpredictable fashion. Sometimes
    several hundred greater then the previous number.

    Does anybody met this before ?
    What could be the problem ?

    GaryNY Guest

  2. Similar Questions and Discussions

    1. INSERT and Oracle SEQUENCE values
      Thanks to anyone who can help. I am using an ORACLE sequence when adding records to my DB, and using an INSERT statement to use the sequence. I'd...
    2. Problem with the sequence
      Thanks that should help but what about the rest of the columns can u explain what is "is_cycled" and "cache_value". Thanks in advance. Richard...
    3. Problem with Autogenerated sequence
      Hi, I have a problem with the SEQUENCE generation. I have a column in a table which auto increments by 1 every time there is a entry and I am...
    4. Import Sequence problem <<<<<TRY @, any MM support here?>>>>>>
      Still have this incredibly annoying problem. Director MX, XP, Ram=2 mb, new P4 etc... I CAN drag the images from a desktop folder into the Cast...
    5. #23668 [Opn->Fbk]: oracle<defunct> problem apache2+php+oracle
      ID: 23668 Updated by: sniper@php.net Reported By: thecluster at argentina dot com -Status: Open +Status: ...
  3. #2

    Default Re: Problem with Oracle sequence

    Did you use something like the following to set up the sequence?

    CREATE SEQUENCE seq_name
    MINVALUE 1
    MAXVALUE 100000
    START WITH 1
    INCREMENT BY 1
    CACHE 20;


    Then to insert the autonumber in a query:

    <cfquery name="test" datasource="#ds1#">
    INSERT INTO test_table
    (test_id, test_name)
    VALUES
    (seq_name.nextval, 'Test123');

    That works for me just fine.

    Frank
    </cfquery>



    frankjshin Guest

  4. #3

    Default Re: Problem with Oracle sequence

    Something like that, I also extracted NEXTVAL for constructing unique names (in combination with other chars).
    But it is incremented in gaps...
    GaryNY Guest

  5. #4

    Default Re: Problem with Oracle sequence

    Can you put in the actual code you used in SQL PLUS to create the sequence and the query?
    frankjshin Guest

  6. #5

    Default Re: Problem with Oracle sequence

    It was the standard code, increment was set to 1, NOMAX, NOCYCLE.
    GaryNY Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139