Counting consecutive numbers in a view

Say I have the following data in a table:
ID YEAR
1 2004
1 2005
1 2006
1 2008
1 2009
2 1998
2 1999
2 2000
Is there anyway to return a 3rd row in a query which would return a 1 if the previous rows YEAR was 1 different, but a 0 if otherwise. So the data would look like this:
ID YEAR COUNT
1 2004 0
1 2005 1
1 2006 1
1 2008 0
1 2009 1
2 1998 0
2 1999 1
2 2000 1
2 2001 1
2 2002 1
2 2006 0
I am basically trying to find out if someones yearly membership was a renewal. Here's the data:
with t1 as (select 1 as ID,2004 as YEAR from dual union
select 1,2005 from dual union
select 1,2006 from dual union
select 1,2008 from dual union
select 1,2009 from dual union
select 2,1998 from dual union
select 2,1999 from dual union
select 2,2000 from dual union
select 2,2001 from dual union
select 2,2002 from dual union
select 2,2006 from dual)
select ID,
YEAR
from t1
order by id, year;
Thanks,
Andrew

Thanks for providing sample data and expected results!
I think this is what you want.
SQL> with t1 as (select 1 as ID,2004 as YEAR from dual un
  2  select 1,2005 from dual union
  3  select 1,2006 from dual union
  4  select 1,2008 from dual union
  5  select 1,2009 from dual union
  6  select 2,1998 from dual union
  7  select 2,1999 from dual union
  8  select 2,2000 from dual union
  9  select 2,2001 from dual union
10  select 2,2002 from dual union
11  select 2,2006 from dual)
12  SELECT  ID
13  ,       YEAR
14  ,       (CASE
15                  WHEN YEAR - LAG(YEAR) OVER (PARTITION BY ID ORDER BY YEAR) = 1
16                  THEN 1
17                  ELSE 0
18          END) AS RENEWAL
19  FROM    t1
20  ORDER BY ID
21  ,       YEAR
22  /
        ID       YEAR    RENEWAL
         1       2004          0
         1       2005          1
         1       2006          1
         1       2008          0
         1       2009          1
         2       1998          0
         2       1999          1
         2       2000          1
         2       2001          1
         2       2002          1
         2       2006          0
11 rows selected.

