Find the missing series or page n

I have a table

document_sl_no, from_page, book_no, to_page

1                              1          1               9

2                              1          10             12

3                              1          18              33

Documents binded in the books and the Livre_No is entered in the database, so that if we find the hard copy of the document we can search easily.

I need to write a query that miss me page in the pagination sequence book will give.

as in the above example page No 13,14,15,16,17 are missing.

Y at - it no way out.

I was tring to get the sequence first then thought to find the missing sequence using advance or delay.

So any suggestions to get the sequence of this wise Livre_No table

Livre_No page_no

11
12
13
14
15
16
17
18
19
110
111
112
118
119
120
121
122

Something like this:

books (book_no, from_page, to_page) as)
Select 1,1,9 from all the double union
Select 1,10,12 from all the double union
Select double 1,18,33
)
run like)
Select
Livre_No
from_page
to_page
, (from_page, 1, to_page) ahead of (Livre_No order of from_page partition)
-to_page diff
books
)

Select
Livre_No
from_page
to_page
, case when diff > 2 then
diff-1 | "the missing pages after" | to_page
lack of end
leaks

BOOK_NO FROM_PAGE TO_PAGE MISSING
1 1 9 -
1 10 12 5 missing pages after 12
1 18 33 -

Tags: Database

Similar Questions

  • Find the missing numbers

    I want to find the missing of a column that is alphanumeric numbers, its last five positions are digital. In the first three places there are different combinations of alphas that is * 'BA', 'BAW","SA","SAA"... * If alphas are two then 3rd position is empty. I also need to generalize this to cover all digital series existing alpha.
    SELECT SUBSTR (a.claim_no, 4, 5) + 1
      FROM core_business.cb_pensioner a
     WHERE SUBSTR (a.claim_no, 1, 3) = 'BA '
       AND NOT EXISTS (
                     SELECT NULL
                       FROM core_business.cb_pensioner b
                      WHERE to_number(SUBSTR (b.claim_no, 4, 5)) =  to_number(SUBSTR (a.claim_no, 4, 5)) + 1) 
       order by SUBSTR (a.claim_no, 4, 5);
    I get the error ORA-01722

    You have two problems with this task.

    1 problem is how to convert a number from the back so that you can compare the values.

    to_number(SUBSTR (b.claim_no, 4, 5)) 
    

    works, but only if the b.claim_no value is always a number regardless of the other criteria of the column.

    Such an assertion

    ...
    WHERE SUBSTR (a.claim_no, 1, 3) = 'BA ' /* filter 1 */
    and to_number(SUBSTR (b.claim_no, 4, 5)) > 1 /* filter 2 */
    ...
    

    may fail because your table can have value as

    b.claimno = "XYZ1234b".

    The way you wrote the query of the database will decide what filter criteria, it first runs. It could be filter1, but could also be filter2. If filter2 is executed first, you will get the error message.

    Problem 2 how to order and compare different lines, so that you can find the missing values.

    Here the analytical function of the LEAD (LAG) is very useful. It gives you access to the next (or previous row).

    Both problems can be overcome.

    Here is my test, but I don't know if it works in your case. You may have to adapt a little.
    This should work if all lines are digital which belong to specific groups. If you have too much data incorrect in there, then a different approach is necessary.

    with testdata as (select 'XYZ1234b' claim_no from dual union all
                select 'BA 12345' claim_no from dual union all
                select 'BA 12346' claim_no from dual union all
                select 'BA 12350' claim_no from dual union all
                select 'BAW11111' claim_no from dual union all
                select 'BAW11113' claim_no from dual union all
                select 'XYZ1234b' claim_no from dual )
    /* end of test data creation */
    select claim_no, substr(claim_no, 1,3) part1, substr(claim_no, 4) part2,
           to_number(substr(claim_no, 4)) current_num,
           lead(to_number(substr(claim_no, 4))) over (partition by substr(claim_no, 1,3) order by to_number(substr(claim_no, 4))) next_num,
           lead(to_number(substr(claim_no, 4))) over (partition by substr(claim_no, 1,3) order by to_number(substr(claim_no, 4)))
            - 1 - to_number(substr(claim_no, 4))
            as "missing_values"
    from testdata
    where substr(claim_no, 1,3) in ('BAW','BA ')
    order by claim_no;
    
    CLAIM_NO PAR PART2 CURRENT_NUM   NEXT_NUM missing_values
    -------- --- ----- ----------- ---------- --------------
    BA 12345 BA  12345       12345      12346              0
    BA 12346 BA  12346       12346      12350              3
    BA 12350 BA  12350       12350
    BAW11111 BAW 11111       11111      11113              1
    BAW11113 BAW 11113       11113
    

    1 problem is solved because where condition is always executed before the function in the select clause, in particular in the context of an analytic function.
    Problem 2 is also solved by using the analytical function, function LEAD. And it's fast, because you access the same table only once. Another solution could be a subquery to extract the value of the next line. This means that multiple access to the same table and is usually much slower.

    Published by: W. Sven 20 Sep, 2010 14:32

  • I'm unable to find the missing drivers on my device manager.

    OT: Re: lack of pilots.

    Hello

    I'm unable to find the missing drivers on my device manager. A unknown device watch. Other shows, like in the storage controllers. I checked Windows update, but it does not find the missing drivers. I don't have the drivers on my CD.

    Please download and run the display driver and download a copy of the report he produced on your OneDrive. To obtain a report all drivers Select Edition, select all followed by file, save selected items.
    http://www.NirSoft.NET/utils/DriverView.html

    Please provide a copy of your system information file. Type the system information in the search box above the Start button and press the ENTER key (alternative is select Start, all programs, accessories, System Tools, system information). Select file, Export and give the file a name noting where it is located. Not to place the cursor in the body of the report before exporting the file. The system creates a new information file system each time system information is available. You must allow a minute or two before the file is completely filled before exporting a copy. Please download the file to your OneDrive, to share with everyone and post a link here. Normal mode preferred report. Please say if the report was obtained in safe mode. The request for a copy of this file is additional to answer the question about the brand and the model. If the report is in one language other than English, please indicate the language.

    For assistance OneDrive see paragraph 9.3

    http://www.gerryscomputertips.co.UK/MicrosoftCommunity1.htm

  • Where can I find the Canadian driver Toshiba page

    Please, I beg you! Help me. Could you support me direct link to the driver set (driver page)?
    I could find the driver Canady!

    Here is a link to the page of the European driver Toshiba

    How about this way:
    http://EU.computers.Toshiba-Europe.com/-> support download &-> download drivers

    There, you can search in different categories!

    * EDITION: *.

    Also here is a link to Toshiba Canada page:
    http://support.Toshiba.ca/support/download/ln_byModel.asp

  • How can I find the missing e-mails Outlook Express6

    All messages in the Inbox disappears from 13/04.I I receive all messages from 14/04.Please someone help me find my old emails.

    Just to elaborate on the correct assessment of Steve.

    Two reasons the most common for what you describe is disruption of the compacting process, (never touch anything until it's finished), or bloated folders. More about that below.

    Why OE insists on compacting folders when I close it? :
    http://www.insideoe.com/FAQs/why.htm#compact
     
    Why mail disappears:
    http://www.insideoe.com/problems/bugs.htm#mailgone
     
    About file Corruption:
    http://www.Microsoft.com/Windows/IE/community/columns/filecorruption.mspx

    Recovery methods:

    If you use XP/SP2 or SP3, and are fully patched, then you should have a backup of your dbx files in the Recycle Bin (or possibly the message store), copied as bak files.

    To restore a folder bak on the message store folder, first find the location of the message store.

    Tools | Options | Maintenance | Store folder will reveal the location of your Outlook Express files. Note the location and navigate on it in Explorer Windows or, copy and paste in start | Run.

    In Windows XP, the .dbx files are by default marked as hidden. To view these files in the Solution Explorer, you must enable Show hidden files and folders under start | Control Panel | Folder options | View.

    Close OE and in Windows Explorer, click on the dbx to the file missing or empty file, then drag it to the desktop. It can be deleted later once you have successfully restored the bak file. Minimize the message store.

    Open OE and, if the folder is missing, create a folder with the * exact * same name as the bak file you want to restore but without the .bak. For example: If the file is Saved.bak, the new folder should be named saved. Open the new folder, and then close OE. If the folder is there, but just empty, continue to the next step.

    First of all, check if there is a bak file already in the message. If there is, and you have removed the dbx file, go ahead and rename it in dbx.

    If it is not already in the message, open the trash and do a right-click on the file bak for the folder in question and click on restore. Open the message store up and replace the .bak by .dbx file extension. Close the message store and open OE. Messages must be in the folder.

    If messages are restored successfully, you can go ahead and delete the old dbx file that you moved to the desktop.
     
    If you have not then bak copies of your dbx files in the Recycle Bin:

    DBXpress run in extract disc Mode is the best chance to recover messages:
    http://www.oehelp.com/DBXpress/default.aspx

    And see:
    http://www.oehelp.com/OETips.aspx#4

    A general warning to help avoid this in the future:

    Do not archive mail in default OE folders. They finally are damaged. Create your own folders defined by the user for mail storage and move your mail to them. Empty the deleted items folder regularly. Keep user created folders under 300 MB, and also empty as is possible to default folders.

    Disable analysis in your e-mail anti-virus program. It is a redundant layer of protection that devours the CPUs, slows down sending and receiving and causes a multitude of problems such as time-outs, account setting changes and has even been responsible for the loss of messages. Your up-to-date A / V program will continue to protect you sufficiently. For more information, see:
    http://www.oehelp.com/OETips.aspx#3

    And backup often.

    Outlook Express Quick Backup (OEQB Freeware)
    http://www.oehelp.com/OEBackup/default.aspx

  • two of my sent files are missing from windows mail, and I am unable to trace it? Please let me know how to find the missing folder

    Until a few days back all sent files has been noticed but suddenly two of the sent files are missing and I am unable to find the same.  I use vista and windows mail.  Please let me know how recover/find missing files.

    Thank you
    Mahesh

    Try searching *.eml and make sure you include hidden files and folders in the search parameters.  See also here for the Organization of store message (www.oehelp.com/backup.aspx#wm).  You should be able to use the browser to go to the directory of sent items under the directory of local records and the actual messages will be located there.  It may be useful to compact and repair the database (see www.oehelp.com/WMUTil/) and make sure that everything in the folder, you saw the value. Current view | Show all messages.

    Steve

  • How to find the 'missing' images easily in LR 3?

    In the beginning (I'm a technoidiot), I made some mistakes and stored images in 3 places.  To try to consolidate, I moved files and now some of the images "be found" by LR.  I am currently looking looking up the number of the image one at a time.

    In the library module, look at the on the left side.

    See all "missing files"?

    If so, just find the file to LR and all images of thhe in this folder will be re-found, too.

    If you don't have missing files and you need images, then you can always follow these steps:

    Right-click on the folder (in Control Panel folder) and click on "synchronize the folder. LR then check the file and images that are not in the record of exit and re - import those that you put in this folder.

    You can also do this with your parent folder and Sub folders will be synchronized.

    And don't forget: If you want to move pictures or folders around, always do go in LR (drag / move). This way above any change syou stay LR will do.

    WW

  • Find the missing numbers in a sequence

    Hello

    We have an ORDH table, which is having an ORDERNO field which starts from 300000. currently there are approximately 100 000 documents exist in this table.
    The ORDERNO value is generated from a sequence.
    We want to find missing persons (hole in the sequence) ORDERNO from the ORDH table.
    (Ex: 300654 is missing and there are many others also missing order numbers)
    Is it possible to find all the numbers missing command in this table?

    Thanks and greetings
    Murali

    Hi, Murali,

    This will show you the missing channels in numbers between existing numbers:

    WITH     got_next_orderno     AS
    (
         SELECT     orderno
         ,     LEAD (orderno) OVER (ORDER BY orderno)     AS next_orderno
         FROM     ordh
    )
    SELECT     ordrno + 1          AS from_no
    ,     next_orderno - 1     AS to_no
    FROM     got_next_orderno
    WHERE     orderno     + 1     != next_orderno
    ;
    

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and INSERT statements) and the results desired from these data.

  • find the nr series of one computer, that a particular hard disk is too

    Hi all

    I was wondering if there is a solution to the following problem:
    I'm HIM offer support for a company using Lenovo Thinkpad T410-T420 and T430. We have many systems used in stock with a password for the user in this regard. I have

    Unfortunately, we do not know these passwords, however we have a tool where we can find the admin password and we are able to start those used systems.
    Now problems occur when the hard drive has been replaced on this system. Is there a way to know which computer hard drive was to find the admin password?

    Hope you can help me

    Kind regards

    Stefan

    Welcome to the forum!

    stefanbonnarens wrote:

    Now problems occur when the hard drive has been replaced on this system. Is there a way to know which computer hard drive was to find the admin password?

    No it's not.

    Please note that all discussion related to the methods of cracking and/or password in order to bypass the machine safety devices is NOT allowed by the rules of the forum.

    Clean the discs, re - install the operating system and be done with it. This is the * only * way correct, legal and legitimate to deal with the issue.

    Good luck.

  • find the longest series of equal values in table

    Hello

    I had an array with Boolean values, something like this

    [TTFFFFFFFFFFFFTTFFTTT]

    and I need to find the longest window were the elements of the array is equal, in the above example, I want to find the index 2 and length 12 for longer window F and index 18, length 3 to T. everyone who has an idea how I can do this?

    Hello Tudor,

    There is so far, I don't know any loan service in labview to do what you want. However this seems not really hard to do.

    You can link your table for a loop and to compare with each iteration, the current Boolean value to the previous. If the two are combined, for example, you can increment a counter until one is true and the other false. Then you can record the length in a separate shift register if this length is greater than pre-existing (initialize to 0).

    On the index, you can save the terminal in the County of the foor in a turn loop register when the value N-1 of your table is different from the value of N, the following difference, if the length is the longest, you save this count minus one in another register.

    I hipe this helps you.

    Concerning

  • Find the missing documents and insert accordingly

    Oracle version: Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production

    Hello gurus

    I'm really grateful if someone would help out me. Thanks in advance

    Examples of data

    Drop, the creating and inserting in tables

    drop table TYPE_MST;
    drop table TYPE_VERSION;

    -------------------------
    Create Tables:

    create the table TYPE_MST
    (
    Type_desc varchar2 (15)
    );

    -----------------

    Table insert

    insert into TYPE_MST
    (
    Select 'First' double
    Union of all the
    Select 'Second' double
    Union of all the
    Select 'Third' double
    );

    --------
    create the table TYPE_VERSION
    (
    TYPE_DESC varchar2 (15).
    MIN_AGE number (5),
    MAX_AGE number (5),
    VERSION_ID number (5)
    );
    ---------
    insert into TYPE_VERSION
    (
    Select 'First', 0, 5, 100 double
    Union of all the
    Select 'First', 5, 10, 100 double
    Union of all the
    Select 'First', 11,15, 100 double
    );

    ---------

    Queries against existing data
    Select * from TYPE_VERSION;

    The query result

    TYPE_DESC, MIN_AGE, MAX_AGE, VERSION_ID

    First                      0                5               100

    First                      5                10             100

    First                      11              15             100

    My requirement is that system automatically inserts type_desc missing in TYPE_VERSION.

    For example, we have 3 Type_Desc, first, second, third, but in the TYPE_VERSION table, we have data available for only 1 Type_Desc who is "First", this system should insert the missing data in this table using existing data.

    I need result something like below:

    Required result

    TYPE_DESC, MIN_AGE, MAX_AGE, VERSION_ID

    First                      0                5               100

    First                      5                10             100

    First                      11              15             100

    Second 11 15 100

    Second                   5                10             100

    Second 11 15 100

    Third                    0                5               100

    Third                     5                10             100

    Third 11 15 100

    Thanks in advance

    Concerning

    Shu

    Hello

    It is still not clear what you want.

    That's what you want for the examples you gave:

    MERGE INTO dst type_version

    WITH THE HELP OF)

    SELECT DISTINCT

    m.type_desc

    v.min_age, v.max_age, v.version_id

    OF type_mst m

    CROSS JOIN type_version v

    )                  src

    WE (dst.type_desc = src.type_desc

    AND dst.min_age = SRC. MIN_AGE

    )

    WHEN NOT MATCHED THEN INSERT

    (dst.min_age, dst.max_age, dst.type_desc, dst.version_id)

    VALUES (src.min_age, src.max_age, src.type_desc, src.version_id)

    ;

    If she's going to do what you want in general depends on what you want in general.  As long as I don't know the General rules you want to set up, I don't know if it makes them or not.

    This does not seem a very good design.  Why do you need a table with all possible combinations?  Sounds like you're saying, for example, if 2 lines have the same value of min_age, then have the same values for max_age and version_id, too.  This 3rd Normal violares form.  Why not have a table with the possible values for min_age max_age version_id, and simply join cross which type_mst when you need to see all possible combinations?

  • Outer join to find the missing?

    I have 2 tables:

    with stud_courses as
    (
    Select studentid 111, 2, 2201 coursecategory courseid, 'A' GRADE of double
    Union
    Select studentid 111, 2, 2203 coursecategory courseid, CATEGORY "B" of the double
    Union
    Select studentid 111, 4 coursecategory, 2121 courseid, 'A' GRADE of double
    Union
    Select studentid 222, 3 coursecategory, 1111 courseid, 'A' GRADE of double
    Union
    Select studentid 222, 3 coursecategory, 1112 courseid, 'A' GRADE of double
    )
    course_categories as
    (
    Select 2 coursecategory, 2201 courseid double
    Union
    Select 2 coursecategory, 2202 courseid double
    Union
    Select 2 coursecategory, 2203 courseid double
    Union
    Select 2 coursecategory, 2204 courseid double
    Union
    Select 3, 1110 coursecategory courseid double
    Union
    Select 3 coursecategory, 1111 courseid double
    Union
    Select 3 coursecategory, 1112 courseid double
    Union
    Select 3 coursecategory, 1113 courseid double
    Union
    Select 4 coursecategory, 2120 courseid double
    Union
    Select 4 coursecategory, 2121 courseid double
    Union
    Select 4 coursecategory, 2122 courseid double
    Union
    Select 4 coursecategory, 2123 courseid double
    )

    For each student, wants to add the missing courseids for the coursecategory he takes. So student because 111 is in coursecategory 2 I should be able to show all results for him, including the ID of course 2202 and 2204 of category 2 and 2120, 2122, 2123 for this child

    My end result would be something like:

    StudentID, courseid, coursecategory, grade
    111,2,2201, "A".
    111,2,2201, '
    111,2,2203, 'B '.
    111,2,2201, '
    111,4,2120, '
    111,4,2121, "A".
    111,4,2122, '
    111,4,2123, '
    222,3,1110, '
    222,3,1111, "A".
    222,3,1112, "A".
    222,3,1113, '

    I know how to do it with a Union and not exists, but I was wondering if I could do it with an outer join.

    I would appreciate your help.

    Thank you

    Hello

    Yes, you can do it with an outer join. The tricky thing is you need outside to join the table real stud_courses to something that has valid all combinations of the studnents and prices. There is no single table that contains it; the following query will receive these combinations by making a cross join:

    WITH     all_students     AS
    (
         SELECT DISTINCT     studentid
         FROM          stud_courses
    )
    ,     got_category_cnt     AS
    (
         SELECT     all_s.studentid
         ,     c.coursecategory
         ,     c.courseid
         ,     NVL ( s.grade
                  , 'M'
                  )               AS grade
         ,     COUNT (s.grade) OVER ( PARTITION BY  all_s.studentid
                                     ,          c.coursecategory
                             )      AS category_cnt
         FROM           all_students         all_s
         CROSS JOIN      course_categories  c
         LEFT OUTER JOIN      stud_courses         s  ON    s.studentid     = all_s.studentid
                                             AND   s.courseid          = c.courseid
    )
    SELECT       studentid
    ,       coursecategory
    ,       courseid
    ,       grade
    FROM       got_category_cnt
    WHERE       category_cnt     > 0
    ORDER BY  studentid
    ,       coursecategory
    ,       courseid
    ,       grade
    ;
    

    The results I get are:

    `STUDENTID COURSECATEGORY   COURSEID G
    ---------- -------------- ---------- -
           111              2       2201 A
           111              2       2202 M
           111              2       2203 B
           111              2       2204 M
           111              4       2120 M
           111              4       2121 A
           111              4       2122 M
           111              4       2123 M
           222              3       1110 M
           222              3       1111 A
           222              3       1112 A
           222              3       1113 M
    

    These are a little different from what you have posted.

    user9207291 wrote:
    ...
    StudentID, courseid, coursecategory, grade
    111,2,2201, "A".
    111,2,2201, '
    111,2,2203, 'B '.
    111,2,2201, '
    111,4,2120, '
    111,4,2121, "A".
    111,4,2122, '
    111,4,2123, '
    222,3,1110, '
    222,3,1111, "A".
    222,3,1112, "A".
    222,3,1113, '

    Is it because there are errors in what you posted? Do you really want to have three lines of output for the same studentid (111) and courseid (2201)?

    Looks like there should be a slick way to do this with a partitioned outer join.
    A partitioned outer join matches each row of table A with the lines in table B, but, if there is no correspondence between a given A line and a line to a given partition of B, that the rank of A and the B partition is included in the game anyway. Here, we want the two partition tables.

  • Can not find the server/problem loading page

    I've made a few changes to a CFC that caused it not to compile. When I tried to access my web application it gave me the error as planned CF, pointing to my invalid code. I commented on the service out and reloaded my app. When I tried to view it in the browser, I'm greeted by an error can not find the server. What disturbs me is that I am able to access other web applications without an error cannot find the server in the browser. Does anyone know why an application would cause an error of cannot find the server and not others? I hope this is clear :) Any help would be greatly appreciated.

    Apparently I WASN'T looking to another web application, but a prototype html that the browser displays because he had no tags CF. The problem is that somehow the CF Server service was not working. It works... problem solved.

  • Find and fix the missing font WARNING Pages

    How can I find text that is missing the police so I can change it? I selected all the text in the document and changed the font, but the reopening of the document, the error message still appears.

    Cambria police is licensed by Microsoft exclusive and is installed by Office for Mac or Windows desktop products. Office for Mac 2016 does not install its fonts in normal OS X system font locations, and a departure from the former office for Mac free, it keeps fonts in Microsoft applications kits, where other applications can not see.

    Unlike MS Word, Pages do not make bold and italic faces when the members of the family of fonts are not installed. Although you can ignore this warning in the view menu Pages, or for the document with the checkbox on the warning sign, it reappears every time you open a different document where the police is/is not installed. There is no configuration pages that disables this warning sign at all times.

    In addition, Pages will attempt to perform font substitution in the document when you see this warning dialog form.

  • where to find the missing files .lsb

    Hello. Here's my problem, maybe you can advice me well.

    I have an old .vi in Labview 4.0, which works very well under Windows 98.

    My final goal is to make it work under Windows 7, Labview 2010.

    I know that the first, I have to open the vi in BT 8.0, except for previous version 8.0 and then open it in LV 2010.  Generally, these tasks work correctly with the other vi. I had good results with the other vi.

    But for my situation, this old vi Labview 4.0 needs some libraries (.lsb files) CIN. It gives me errors because of them.

    Here it is:

    ICTRCTRL.lsb

    DIGPRTRD.lsb

    DIGPRTCF.lsb

    AICTRL.lsb

    CHLINDVI.lsb

    AITRIG.lsb

    AICLKCFG.lsb

    AIBUFFCF.lsb

    AIHARD.lsb

    AIGRPCFG.lsb

    AIREAD.lsb

    I tried these files in Labview 4.0 and 8.0 without success. I think that copy and paste will help as I did with the other missing Subvi.

    So my question is: how to find them and 'export' in Labview 8.0?

    Is it possible to find it elsewhere on the web? Or maybe you have?

    You know that I have no experience working with external libraries.

    The only way you can have old screw DAQ with a CIN is if these screws were saved in a Bachelor's degree in law. To avoid that LabVIEW loading them, they must be removed from the llb. So, if you install the latest version of traditional DAQ, which will load and the latest LabVIEW don't use RISC. You will then have to rewrite the program to use DAQmx features since it is the only rider with the support of windows 7.

Maybe you are looking for