Question about a query that will be 1 for the first 10 lines, 2 for the

Hi all

I am trying to write a query that will be 1 for the first 10 lines, 2 for the next ten lines and so on.

I tried several approaches such as mod, rank, case but could not get the correct idea.

Grateful if someone can give me a hint on this one.

Ex:

Col1 Col2
1 989
1 120
1 876
2 121
2 456
2 87
1 of 3
3 22
3 333
....................... and so on..


Thank you
MK.

How about this:

His past all my tests so far

select trunc((rownum - mod(rownum-1,10))/10)+1
from dual
connect by level <= 1000

Tags: Database

Similar Questions

  • Question about a bug that should be fixed in the 10.2.0.4 group patch

    Hello

    We have a 10.2.0.4 single instance of database on Sun Solaris SPARC (64-bit) and have the same symptoms as described in Bug 4643723 (error codes and the trace of the stack are the same). This bug should be fixed already in 10.2.0.4 patches group.

    Someone of experience on how to proceed in this case - I mean, did a SR on metalink an obvious action?

    Is it possible that fixes group has not been applied correctly, even if "opatch lsinventory" outputs that the "group of patches 2 3 (10.2.0.4) version 10g ' is installed and SYS. HISTORY of $ REGISTRY also contains an account of the upgrade. The upgrade of 10.2.0.1 10.2.0.4 was made 6 months ago and the data base has been continuously top and runing so far here.

    Thanks for all the answers

    many bugs may have the same mistakes. Raise a SR.

    Support Oracle ask a lsinventory opatch you and may request you check the versions of libraries, or reissue.

  • I forgot my password to my ID Windows Live ID I need to answer the questions about my "ID". I don't know the answers.

    Windows Live ID problem

    Hello world.
    I have a small problem regarding the Windows Live account. My account is: * e-mail address is removed from the privacy *, I forgot my password.

    I need to answer the questions about my "ID". I don't know the answers that I've tried over and over again and I even tried to make security issues and I could not answer.
    What can I do?

    Hello RobertKristof,

    The best place to ask your question of Windows Live is inside Windows Live help forums. Experts specialize in all things, Windows Live, and would be delighted to help you with your questions. Please choose a product below to be redirected to the appropriate community:

    Windows Live Mail

    Windows Live Hotmail

    Windows Live Messenger

    Looking for a different product to Windows Live? Visit the home page Windows Live Help for the complete list of Windows Live forums to www.windowslivehelp.com.

  • Is there a list of graphics cards that work perfectly with all the new features of Creative Cloud? I want to update my graphics system and want a model that will be obsolete when the next CC updates the roll autour.

    Is there a list of graphics cards that work perfectly with all the new features of Creative Cloud? I want to update my graphics system and want a model that will be obsolete when the next CC updates the roll autour.

    The "General" cloud requirements are quite low... so you have to ask in the forums of specific program for a special features used by individual programs

    For video editing Premiere Pro, go read it in community: Forum Hardware | Adobe Community

  • Where can I ask a handful of general order questions about Firefox OS as a consumer and get the answers? (a forum or something similar)

    I have about seven questions about Firefox OS. I'm potentially interested in opting for a tablet that works instead of Android or iOS. I couldn't find a place to ask questions like that. Thank you!

    https://support.Mozilla.org/en-us/forums/Firefox-OS-English-Forum

    There is another option.

  • Very simple question about Mac and find out which version of the player

    Hi, really quick here for Mac or Mac users familiar question: How can I find which version of Reader is installed on a Mac? It should be of Mac OSX. I'm just so incompatible Mac (and the guy using it is not fine with it) and I don't know where to look?

    Thanks a bundle

    Mac does not come with Adobe Reader, they come with a program called Preview. The best way to know which version is on a given computer is to ask the owner! If the owner does not know that they can select the file and then on the file menu or by typing the command - I they can activate the command read information that will produce a window with the version information and much more.

  • I have 3 I paid and you want to delete all the information that a a them. How to be painful that will not delete fron the 2 that I paid I want to use

    I have 3 I paid and you want to remove all the information ONLY one of them. How to be painful that will not delete the other

    You can go to settings > General > reset > erase all content and settings and will erase the iPad that you perform this action on. It has no effect on another device.

    See you soon,.

    GB

  • Why is unknown in the device manager that will not disappear with the update disc

    Its been two weeks preparing the motherboard as possible for the repair of the BONE, but there is now an unknown in device Mangr which did not exist before that I was doing all the Driver Update with the drive to the motherboard. Will be also someone please tell me why a CD with drivers for ASUS and motherboard support options change to a file only as reading support only, but it was like an installation disk? I mean he had the factor graph and as multi-format, now it gives just files and are not a pleasure drive anymore? Can I change it back? What happened to him? I did try and she put the BIOS on diskette for a flash for a one-way effort, but it has not worked for me! I messed up the CD? I don't see how?

    Hello

    • This "graphic factor" are you referring?
     
    You can check this link:
     
    How to troubleshoot unknown devices listed in Device Manager in Windows XP
     
  • Best rendering parameters of the files that will be used in the PPr

    Z820, Win 7 HP, Adobe production suite CS6.

    I'm eager to make 'temporary' files that will be brought back right into legacy or placed in PrPro for final rendering for Youtube or Vimeo. I hope that by making components for comps that I'm not going to change, I can speed up the editing process, but she wondered if I could be implemented myself degrading images because of the multiple times between washing, so to speak.

    I wonder what the best rendering parameters choice is if I'll be crossing output another iteration or after effects or PrP before the final product?

    Comps are set at 1080 p, 29.97 FPS.

    Output is t H.264 @ 1080 p, 29.97 FPS.

    Jeff

    The concept to make some elements that are locked to be used later in your comp is called before rendering. It's actually a lot. If you display a file without loss (such as Quicktime with the PNG codec at high quality), it will be 0 loss of quality.

  • Is there a tip action that will open and close the table of contents?

    I like that in CP5, Adobe has allowed users to change the icon associated with opening and closing of a Table of contents in layers.  Having said that, unfortunately, they show if small, I don't see what I created.  So, I was wondering, is there an advanced action or an action script that I could assign to a button that will allow my users open/close the table of contents?

    Thoughts?

    Eric

    I created a quick and dirty AS3 widget that can be used in Captivate 4 and Captivate 5 projects to open / close a table of contents in overlay with your own button mode.

    http://www.cpguru.com/2010/10/14/free-TOC-button-widget-for-Adobe-Captivate-4-AS3-and-Adob e-Captivate-5.

    Have fun; (o)

    / Michael

  • Question about bookmarks, want they show immediately when opening the file. Help?

    Hello, for one of our clients I have to create bookmarks in the existing PDF. I did, everything works perfectly. But now the client came to us and told us that they want to have the bookmarks shown immediately when they open the PDF file. And now they must open the bookmarks first submenu. How can I fix?

    Open the file in Acrobat then go into file - properties - Initial display and on the "Navigation" tab, select "Bookmarks panel and Page. Click OK, and then save the file.

  • How to password - protect a PDF document that will let me change the security settings?

    I want to protect my PDF document (so when I email, it cannot be opened / reading of recipients because it contains confidential/sensitive information) but when I go into the security of documents, I cannot change the method of security (which is currently set at "No Security" - not by me).  There is an icon "View details", but it is grey so I can't click on it.  What can I do to protect this document to be opened by the beneficiaries not compliant?

    He seems to have several possibilities.

    Using Adobe Reader instead of Adobe Acrobat?

    You make a PDF/A file? (It will say so under the menu bar)

  • Question about how to calculate an additional column in the query result.

    Hello PL/SQL gurus and experts.

    I use Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64-bit Production version


    Currently, I have the data in the following manner-
    drop table T2;
    create table T2(Year, MastTot, BechTot, Tot) as select
    '2008', '20000', '450000', '470000' from dual union all select
    '2008', '50000', '324000', '374000'  from DUAL union all select
    '2009', '25000', '450000', '475000'  from dual union all select
    '2009', '250000', '324000', '574000' from DUAL union all select
    '2010', '120000', '450000', '570000' from dual union all select
    '2010', '52000', '324000', '376000'  from DUAL union all select
    '2011', '220000', '450000', '670000' from dual union all select
    '2011', '52000', '324000', '376000'  from DUAL ;
    I want that data to present the following year (production).
    Year     MastTot     %Change     BechTot     %Change     Tot     %Change     %Total
    2009     275000     292.86     774000     0     1049000     24.29     27
    2010     172000     -37.45     774000     0     946000     -9.82     24.35
    2011     272000     58.14     774000     0     1046000     10.57     26.92
    Total     789000     313.54     3096000     0     3885000     25.04     78.28
    I use the following sql query-
    select decode(grouping(Year), 0, Year, 'Total') Year,
           To_Char(sum(MastTot), '999,999,999,999,999,999,999.99')  "MastTot",
           To_Char(sum(BechTot), '999,999,999,999,999,999,999.99')  "BechTot",
           To_Char(sum(Tot), '999,999,999,999,999,999,999.99')  "Tot",
           round((sum(Tot)/nullif(max(total_amount),0)) * 100, 2) "%Total"
      From
    (
    select Year,
           sum(MastTot) MastTot,
           sum(BechTot) BechTot,
           sum(Tot) Tot,
           SUM(Tot) over() total_amount
      From t2
    group by Year,Tot
    )
    where Year>'2008'
     group by grouping sets((Year),())
    order by Year
    But I am not able to read the % change column. Kindly help me with this.
    All the efforts and assistance in this regard is very appericated and I will be thankful to you...

    user555994 wrote:
    Thanks for the reply JAC,

    you are making reference to the line in the code

    round((sum(Tot)/nullif(max(total_amount),0)) * 100, 2) "%Total"
    

    Here, I'm looking for the Total % against the maximum value of the tot...

    SQL> with t
      2  as (
      3  select year,masttot,lag(masttot) over(order by year) prevm,
      4      BechTot,lag(BechTot) over(order by year) prevb,
      5      tot,lag(Tot) over(order by year) prevt,
      6      sum(tot) over(order by null) sm_t
      7  from(
      8  select Year,
      9         sum(MastTot) MastTot,
     10         sum(BechTot) BechTot,
     11         sum(Tot) Tot
     12  From t2
     13  group by Year
     14   ))
     15  select year,sum(masttot) masttot,
     16     sum(((masttot-prevm)/prevm)*100) Perc_m,
     17         sum(BechTot) bechtot,
     18         sum(((BechTot-prevb)/prevb)*100) Perc_b,
     19         sum(tot) tot,sum(((tot-prevt)/prevt)*100) Perc_t,
     20         sum((tot/sm_t)*100)  perc_total
     21  from t
     22  where year > 2008
     23  group by rollup(year);
    
          YEAR    MASTTOT     PERC_M    BECHTOT     PERC_B        TOT     PERC_T PERC_TOTAL
    ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
          2009     275000 292.857143     774000          0    1049000 24.2890995  27.001287
          2010     172000 -37.454545     774000          0     946000 -9.8188751 24.3500644
          2011     272000 58.1395349     774000          0    1046000 10.5708245 26.9240669
                   719000 313.542132    2322000          0    3041000 25.0410489 78.2754183
    
  • Run a query that will determine the number of parts to produce

    I have the task I have to determine the number of parts that need to be produced based on the number of products sold for the day (each product consists of several parts).

    I use SQL 11g Express.

    I watched this during so long and tried so many different ways. Here's some of what I tried, with the error messages. I don't know where I am going wrong get this calculation. Here, any help is greatly appreciated!

    Here's my info:
    /**PRODUCT**/
    
    CREATE table Product
    (
        SKU       VARCHAR2(10) NOT NULL,
        ProdDesc   VARCHAR2(50) NOT NULL,
        Price      NUMBER(5,2),
        PRIMARY KEY(SKU)
    );
    
    /**PART**/
    CREATE table Part
    (
        PartID     NUMBER(6) NOT NULL,
        PartDesc   VARCHAR2(50) NOT NULL,
        PRIMARY KEY(PartID)
    );
    
    /**PRODUCTPART**/
    CREATE table ProductPart
    (
        SKU        VARCHAR2(10) NOT NULL CONSTRAINT fk_ProductPart_Product REFERENCES Product (SKU),
        PartID     NUMBER(6) NOT NULL CONSTRAINT fk_ProductPart_Part REFERENCES Part (PartID),
        NumOfParts NUMBER(3),
        CONSTRAINT pk_ProductPart PRIMARY KEY (SKU, PartID)
    );
    
    CREATE table Customer
    (
        CustID     NUMBER(6) NOT NULL,
        CustFname  VARCHAR2(20) NOT NULL,
        CustLname  VARCHAR2(20) NOT NULL,
        Company    VARCHAR2(40),
        Address    VARCHAR2(40) NOT NULL,
        City       VARCHAR2(30)NOT NULL,
        State      VARCHAR2(2)NOT NULL,
        Zip        NUMBER(5)NOT NULL,
        Phone      NUMBER(10)NOT NULL,
        PRIMARY KEY (CustID)
    );
    
    CREATE table CustOrder
    (
        OrderID    NUMBER(6) NOT NULL,
        Qty        NUMBER(3) NOT NULL,
        OrderDate  Date NOT NULL,
        SKU        VARCHAR(10) NOT NULL CONSTRAINT fk_CustOrder_Product REFERENCES Product (SKU),
        CustID     Number(6) NOT NULL CONSTRAINT fk_CustOrder_Customer REFERENCES Customer (CustID),
        PRIMARY KEY (OrderID)
    );
    
    
    Here are some of the queries:
    
    SELECT ProductPart.Qty
        (
    SELECT CustOrder.SKU,
    sum(CustOrder.qty)
    FROM CustOrder
        GROUP BY CustOrder.SKU;)
    FROM ProductPart
    WHERE ProductPart.Qty * sum(CustOrder.Qty)
    
    
    ORA-00936: missing expression
    
    SELECT o.OrderDate AS "Date Ordered",
           o.OrderDate + 5 AS "Date Due",
           pp.PartID AS "Part No.",
        pp.NumOfParts * COUNT(o.SKU) AS "Qty"
    FROM CustOrder o
    JOIN ProductPart pp
      ON o.SKU = pp.SKU
        GROUP BY pp.PartID, o.OrderDate, COUNT(o.SKU)
    ORDER BY o.OrderDate
    
    
    ORA-00934: group function is not allowed here
    
    SELECT ProductPart.Qty,
           ProductPart.PartID,
           ProductPart.PartDesc
    (SELECT COUNT(CustOrder.SKU)
     FROM CustOrder
     GROUP BY CustomerOrder.SKU)TotalProducts,
    ProductPart.Qty * TotalProducts AS "Qty"
    FROM ProductParty
    WHERE CustOrder.SKU = Product.SKU
    AND Product.SKU = ProductPart.SKU
    
    
    ORA-00936: missing expression
    
    SELECT ProductPart.Qty,
           ProductPart.PartID,
           ProductPart.PartDesc
    (SELECT sum(CustOrder.qty)
    FROM CustOrder
    GROUP BY CustOrder.SKU)TotalProducts
        ProductPart.Qty * TotalProducts
        FROM ProductPart
    
    
    ORA-00936: missing expression

  • question about this query... using parameters if it is null

    Hello all;

    I have the following query below
      SELECT p.id            
                 ,p.place
      FROM table_one p
           WHERE p.id = decode(p_parameter_one, is not null, p_parameter_one, is null, p_co) 
    what I'm trying to do, it's pass two parameters in my function, and if p_parameter_one is null, then use p_co, else if p_parameter_one is not null, and then use it and do not use p_co.

    I use oracle 9i

    you want?

    SELECT p.id ,
      p.place
    FROM table_one p
    WHERE P.ID = NVL(:P_PARAMETER_ONE,:P_CO)
    

