Help on displaying the records

Hi all

BEG_MP END_MP LENGTH NUM ID type
City of 1012 0,00 3,00 3,00 2
City of 1012 0.00 3.12 3.12 2

Village of 1012 0.00 0.02 1 1
Village of 1012 0.00 0.03 2 3
Village of 1012 0.00 0.05 1 1
Village of 1012 0.05 0.00 4.00 3

1012 village of Altamont 0.00 1.20 1.20 1
1012 village of Altamont 0.00 2.00 2.00 3
1012 village of Altamont 0.00 3.96 3.96 1
1012 village of Altamont 6.94 7,69 0.75 1
1012 village of Altamont 7,69 7.90 0.21 1
1012 village of Altamont 7.90 8.21 0.31 1


I need ouptut is as follows

BEG_MP END_MP LENGTH NUM ID type
City of 1012 0,00 3,00 3,00 2
City of 1012 0.00 3.12 3.12 2

Center Channel (sum of length) 6.12
Total (sum of length group * Num) 12.24 (6.12 * 2)

Village of 1012 0.00 0.02 1 1
Village of 1012 0.00 0.03 2 3
Village of 1012 0.00 0.05 1 1
Village of 1012 0.05 0.00 4.00 3
Center Channel (sum of length) 8,00
Total (sum of length by Num group) 19 length 1 * num 1
"+"
sum (length num 3)
length 6 * num 3

Thanks in advance

2 + 18 = 19

2 + 18 = 20, not 19 :)

SCOTT@book_soti_9> with Test_Data as (
  2    select 1012 as ID, 'Town' as Type, 0.00 as BEG_MP, 3.00 as END_MP, 3.00 as LENGTH, 2 as NUM from dual union all
  3    select 1012, 'Town', 0.00, 3.12, 3.12, 2 from dual union all
  4    select 1012, 'Village', 0.00, 0.02, 1, 1 from dual union all
  5    select 1012, 'Village', 0.00, 0.03, 2, 3 from dual union all
  6    select 1012, 'Village', 0.00, 0.05, 1, 1 from dual union all
  7    select 1012, 'Village', 0.00, 0.05, 4.00, 3 from dual
  8  )
  9  select Id, Type, Num, BEG_MP, END_MP, LENGTH,
 10    sum(length), sum(length * num)
 11  from Test_Data
 12  group by Id, Type, rollup(NUM, (BEG_MP, END_MP, LENGTH))
 13  ;

        ID TYPE           NUM     BEG_MP     END_MP     LENGTH SUM(LENGTH) SUM(LENGTH*NUM)
---------- ------- ---------- ---------- ---------- ---------- ----------- ---------------
      1012 Town             2          0          3          3           3               6
      1012 Town             2          0       3.12       3.12        3.12            6.24
      1012 Town             2                                         6.12           12.24
      1012 Town                                                       6.12           12.24
      1012 Village          1          0        .02          1           1               1
      1012 Village          1          0        .05          1           1               1
      1012 Village          1                                            2               2
      1012 Village          3          0        .03          2           2               6
      1012 Village          3          0        .05          4           4              12
      1012 Village          3                                            6              18
      1012 Village                                                       8              20

11 rows selected.

If this idoesn can't look you expect, then please provide an example of output. Just correct the need the list above.
Kind regards
Dima

Tags: Database

