Rank a sequence of consecutive numbers

I have a table with the following numbers
620053190
620053191
620053192
620053193
620053194
620054131
620054142
620054143
620054144
620054145
620054146
620054148
620054149
620054151
620054152
I need assign a unique value to the sequence of consecutive numbers. I need to have an output as shown below
620053190       1
620053191       1
620053192       1
620053193       1
620053194       1
620054131       2
620054142       3
620054143       3
620054144       3
620054145       3
620054146       3
620054148       4
620054149       4
620054151       5
620054152       5
Can anyone please help?
Thanks

Hi,
Here's one way:
WITH    got_dif    AS
    SELECT  num_col
    ,       num_col - ROW_NUMBER () OVER (ORDER BY num_col)   AS dif
    FROM    table_x
--  WHERE   ...       -- If you need any filtering, this is where it goes
SELECT    num_col
,         DENSE_RANK () OVER (ORDER BY  dif)   AS grp
FROM      got_dif
ORDER BY  num_col

Similar Messages

  • How to get consecutive numbering at the end of paragraphs?

    In a big text some paragraphs, already styled, need a consecutive numbering.
    At the beginning of the paragraph the numbering will create a mess.
    Tried with fake footnotes: Impossible. The text has footnotes and converting the faked ones to text is not available.
    Tried a nice script written by Jong to add/subtract a number on numbered items, but it is restricted to index situations.
    O R I G I N A L                                   R E Q U I R E D
    a. Many years ago.                    a. Many years ago. [1]
    Lucy Smith                              Lucy Smith
    b. Margaret run away.               b. Margaret run away. [2]

    Hi, Camilo:
    First of all,  I was not thinking clearly when I blamed ID for a cross-reference bug. It was my error. Cross-references within a document need to be updated by the author, using the Update cross-references button at the bottom of the Hyperlinks & Cross-References panel, when they're moved or their source content changes. I was thinking about the known issues with cross-references that go between ID document files, which update automatically - performance slows, and sometimes they cause crashes.
    Here's the replacement reply for my previous post #1:
    camilo umaña wrote:
    In a big text some paragraphs, already styled, need a consecutive numbering.
    At the beginning of the paragraph the numbering will create a mess.
    Tried with fake footnotes: Impossible. The text has footnotes and converting the faked ones to text is not available.
    Tried a nice script written by Jong to add/subtract a number on numbered items, but it is restricted to index situations.
    O R I G I N A L                                   R E Q U I R E D
    a. Many years ago.                    a. Many years ago. [1]
    Lucy Smith                              Lucy Smith
    b. Margaret run away.               b. Margaret run away. [2]
    It's not clear if the right-hand numbers are supposed to replace the left-hand numbers while keeping the same sequence, or if you want to retain the left-hand numbers. You can use cross-references to create right-hand numbers from the paragraphs auto-numbers.
    Insert a cross-reference to the paragraph at the end of the text, with a format that captures its autonumber, and adds any ornamentation, like the square brackets in your example.
    If the rightmost number must be positioned at the right margin of the numbered paragraph, no matter how long or short it is, or if it wraps around to new lines, add a right-aligned tab stop to the paragraph style, positioned at the location where you want the number to appear, and insert a tab character in the paragraph before the cross-reference.
    If the left hand numbers are supposed to go away, you can't change the paragraph style to a non-autonumbered style, because you need the numbers that the cross-references capture. So, you need to create a character style that's very small and uses Paper for the text color, to hide the autonumbers. If the smallest point size (IIRC, it's 2 points) leaves too much space at the left of the autonumber, you might be able to reduce it further by using a small value in the Horizontal Scale property of the Advanced Character Formats in the Character Style dialog box. Your example seems to show that the numbered paragraphs are indented, so the space occupied by the hidden autonumbers may not be a problem.
    If the paragraphs are rearranged in sequence, you'll need to use the Update Cross-References button at the bottom of the Hyperlinks & Cross-References panel to update the affected cross-references.
    I'm still not clear about numbers at the end of the paragraphs in square brackets. Are they supposed to be the same value as the auto-number at the beginning of the paragraph, except that they use a numeric display format instead of an alphabetic format?
    I don't know of any code that can work with a find/replace action that can capture a paragraph's autonumber and display it at a specific location. As you've seen, cross-references need to be inserted manually. You might post a query in the InDesign scripting forum to see if someone has figured this out. If there's no complete solution, you might want to ask about a script that searches for the ends of paragraphs of the autonumbered paragraph style and opens the Insert Cross-Reference dialog box.
    Using Quick Apply to execute the Insert Cross-References command, which opens the New Cross-References dialog box, might save some energy for doing the many manual cross-references insertions. Search Google for terms like "InDesign quick apply" without quotes. You can open Quick Apply with a keystroke shortcut - Cmd+Return on Mac. You can type abbreviated commands. I use "rt cr" without quotes for (Inse)rt cr(oss-reference). Opening Quick Apply repeats the last command that was entered.
    Also, if you haven't tried a Google search for phrases like "InDesign numbered list at right end of paragraph," without quotes, give it a try. There are lots of links, including one to this forum article. Perhaps there's a golden nugget among them.
    If you think it's important for ID to be able to place autonumbers at the ends of paragraphs, please post a formal feature request here: Wishform Eventually, some user originated feature requests are incorporated in future ID releases.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices

  • Batch rename files that have non consecutive numbers?

    I have a folder with about 100 image files that have non consecutive numbers. Is there a way to rename them all to add something after the numbers (and before file type extension) without changing the numbers?
    Example: If I select 111019.003.dng and 111019.007.dng, is there a way to batch rename to 111019.003_tk.dng and 111019.007_tk.dng?
    Of course, simply batch renaming w/ a sequence number would change them to 111019.003_tk.dng and 111019.004_tk.dng. Which is no good.
    I realize the easiest way around this is to name them correctly the first time, but I am not the photographer.
    Hope this makes sense, and thanks.

    You can bulk rename in Bridge IE:-

  • Consecutive numbers

    I have a requirement where I have to store consecutive numbers (permanently not virtual) for customers. I can 't use a sequence hence there is a possibility of rollback, I can't produce them at application level as concurrence strucked may way.
    any inputs please.
    Thanks,
    Hesh

    Billy Verreynne wrote:
    This seems a little rash to me;It is intend to be as this is a fundamental issue that can turn any RDBMS into a useless door stop.
    But it is still a valid requirement, that was only point I was making. The fact the solution will almost certainly be inelegant, usually serialized and most probably turn the RDBMS into a useless doorstop doesn't alter that.
    There are legal requirements in some countries for certain kinds of businesses to assign consecutive document numbers to each financial document they produce.And this appears on what? The actual document captured usually. Which means that Oracle does not have to generate it and you simply need an entry field as part of the data capture processes to obtain the number.
    My understanding is that it is a mechanism for implementing financial controls, although as I said I've never had to use it.
    In the few cases where it needs to be generated, due to some weird law, there are far better ways to deal with it - like normalising that as a separate entity that describes the document. Simple example. Your FINANCIAL_DOCS table uses a surrogate key, generated from a standard Oracle sequence. There are no enforced serialisation on this table as a result. A separate table UNIQUE_FDOC_NUMBER contains the surrogate key, and the gap free sequence number.
    The latter table is updated by a separate process - this one enforces serialisation as it has no choice.
    When inserting a new financial document, the main table is inserted into - no serialisation. And can be committed. A separate PL/SQL call is then needed to make that document "permanent" and assign a gapfree number to is via the 2nd table. Also, once such a number is assigned, the source row can no longer be deleted as that will cause a missing document and a gap in the document numbering range.
    This separate call can now be used where it is meaningful (e.g. nightly batch job that makes all new documents, permanent ) - and where it has the minimal performance impact.And if the requirement is that the document cannot be saved without a gapless sequence number?
    Even so, I would still argue that the law that requires this, is not fully understood - as even such a law must take cognisance of the fact that documents lapse, are removed, looses their "legal status", are replaced, and so on. And this will result in a list of current legal documents that do have sequential numbering gaps in them.
    This may be the purpose of gapless sequences in Oracle Financials (I don't know); laws don't comply with either good system design principles or RDBMS functionality, it is the system design that must comply with the law. Try arguing with the authorities about whether you owe them money or not if you don't have the documents to back up your case. In my experience, the intersection between legal requirements, accounting standards and systems design is an ugly place to be if you are a systems designer. There is almost always a better solution which requires less work, will run like the wind, be technically elegant and have far fewer support issues. You just never get to build it because it doesn't comply with the law.

  • Consecutive numbers in java?

    I am creating a slot machine class with 3 rotating disks and every disk contains the integers 0 - 9. The user will input 3 numbers of their choosing and the amount they are wagering. I am only to use if statements, i cant use arrays or random number generators or anything like that. I am having difficulty figuring out how i would tell my program to check the numbers the user inputs to make sure they are consecutive numbers in ANY order. Any number meaning it could be 1 2 3, 1 3 2, 2 1 3, 2 3 1, 3 2 1, 3 1 2.
    so far i've got this for my slot machine class:
    public class SlotMachine
    private int DiskOne;
    private int DiskTwo;
    private int DiskThree;
    private int AmountWagered;
    public SlotMachine(int diskOne,int diskTwo,int diskThree,int amountWagered)
    this.DiskOne = diskOne;
    this.DiskTwo = diskTwo;
    this.DiskThree = diskThree;
    this.AmountWagered = amountWagered;
    public int getDiskOne()
    return this.DiskOne;
    public int getDiskTwo()
    return this.DiskTwo;
    public int getDiskThree()
    return this.DiskThree;
    public int getAmountWagered()
    return this.AmountWagered;
    public String amountWon()
    if (DiskOne == DiskTwo && DiskTwo == DiskThree)
    return "All 3 Numbers The Same" + AmountWagered * 100;
    else if(DiskOne == DiskTwo || DiskTwo == DiskThree || DiskOne == DiskThree)
    return "Any 2 Numbers The Same" + AmountWagered * 4;
    else if() // This is where i need some help =/ anyone?
    return "3 Consecutive Numbers In Any Order" + AmountWagered * 20;
    else
    return "You Lose";
    }

    okay here it goes.
    Arithmetic progression talks about sequence of numbers
    Let the master sequnce of numbers be
    1 2 3 4 5 6 7 8 9and occurance of sub sequence of the above sequence is to be detected.
    (For simplicity we assume sequence starts from ONE)
    Arithmetic progression says
    T(n) = a+ (n-1)*d
    where
    a = fist term of the progression
    T(n) means number that occurs at Nth position
    d = common difference between two consecuitive numbers'd' would be ONE for the original sequence, as each consecutive number is ONE greater than the previous one.
    POSITIVE SCENARIO:
    Let the input sequence be
    7 6 8First arrange this in increasing order and the sequence becomes
    6 7 8Now this CAN be arithmetic progression (but we still dont know now!)
    This is how we validate-
    a = 1 (as the sequence starts from 1)
    n = 6 (first number after arranging in ascending order)
    (In other words, I'm saying that 6th position in original sequence should have '6')
    d = 3rd number - 2nd number = 8 - 7 = 1
    T(6) = a + (n-1) * d
         = 1 + (6-1) * 1
         = 1 + 5
         = 6The above math means that 6th element of the original sequence is '6' which is CORRECT. Let us now check the thrid element of the input sequence 6 7 8
    T(8) = a + (n-1) * d
         = 1 + (8-1) * 1
         = 1 + 7
         = 8The above math means that 8th element of the original sequence is '8' which is CORRECT. The two checks have passed.
    This is what we have done till now: for given sequence of *6 7 8*, we verified that 6th place in the original sequence is '6' and 8th place is '8' as depicted by the input sub sequence *6 7 8*. As both match, the sequence *6 7 8* is declared to be sub sequence of the original sequence. In other words, the input jumbled sequence *7 6 8* is sub sequence of the original sequence irrespetive of the order.
    Note that we sort the numbers to ensure even jumbled input can also be validated!
    NEGATIVE SCENARIO:
    We now check if the logic developed till now does identify wrong sequences as WRONG.
    Let the input now be
    5 9 1Arrange in ascending order first, so the sequence would be
    1 5 9
    a = 1 (as the sequence starts from 1)
    n = 1 (first number after arranging in ascending order)
    (In other words, with this assumption, I'm saying that 1st position should have '1' in the sequence)
    d = 3rd number - 2nd number = 9 - 5 = 4
    T(1) = a + (n-1) * d
         = 1 + (1-1) * 4
         = 1 + (1 - 1) * 4
         = 1 + 0
         = 1The above math means that 1st element of the original sequence is '1' which is CORRECT as depicted by the input sub sequence. Let us now check the thrid element of the input sequence 1 5 9
    T(9) = a + (n-1) * d
         = 1 + (9-1) * 4
         = 1 + (8) * 4
         = 1 + 32
         = 33The above math means that 9th position in the original sequence is 33 which is NOT (the 9th position in the original sequence is 9).
    This is what we have done till now: for given sequence of *1 5 9*, we verified that 1st place in the original sequence is '1' and 9th place is '33' as depicted by the input sub sequence *1 5 9*. As the second check fails, the sequence *1 5 9* is declared that it is not a sub sequence of the original sequence. In other words, the input jumbled sequence *5 9 1* is NOT sub sequence of the original sequence irrespetive of the order.
    Now you put this in a Java program_ :)
    Edited by: DynamicBasics on Oct 21, 2010 1:39 AM
    Corrected formatting tags

  • Can you prevent the use of consecutive numbers in a password, using Group Policy?

    The regular old password complexity requirements disallow the use of 3 consecutive characters that appear in the user's account name / display name, but does not prevent the use of consecutive numbers at all. For example, a user can have a password including
    the string "12345". We have the need to disallow this via GP in order to make our passwords compatible with an outside service to which we would like to synchronize. I see no way to do this with the typical Password Policy settings. Anyone out
    there have any hints as to how I might accomplish this?
    This is on a Windows Server 2008 R2 Domain.

    Am 24.09.2014 um 20:01 schrieb dklein73:
    > We have the need to disallow this via GP in order to make our passwords
    > compatible with an outside service to which we would like to
    > synchronize. I see no way to do this with the typical Password Policy
    > settings. Anyone out there have any hints as to how I might accomplish this?
    You need a custom password filter dll on your DCs:
    http://msdn.microsoft.com/library/ms721766.aspx
    Martin
    Mal ein
    GUTES Buch über GPOs lesen?
    NO THEY ARE NOT EVIL, if you know what you are doing:
    Good or bad GPOs?
    And if IT bothers me - coke bottle design refreshment :))

  • How do you create a column of sequenced dates in Numbers

    How do you create a column of sequenced dates in Numbers without typing in each date? For example: 01/05/15, 01/12/15, 01/19/15, 01/26/15, 02/02/15, etc.

    Hi Cha Ling,
    Another way,
    Enter your first two dates that show the desired interval- i.e. 01/05/15 and 01/12/15.
    Select both cells and choose fill from the contextual menu.
    Drag down to fill your column.
    quinn

  • How do i put a box in my form and have consecutive numbering in it

    How do i put a box in my form and have consecutive numbering in it

    Hi,
    Sorry, this is not supported in Adobe FormsCentral.
    Thanks,
    Lucia

  • Consecutive Numbering in New Documetns (Action)

    Hi all,
    About two years ago I posted this query regarding a possible bug in Photoshop 4.  As much as christoph pfaffenbich tried extremely hard to help me, he was unable to provide a solution.  UNFORTUNATELY, the problem still exists in Photoshop CS 5.1.  Here is the strange problem:
    Way back in CS2 I created an action which basically involves a) copying, b) creating a new document, c) pasting, and d) color correcting. In previous versions of PS, whenever I did this action and it got to part b) (creating a new document), the new doc would have a unique file name from the previous (consecutive numbering). However in CS4 (and now in CS5.1), every new document is given the same name (i.e. "Untitled-1") which wreaks havoc. Does anybody know how to fix this so that I can get my unique naming of new documents back?
    NOTE 1: If I manually create new documents, the unique and consecutive numbering works fine. It is only when the new document is created from within an action that it does not work.
    NOTE 2: Inserting a menu item into the action FILE -> NEW, also does not work.
    Thanks,
    Daniel

    The screenshot of the action steps below may or may
    not work for you, but anyway here's how it works:
    Once you've copied the selection, made a new document 1 px x 1 px and
    pasted, the reveal all step expands the document to the copied selection's pixel dimensions.
    Whether it works for your documents without more intervention depends on if your dealing
    with different bit depths, color modes and color profiles that you would have entered into
    the new document step in the action.
    A scripting solution would probably be more ideal and hopefully someone wiil know if it's
    possible and you could also post in the scripting forum:
    http://forums.adobe.com/community/photoshop/photoshop_scripting
    MTSTUNER

  • HELP: Multiple Consecutive Numbering per Page - Multiple Pages

    I am working with an 8.5" x 11" InDesign document that has eight 4.25" x 2.75" "coupons" per page - see sample below.
    Each coupon will need to be automatically and consecutively numbered 00001-00008 on page 1, 00009-00016 on page 2, etc. prior to printing and cutting into eight individual coupons. I know I can do this manually, but I would rather not since there may end up being dozens of pages.
    My questions...
    - Is this possible?
    - If so, how can this be done using InDesign?
    I appreciate any help!

    There may be a better way to do this but this will work:
    1. Set up your doc as a single page (unselect facing pages)
    2. Go to the master page and place your coupons.
    3. Create 2 columns and adjust your margins and gutter so the columns are the width of the text containing your numbers and in the exact postion. - These columns and margins will be un-usual looking.
    4. Using 6 sets of sample numbers with a return at the end on each one, set 3 in one column and 3 with the 2 frames threaded.
    5. Create a para style and adjust the space after each paragraph so the text in each column lands on the right spot on each coupon
    You doc should be set up. Delete text and go to first page
    6. In Excel or similar create a column (not row) with numbers you need and copy
    7. Place text in first column on P1, select all the text (Ctr/Cmd A) and apply paragraph style you created - the 3 numbers should be in correct position
    8. Click on red + sign, and, holding down Shift, thread remaining text into 2nd column - the text will flow into that column and create all the extra pages for the rest of yur numbers .
    Brian

  • Counting consecutive numbers into one row

    Hello everyone,
    I have recently discovered that we can use Max ( Decode ()) function of Oracle to pivot the results of a table. I have executed this just fine. However, pivoting a table is just one part of the solution that I need. The pivoting function results to something like this:
    01,02,03,05,06,07,08,09,10,11,12,13,14,16,17,20,21,23,25What I actually need is something like this:
    1-17, 20-21,23,25I really don't know how to start solving this but so far I have the below query:
    SELECT DISTINCT
         MAX(DECODE(wldw.wafernumber,'01', '01'))
          || MAX(DECODE(wldw.wafernumber,'02', ',02'))
          || MAX(DECODE(wldw.wafernumber,'03', ',03'))
          || MAX(DECODE(wldw.wafernumber,'04', ',04'))
          || MAX(DECODE(wldw.wafernumber,'05', ',05'))
          || MAX(DECODE(wldw.wafernumber,'06', ',06'))
          || MAX(DECODE(wldw.wafernumber,'07', ',07'))
          || MAX(DECODE(wldw.wafernumber,'08', ',08'))
          || MAX(DECODE(wldw.wafernumber,'09', ',09'))
          || MAX(DECODE(wldw.wafernumber,'10', ',10'))
          || MAX(DECODE(wldw.wafernumber,'11', ',11'))
          || MAX(DECODE(wldw.wafernumber,'12', ',12'))
          || MAX(DECODE(wldw.wafernumber,'13', ',13'))
          || MAX(DECODE(wldw.wafernumber,'14', ',14'))
          || MAX(DECODE(wldw.wafernumber,'15', ',15'))
          || MAX(DECODE(wldw.wafernumber,'16', ',16'))
          || MAX(DECODE(wldw.wafernumber,'17', ',17'))
          || MAX(DECODE(wldw.wafernumber,'18', ',18'))
          || MAX(DECODE(wldw.wafernumber,'19', ',19'))
          || MAX(DECODE(wldw.wafernumber,'20', ',20'))
          || MAX(DECODE(wldw.wafernumber,'21', ',21'))
          || MAX(DECODE(wldw.wafernumber,'22', ',22'))
          || MAX(DECODE(wldw.wafernumber,'23', ',23'))
          || MAX(DECODE(wldw.wafernumber,'24', ',24'))
          || MAX(DECODE(wldw.wafernumber,'25', ',25'))  AS WAFERS     
    FROM a_wiplothistory wl
    JOIN Container C ON (wl.containerid = c.containerid OR wl.containerid= c.splitfromid )
    JOIN a_wiplotdetailshistory wld ON wl.wiplothistoryid = wld.wiplothistoryid
    JOIN a_wiplotdetailswafershistory wldw ON wld.wiplotdetailshistoryid = wldw.wiplotdetailshistoryid
    WHERE c.containername = :lotThanks for helping guys.
    Edited by: 1001275 on May 15, 2013 6:28 PM

    Hi,
    1001275 wrote:
    Hello everyone,
    I have recently discovered that we can use Max ( Decode ()) function of Oracle to pivot the results of a table. I have executed this just fine. However, pivoting a table is just one part of the solution that I need...You said it!
    First, you need some way of grouping consecutive rows together (1-17 in one group, 20-21 in anoter, 23 as a group all by itself, and so on).
    Then you need GROUP BY to get infmation about each goup, such as the smallest and largest number in the group.
    Finally, you need to combine all that information into one big string. This is actually an example of String Aggregation , rather than pivoting. The two are closely related. Pivot means you're taking 1 column on multiple rows, and putting them into multiple columns on one row. String Aggregation is taking 1 column on multple row, and concatenating all their contents into one big string column.
    Here's one way to do it:
    WITH     got_group_id     AS
         SELECT     wafernumber
         ,     ROW_NUMBER () OVER (ORDER BY wafernumber)
                      - wafernumber          AS group_id
         FROM     wldw
    ,     got_group_info     AS
         SELECT       TO_CHAR (MIN (wafernumber))
                || CASE
                         WHEN  COUNT (*) > 1
                    THEN  '-' || TO_CHAR (MAX (wafernumber))
                     END             AS group_label
         ,       ROW_NUMBER () OVER (ORDER BY  MIN (wafernumber))
                             AS group_num
         FROM      got_group_id
         GROUP BY  group_id
    SELECT  SUBSTR ( SYS_CONNECT_BY_PATH (group_label, ',')
                , 2
                )     AS txt
    FROM    got_group_info
    WHERE     CONNECT_BY_ISLEAF     = 1
    START WITH     group_num      = 1
    CONNECT BY     group_num     = PRIOR group_num + 1
         AND     prior sys_guid () is not null
    ;I find the first part of this query to be the trickiest. I used the Fixd Difference technique to assign a common group_id to consecutive rows. See {message:id=9953384} and/or {message:id=9957164} foran explantaion of the Fixed Difference technique.
    Next, in sub-query got_group_info, I used aggregate functions to produce a group_label, such as '1-17', and to assign consecutive numbers to each group. This is also a little tricy, because it involves nesting an aggregate function (MIN in this case) inside an analytc function (ROW_NUMBER).
    Finally, I used SYS_CONNECT_BY_PATH to do the string aggregation.
    Output:
    TXT
    1-17,20-21,23,25Whenever you have a question, please post CREATE TABLE and INSERT statements for some sample data. For example:
    CREATE TABLE     wldw
    (       wafernumber     NUMBER (3)     PRIMARY KEY
    INSERT INTO wldw (wafernumber) VALUES ( 1);
    INSERT INTO wldw (wafernumber) VALUES ( 2);
    INSERT INTO wldw (wafernumber) VALUES ( 3);
    INSERT INTO wldw (wafernumber) VALUES ( 4);
    INSERT INTO wldw (wafernumber) VALUES ( 5);
    INSERT INTO wldw (wafernumber) VALUES ( 6);
    INSERT INTO wldw (wafernumber) VALUES ( 7);
    INSERT INTO wldw (wafernumber) VALUES ( 8);
    INSERT INTO wldw (wafernumber) VALUES ( 9);
    INSERT INTO wldw (wafernumber) VALUES (10);
    INSERT INTO wldw (wafernumber) VALUES (11);
    INSERT INTO wldw (wafernumber) VALUES (12);
    INSERT INTO wldw (wafernumber) VALUES (13);
    INSERT INTO wldw (wafernumber) VALUES (14);
    INSERT INTO wldw (wafernumber) VALUES (15);
    INSERT INTO wldw (wafernumber) VALUES (16);
    INSERT INTO wldw (wafernumber) VALUES (17);
    INSERT INTO wldw (wafernumber) VALUES (20);
    INSERT INTO wldw (wafernumber) VALUES (21);
    INSERT INTO wldw (wafernumber) VALUES (23);
    INSERT INTO wldw (wafernumber) VALUES (25);I realize that your table (and your query) are a lot more complicated, but it looks like you can show the part you don't already understand using just this one table with this one column.
    Also, whenever you have a question, say which version oif Oracle you'e using (e.g., 11.2.0.2.0).
    The query above should work in Oracle 10.1 and up. I got the wong results in the main query in Oracle 10.2, however. (Oracle 10.2 has a lot of bugs related to CONNECT BY.) It worked fine in version 11.1.
    If you're using Oracle 11.2, you'll want to use LISTAGG, not SYS_CONNECT_BY_PATH, to do the string aggregation.
    For more about string aggregation in various versions of Oracle, see this Oracle Base page.

  • Sequence generating duplicate numbers

    Hi guys,
    this might be more of a DBA question type... we had a situation where we copied data (once full schema and other time only tables ) from one database to another but ended up having sequence problem because new sequence was generating numbers which were lower than previousley generated one !
    I wonder if anyone had similar problem or know what could be causing it.
    when we copy full schema this happens to random table/sequences.
    Thanks for reading.
    Ali

    The sequence skipping behaviour is seen when cached sequences are exported.
    From the Oracle utilities manual
    >
    If transactions continue to access sequence numbers during an export, sequence numbers might be skipped. The best way to ensure that sequence numbers are not skipped is to ensure that the sequences are not accessed during the export.
    Sequence numbers can be skipped only when cached sequence numbers are in use. When a cache of sequence numbers has been allocated, they are available for use in the current database. The exported value is the next sequence number (after the cached values). Sequence numbers that are cached, but unused, are lost when the sequence is imported.
    >
    Hope this helps
    Varad

  • Can a sequence generate negative numbers?

    Hi
    Thank you for reading my post
    i think my sequence generate negative numbers , is it possible ?or somewhere in my application is incorrect ?
      CREATE SEQUENCE  "HR"."GLOB_SEQ"  MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 5 NOCACHE  ORDER  NOCYCLE ;is there anything that i made wrong which caused the negative numbers in my edit box ?
    type of my category_ID is number.
    Thanks

    Generally speaking yes you can generate negative numbers:
    SQL> create sequence seq1 increment by -1;
    Sequence created.
    SQL> select seq1.nextval from dual;
    NEXTVAL
    -1
    SQL> /
    NEXTVAL
    -2
    But if you have defined minvalue as 1 it is impossible because:
    SQL> create sequence seq1 increment by -1 minvalue 1 maxvalue 1000000 start with 1;
    Sequence created.
    SQL> select seq1.nextval from dual;
    NEXTVAL
    1
    SQL> /
    select seq1.nextval from dual
    ERROR at line 1:
    ORA-08004: sequence SEQ1.NEXTVAL goes below MINVALUE and cannot be instantiated
    SQL>
    So most probably someone simply inserted a row with negative values knowing that they'll never be in conflict with sequence generated values, or your code is buggy :)
    Generally for surrogate keys (assuming this is your case) you don't care what values they have.
    Gints Plivna
    http://www.gplivna.eu

  • Help needed to set consecutive numbering in table rows

    I need to set up a table so that the first column is a column of consecutive numbers (much like the record count).
    The table will be followed with a text frame, and then a new table will start.
    HOWEVER. I wanted to numbers in the first column to continue consecutively.
    I am using this for a lengthy explanation of technical instructions: one instruction/ per line.
    There will be about 1000+ instructions over the course of this 200-page book. The second column contains a checkbox, which is why I am having problems setting this up in an ordinary word-processing program, because of export issues (Dont ask). The third column contains the instruction.
    I am hoping that Numbers will solve my formatting problems.
    *Is there a simple way to set up the first table column in a sheet to number the rows consecutively, and continue the numbering each time a new table is inserted?*
    I hope I have explained this well enough.

    Fred, is it possible for this to work with other number related items. I'm talking specifically about sequential inventory numbers. At work I used excel, but now that computer is dead, and I'm working from home. I've refused to install microsoft products on my home machine for quite a while. I love numbers, and am glad it's out, so I am never even tempted by the "devil". Sorry got off topic.
    Essentially I used to write BLX-001 in cell one, BLX-002 in cell two, then do the drag method. When I have text in the Numbers cell though it won't give consecutive numbers, just continually repeat the numbers in the first two cells. Any helps

  • Create/update consecutively-numbered markers?

    I have a 200+-page CS5 document in which I need to place several hundred consecutively-numbered markers. There may be anywhere from 0 to 12 markers on a page, and they must be numbered left-to right, top to bottom from the beginning to the end of the document. I will occasionally have to insert or delete markers, requiring subsequent markers to be renumbered.
    Does this require a script, or could I do something with footnoting? Or outlining? Wouldn't I have to link the text boxes to make either of those work?
    I have done this for smaller documents where I had to manually number/renumber every marker, but in a document this size, that would take hours.
    I am comfortable with programming, and have a very slight familiarity with JavaScript, but not a clue where to start for something like this. Any pointers would be greatly appreciated.

    I'm not sure what you mean by "markers". If you mean you need to number
    certain paragraphs, take a look at my "Line Numbers" script on
    www.freelancebookdesign.com (under the scripting tab).
    It has several options which makes it fairly flexible -- including only
    numbering certain paragraph styles, consecutive numbering throughout the
    document, etc.
    Ariel

Maybe you are looking for