叽叽歪歪

    follow me on Twitter

    Sequences

    |

    Create Single Use Sequences

    Use each sequence to supply unique ID values for one column of one table.

     

    Do Not Limit the Range of Your Sequences

    Do not create sequences that wrap using the CYCLE option or that have a specified MAXVALUE. The total range of sequences is so great that the upper limits realistically are never encountered.

    In general, do not design sequences that wrap or have limited ranges.

     

    Use Number Datatypes to Store Sequence Values

    Use a NUMBER datatype to store sequence values within PL/SQL.             

    If you need to handle a sequence generate a sequence value in your C code, do not assume that a sequence–generated value will fit inside a C long variable. The maximum value for an ascending sequence is 10^27,whereas the maximum value for a C signed long integer is 10^9. If 10^9 is not a reasonable limit for your sequence, you may use a double instead of a long integer. Remember that by using a double for your sequence, you may lose some precision on fractional values. If you do not need to do arithmetic, and simply need to fetch your sequence either to print it or store it back, consider retrieving your sequence in a character string.

    0 comments:

    Post a Comment