Similar Messages

  • 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.

  • 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

  • Count consecutive appeareance

    Hi,
    I had a requirement like this
    <pre>
    In Table View output is like this
    ID STATUS     DATE
    101     01     03-01-11
    101     02     09-02-11
    101     03     11-03-11
    101     02     06-04-11
    101     02     07-05-11
    101     03     09-06-11
    101     02     14-07-11
    101     02     15-08-11
    101     04     12-09-11
    101     03     10-10-11
    101     03     12-11-11
    101     03     08-12-11
    </pre>
    <pre>
    Required Output should be like this - for ID 101 and STATUS '01' is not required
    STATUS     1Time     2Time     3&4Time          5&above
    02     1     2
    03     2          1
    04     1
    </pre>
    Columns 1Time, 2Time,3&4Time, 5&above means count the number of consecutive appeareance of the status (have to check previous month status and next month status)
    i.e for example if we take Status '02'
    after checking previous month and next month status, Status '02' has appeared one time consecutively on '01-02-11'(Feb)
    and hence 1 should come under '1Time' Column.
    similarly after checking previous month and next month status, the number of 2 consecutive appereance of status '02' is twice, that is on ('01-04-11', '01-05-11') and ('01-07-11', '01-08-11'),hence the count of them will 2 under '2Time' column
    For Status '03',
    there are two one-time consecutive appeareance of the Status, that is on '01-03-11' and '01-06-11'. Hence count is 2 under '1Time' column for status 03
    and Status '03' has single 3 consecutive appearance, that is on '01-10-11', '01-11-11', '01-12-11', hence count is 1 under 3&4Time coulmn.
    Regards
    mohan

    I did answer your question in the other forum:
    Count consecutive appearance
    hm

  • 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 :))

  • Can Numbers Display Multiple Views of the Same Table

    Hi,
    Excel and Appleworks both have a pull down tab on the vertical bar allowing multiple views into the same spreadsheet (table). Can Numbers do this?
    I have a set of calculations at the top of a spreadsheet that are based on years and years worth of data under the calculations (same column). I add data for each new event (the rows) and watch the calculations at the top of the data. Easy to do in Excel or Appleworks, but, I can't figure out how to do this in Numbers.
    Example:
    Spot1 Spot2
    Total 15 36
    Avg 5 12
    Jan 09 5 10
    Feb 09 6 20
    Mar 09 4 6
    Apr 09
    So... does Numbers allow the view "split" or multiple views that Excel and Appleworks allow?
    Thanks!
    Tom

    Question asked and responded several times:
    feature unavailable.
    For multiple views of a table there is an easy workaround as we may build a table whose every cells grab their contents from the 'master' one.
    _Go to "Provide Numbers Feedback" in the "Numbers" menu_, describe what you wish.
    Then, cross your fingers, and wait _at least_ for iWork'10
    Yvan KOENIG (VALLAURIS, France) mardi 1 septembre 2009 21:56:42

  • Is it possible to show play counts in Artists or Album view in iTunes 11?

    There are some beautiful new changes to iTunes 11, but also some things I really like have been taken away. One of them is being able to see my playcouts as I browse. Not just in the playlist or songs list view.
    Does anyone know if there is any way to show play counts in Artists or Album view in iTunes 11?

    Post Author: kcornett
    CA Forum: General
    typo... sorry
    I have 3 product codes that I want to report on - Mold, Repair, and Production.  For Mold and Repair, I want to print out only the top 1 job for each order.  For Production, I want to print all jobs.  I have GH1 to group by ProdCode.  GH2 groups by Orders.  Detail A section has a formula to suppress if ProdCode = Production.  Detail B suppresses if ProdCode is not Production.  I can get the suppresion to work but I don't know how to get the Top 1 to show when Detail A is shown.
    Obviously I'm new at Crystal Reports - about 3 weeks.
    Thanks for your help...
    Keith
    ps: what are the Tags for when posting?

  • 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

  • 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

  • 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

  • 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

  • Count consecutive days in array

    Hi,
    I'm looking for an algorithm to count consecutive days in array, but i don't find one.
    for example, if i have this array.
    2009/07/01
    2009/07/02
    2009/07/03
    2009/07/06
    2009/07/08
    2009/07/09
    2009/07/10
    2009/07/11
    The result be
    3
    1
    4
    Anyone have one?
    Thanks for all.

    jverd wrote:
    kajbj wrote:
    It's a fairly specialist algorithm so you are unlikely to find someone to post a solution. By just keeping a reference to the previous date, it is easy to iterate though the list counting consecutive dates.I think the trick to making this algorithm sucessful is to make sure that when you change months your algorithm doesn't set consec_days to 0 Why not?Presumably he's talking about this case:
    7/31
    8/1
    and not this case
    7/1
    8/1
    So he really should have said, "...when you increment month by one, or from 12 to 1, and the day went from the last day of the old month to 1, don't set consec_days to 0"Ok. I would use the Calendar class and SimpleDateFormat. The tricky part would otherwise be to keep track of days per month, and leap year.

  • 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.

Maybe you are looking for

  • MBP restarts on it's own at least twice a day. Very annoying. Please help.

    here's the log please let me know if there's anything else I can post to help find a solution to this problem. I was at apple today and I saw the "genius" pull up a screen that showed what app or thing that was causing my mbp to crash each time but I

  • Is it possible to accessOracle Lite with java on a Palm

    I have been unable to figure out how to do any java development against OracleLite on a Palm. I am using IMB's VAME/J9 java development environment. It appears that the oracle.lite.poljdbc.POLJDBCDriver class expects to load a library called oljdbc.

  • Applications not opening after choosing "update all" in itunes

    Hi, Bug : I downloaded "Speedtest.net Mobile Speed Test" by Ookla, and recently noticed that there was an update for this application in itunes. When I went to itunes and chose "update all", the application updated. However after the update I was una

  • Answer for a strange Interview Question

    Hi Guys. I gave an Interview and was asked a strange question. the Question is which two object in IR cannot be transported via CTS + . As far As I know everything can be transported using CTS+ even the JAR files . If any one know can you please let

  • Calculation before aggregation

    Hello BW Guru's What does this calculation before aggregation mean ? In which situation we use the above setting ? when we can use this option in Modelling and when we can use this option in reporting ? I am zero with this.. please explain me with a