Maybe you are looking for

  • Problem with the Satellite X 200 and the keyboard to do with Alt Gr and 2

    Ok... Here's my problem.I have Vista Norwegian, Norwegian language, and we, Ctrl + alt + 2 game or AltGr + 2 to get @.Now I can't get it to work.Nothing happens if I press the buttons and 2. The two buttons work.If I press ALT GR + 8 I get this:]This

  • Satellite A105-S4004 - audio skipping CD

    I have a Toshiba A105 with DVD multi disc player recorder.When I got the laptop in 2006 CD and DVD played fine without skipping audio, but now, I noticed audio CD to jump unless I have to pull them up on my computer.Then I tried a DVD and the picture

  • Sudden stops Vista HP Slimline

    32-bit Vista running on HP Slimline, computer stops unexpectedly, it looks like overheating (not sure), spent vacuuming several times, no dust no accumulated, well ventilated.

  • problem installing downloaded programs

    Hi everytime I try to install a downloaded program I get an error message saying that it is not a valid win32 application that he did with the programs downloaded from Microsoft. It downloads the file but when I install the thing of security open fil

  • Connection stuck when connecting over BES/MDS

    I have an application called customer MC (later called 'client') who uses a socket connection to communicate with a server, the controller of Mobile (later called "controller").The connection is used to exchange information of signaling for control o