Similar Questions

  • How to display the records from a query in the non-base data field

    Hello

    I have a problem:
    I have a query with a lot of tables and column 6 (select a, b, c, d, e, f x, y, z, t, s, g where the conditions) and I use 3 parameters.
    I create 3 settings: datai,: dataf and: partner and a button with a trigger when the button is pressed.
    Then a create a block manually with six field non-database a1, b1, c1, d1, e1, f1.
    Now, I want to display all the records in my query in a1, b1, c1, d1, e1, f1 where a1 = a, b1 = b, etc. and all the records (if I have 20 record, it will display 20 records in the non-base data field) when I press the button.

    How I did it:
    I create a cursor with the query, and then
    start the open cursor
    loop
    Fetch cursor in: a1,: b1,: c1: d1: e1,: f1;
    end loop;
    close the cursor;
    end;

    It displays a single record in a1, b1, c1 only, and it must display 100 records and date for all fields.

    Can someone help me with this problem?
    Thank you.

    Published by: 928437 on October 1, 2012 02:55

    Creating a view and the query in a database block are a great solution.

    To use the block non-base of data:
    You are missing the most important Next_Record; command.

     Begin
    Go_block('X'); -- block X is the non-database block
    Clear_Block(No_Validate);
    open cursor X1;
    loop
    If :System.Record_status != 'NEW' then
    Next_Record;
    End if;
    fetch X1 into :a1,:b1,:c1,:d1,:e1,:f1;
    Exit when X1%NOTFOUND;
    end loop;
    close X1;
    end;

  • Open a new window and displays the record using JavaScript information

    I would be very grateful if someone could help with the following query. I produced a simple database using APEX, a page that displays all the records that are currently (in the form of tables). However, due to the amount of information and the resolution of the screen, not all columns are displayed on the resulting web page.

    I would like to change by making the information contained in a hyperlink column, which, once pressed will open a new window containing most (if not all) of the information for the particular record.

    I think that this requires JavaScript and, possibly, SQL, however, I do not know where to start.

    Can anyone provide any assistance will be appreciated.

    If you need additional information, let me know.

    You can start with this:

    http://Apex.Oracle.com/pls/OTN/f?p=31517:23

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • Unable to display the records in a table

    I am a user of a database DB1 U1. The Table T1 is available in a schema/user U2 in the same database DB1. Records are also available in T1.

    The U1 user has select privileges on the table T1. But the select query returns no records in the table T1 for the U1 user. It returns "0 rows. But it has more than 1000 available records in this table, but unable to see those documents. But the U2 user can see these documents and select query retrieves records as usual. How to check what is stopping to select records. How to check what is the method of security set in place which prevents the U1 user to see the records in the table T1.

    Help, please. . I'm naïve...

    Thank you

    You seem to have a virtual private database and/or use of fine-grained access control.

    The two concepts are explained in books online for the version of the database that you didn't disclose it.

    The rules are generally stored in the dictionary DBA_FGA views *.

    --------

    Sybrand Bakker

    Senior Oracle DBA

  • Impossible to extract and display the records

    Hi, I'm using Oracle 11 g

    The procedure is compiled without any errors.

    The select statement retrieves records well when they are run in SQL promt.

    But the same records are not displayed in this procedure by extraction of the cursor.

    Last post in the 'done' procedure is also displayed.

    Please help me retriving records.

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

    create or replace procedure disp_rec (vid IN varchar2, vfeat in numbers)
    is

    cursor c1 is select gid, listagg (vindex, ',') within the Group (order by tid) idx from ridrecords where idarpt = vid and feattype = vfeat group by gid;

    type vg is table of number;
    type vi is table of the varchar2 (3500);

    a vg;
    b vi.

    Start

    If vfeat = 0 then
    Open c1;
    loop
    collect the fetch c1 into loose in a, b;
    When exit c1% notfound;
    for indx in a.first... a.Last loop
    dbms_output.put_line ((indx) a | b (indx));
    end loop;
    end loop;
    Close c1;

    elsif vfeat = 1 then
    Open c1;
    loop
    collect the fetch c1 into loose in a, b;
    When exit c1% notfound;
    for indx in a.first... a.Last loop
    dbms_output.put_line ((indx) a | b (indx));
    end loop;
    end loop;
    Close c1;

    end if;

    dbms_output.put_line ('completed');
    end disp_rec;

    It depends on what will be different on the input values.

    Your original example two blocks has done the same at first glance.

    For example, you can do

    Start

    Open c1;

    loop

    collect the fetch c1 into loose in a, b LIMIT l_limit;

    If l_input = 0 then

    ForAll indx in 1... a .count

    Update emp2 ename set = b (indx)

    where empno = a (indx);

    elsif l_input = 1 then

    ForAll indx in 1... a .count

    Remove emp2

    where empno = a (indx);

    end if;

    When the output $a.count<>

    end loop;

    Close c1;

    dbms_output.put_line ('completed');

    end;

  • AF:table does not display the records to make the updating of the view object iter

    Hi Experts,

    I use JDeveloper 11.1.1.4 and I have a page that shows a view object records one particular reading as an af:table. When I run the page to everything first he shows all the data at all. But there are 2 folders when I run the query that only read the view object. In my page there is a link called "Refresh" which calls the operation "Execute" in the view of my view object iterator. When I click on this link the table shows two records. Why the table shows no files once when the page is rendered?

    Please help me.

    Hi user,

    Yes use component query to display criteria. Please let me know if something specific I need to check when I use the query component. If you have already faced this problem please help me to solve it.

    you are looking to do this,
    http://www.4shared.com/photo/B36OTSl9/check.html

    Published by: Les on November 22, 2011 12:26 AM

  • Help to display the values

    Hi all

    I have a column named users.

    It is varchar2 datatype column.


    In this column, the values are recorded as follows:
    sno           users
    -----         ---------
    1             poo12,poo13,poo14,poo45,pooo34,pooo45    --> this users in single column only  
    2             roo12,r0023,r0089,r0023424
    can someone tell me how to display user names in the item [may be the list item or a text element].

    What is the way to do it.

    Note: the user names spilited comma.

    Expected results:

    If I want users of sno then the list item should display values
    poo12,
    poo13,
    poo14,
    pooo34,
    pooo45

    Please help me

    Published by: SB 14 Sep, 2011 04:48

    We cannot go on like this. "... I did, but it failed... "without any other detail no aid at all to find where in your code, something is not. I have no crystal ball, while I can't guess what's wrong until you decide to give the code you've tried.

    François

  • How can I add back/fwd page icon the icon dropdown(d/d) to history - some of the HELP pages display the icon of d/d

    I just downloaded and installed the new version of Firefox. I am configuring my toolbars... have achieved everything I want, except the icon "showlist" that is attached to the fwd/bwd Web page icon. Some HELP pages show this icon attached; others do not. WHAT miss me?
    I've added other icons, I want to the toolbar.
    THX
    M

    The drop-marker has been removed since the beginning of Back/Forward in Firefox 4 button. Do one of the following:

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

    Not related to your question, but...

    You must update some plug-ins:

  • How to display the records of the base as well as a few other table table?

    Hello expert,

    I have an obligation to develop a form described below:

    A control block and block of data.

    DB block is based on table T1 (USER, Table_name, Column_name, ACCESS);

    In the control block, there are three fields,

    User, Table user will enter and block DB will query based on fields of control (user, table_name) block.

    In the table, it is not necessary that all columns of the table will be given.

    Assume there is a table X consist of 10 columns.

    Initially the user gives access to all of the 10 columns use this form.

    If we ask for the user, table, everything will come from table T1.

    Now consider the case, then the access granted to table X number of columns were 10. After that, 2 new columns added later.

    There is now no Info for the added column in table T1. I want to if user query DB block, these newly added column should display in block DB.

    Please help me.

    Thank you

    David

    > I want to if user query DB block, these newly added column should display in block DB.

    You must change your form and add the two columns as part of the base table. Forms does not add two elements to the base table of itself.

  • Click on the button Save. Displays the record 500

    Hi gurus,

    new IM framework oracle, I have a strange question

    When I click on the button Save will be retruns to the previous page, but some times its nt accessing previuos page.
    and shows 500 records in my page.
    Please any body help me with that.

    Thanks in advance
    Concerning
    Jegou

    Hello

    He is missing one step, you must set the maximum size of vo at zero.

    vo.setMaxFetchSize (0);

    use code below:

    Public Sub createSupplierContact()
    {
    SupplierContactsVOImpl vo = get_SupplierContactsVO1 ();
    OADBTransaction tr = getOADBTransaction ();
    Vo1 SupplierSitesVOImpl = get_SupplierSitesVO1();
    vo.setMaxFetchSize (0); - is that I added
    Line r = vo.createRow ();
    vo.insertRow (r);
    r.setNewRowState (Row.STATUS_INITIALIZED);
    }

    Let me know it works r nt... :))

    Concerning
    Meher Irk

  • need help to correct the records in a table

    Hi all

    I loaded a content file in a single table with a single column, the file is to have the data as below
    Record 1.  ABC|AVC1|1234|
                   xyz|abc
    Record 2.  ABC1|AVC1|12334|
                   xyz
                   |ABC
    Record 3. ABC1|AVC1|12334|xyz|ABC
    I need to correct the data in the table above, the 3 reviews. is the correct format I need record1 and record2 look like.

    Note Record1... 3. the text above, I've added. (it's just a real example table a 5million rec)

    Can any of you help me correct this file using plsql query or sql by creating another table which has corrected data

    Logical I think is

    All records must have 4 delimiter if less then wear the next record in the line to the previous line for example

    Record 1. ABC | AVC1 | 1234 | XYZ | ABC

    Even if there is no delimiter on line then also make the next record in the line to the previous line for example

    Record 2. ABC1. AVC1 | 12334 | XYZ
    | ABC


    Like wise cleaning the table and placing it in a new table, to export.

    Oracle version I have is 10g


    Kind regards
    AAK

    This is because you have not changed the subquery factoring section (aka the WITH clause) properly (I suggest that you are looking for this - it's a very useful piece of syntax to have under your belt). You must change as follows:

    with res as (select rn,
                        txt,
                        ceil(sum(length(txt) - length(replace(txt, '|'))) over (order by rn)/4) grp
                 from   t), -- assuming that your table is called t.
       final as (select replace(sys_connect_by_path(txt, '$'), '$') full_txt,
                        level
                 from   res
                 WHERE CONNECT_BY_ISLEAF = 1
                 connect by grp = prior grp
                 and        rn = prior rn + 1)
    select case when length(full_txt) - length(replace(full_txt, '|')) = 4 then full_txt end full_txt
    from   final
    where  case when length(full_txt) - length(replace(full_txt, '|')) = 4 then full_txt end is not null;
    

    ETA: where 4 appears in my query, you will need to change the number of pipes in your line.
    ETA2: and I suspect that you need to change the 5 in the BluShadow query to 1 + the number of pipes in your line.

    Published by: Boneist on March 23, 2010 17:08

  • Help by displaying the number

    Hi all

    I have a column where number stored as 8.756412556312453E37 I want to display like

    87564125563124530000000000000000000000

    can u help me by posting the number in this way

    Thank you
    Sunil. N

    Hi Sunil,
    If you just want to display it, do it this way

    SELECT TO_CHAR(8.756412556312453E37)
    FROM   DUAL; 
    

    * 009 *.

  • How can I display the records of a table for the $ e?

    Hi all

    I had some constraints declared in the target data store. In my interface, I can see that some records have been moved to the table$ e.

    I want to see these documents. How can I see who? Help, please...

    GoTo model ODI of the creator--> YOUR DATA (right-click) store--> controls--> errors

    or

    Make sure that in IKM (delete temporary objects is SET to False). You can question him in the target schema. Select * from E$ _ (unless and until what during the installtaion you have not changed the prefix for ODI).

  • Some newbie need help to display the Properties window

    Hello!

    I am writing this issue on behalf of another Member of our association, which does not much English. We bought him Final Cut Pro X, so that he can learn a few video do, and he is very enthusiastic about it. We first had a try of FCP X, and then we bought and installed the version full (10.2.3). He is still learning the basics, and today he said he can not find the property field in the upper right corner that he used in the trial version. I don't know what the problem is, so I asked for a screenshot:

    https://drive.Google.com/a/hyvanmielenpelit.fi/file/d/0B26s9BQiLuATRVRob0lnNFY3Q m8/view? USP = share

    Apparently, the Properties window does not appear when he wrote a large '3D text' on a purple background. I'm not sure if it is just using the program wrong, or what is the problem, but in any case, I promised to write a post on a forum of FCP X, so that someone could help it how to get properties appears. He wants to see properties, for example, for the 3D text, when added to the timeline. No idea what is the problem?

    Best regards

    Tommi Gustafsson

    President

    Hyvan mielen pelit ry

    It should be as simple as clicking on this button:

    Command-4 is the keyboard shortcut.

    If this does not work as it should try to reset the preferences of FCP X.

    Hold down Option + command like FCP X starts.

    Al

  • HELP: cannot display the icons on the left side

    I accidentally

    messed up on photoshop I don't see any of the icons on the left side please help what should I

    Go to the window and down at the bottom make sure that tools is selected.

    If you have lost the panels on the right, more, click on the tab key to bring all back

    Still no luck? Go to window > workspace > Essentials

Maybe you are looking for