How to display the rows number of times by giving the column values?

Hi All,
I want to display the rows number of times as the value exists in num column in the below query
with t AS
   ( SELECT 'venkatesh' NAME, 'hyd' LOC, 2 NUM FROM DUAL
     UNION ALL
     SELECT 'prasad' NAME, 'hyd' LOC, 3 NUM FROM DUAL
     UNION ALL
     SELECT 'krishna' NAME,     'hyd' LOC, 1 NUM FROM DUAL )
  SELECT T.* FROM T
  CONNECT BY ROWNUM <= NUM
Expected output:
         venkatesh            hyd      2
         venkatesh            hyd        2
         prasad                 hyd        3
         prasad                   hyd      3
         prasad                   hyd      3
         krishna           hyd       1Edited by: Nag Aswadhati on Nov 1, 2012 12:34 AM

Nag Aswadhati wrote:
Hi All,
I want to display the rows number of times as the value exists in num column in the below query
Expected output:
venkatesh            hyd      2
venkatesh            hyd        2
prasad                 hyd        3
prasad                   hyd      3
prasad                   hyd      3
krishna           hyd       1Using Connect By:-
with t AS
   ( SELECT 'venkatesh' NAME, 'hyd' LOC, 2 NUM FROM DUAL
     UNION ALL
     SELECT 'prasad' NAME, 'hyd' LOC, 3 NUM FROM DUAL
     UNION ALL
     select 'krishna' name,     'hyd' loc, 1 num from dual )
  select t.name, t.loc
  from t
  connect by level <= num
         and name = prior name
         and (prior sys_guid() is not null);
NAME      LOC
krishna   hyd
prasad    hyd
prasad    hyd
prasad    hyd
venkatesh hyd
venkatesh hyd
6 rows selected

Similar Messages

  • How to make a row non-editable depending on a db column value

    HI,
    I've an editable report region and the requirement is to make the row non-editable according to the value in one of the column. Like if the value for that column is null the row should be editable else non-editable. Any option to do this in Oracle APEX.
    Regards,
    Prasanth

    I assume you are using a tabular form. In that case, you would have to run a loop in Javascript to read all the rows in the Form. The example is given below. You can use Firebug in Firefox to identify your field names and replace f02, f03 and f04 with your field names.
    <script language="JavaScript" type="text/javascript">
    function f_readonly_items(){
    for (i=0;i<document.wwv_flow.length;i++)
    if (document.wwv_flow.f02.value) != Null
    document.wwv_flow.f02[i].readOnly = true;
    document.wwv_flow.f03[i].readOnly = true;
    document.wwv_flow.f04[i].readOnly = true;
    </script>
    Hope this helps.

  • How can i know the row number of my table is being modified?

    HI all,
    I have a table in my web dynpro and several columns as checkbox... I put an event OnToggle in these columns.
    Do you know any way to get the row or the row number?
    If i use the method get_static_attributes return to me the selected row not the modified.
    Thanks in advance !

    EDIT: thanks ! is solved, i need to pass CONTEXT_ELEMENT' in the  <ELEMNT_NAME>
    This is my code:
    DATA table_element TYPE REF TO if_wd_context_element.
      DATA row_index TYPE i.
      table_element = wdevent->get_context_element('CONTEXT_ELEMENT').
      IF NOT table_element IS INITIAL.
        row_index = table_element->get_index( ).
      ENDIF.
    Edited by: Husalban RM on Sep 15, 2010 4:53 PM

  • How can I get the row number of display automatically on a table?

    I have a table of measurements, and I would like the row number to be displayed on each row. The challenge is that each time I run the program, the total number of rows will be different, so I would like the numbers to update every time I run the program based on the current number of rows.
    I have attached a picture to illustrate what I am trying to do.
    Solved!
    Go to Solution.
    Attachments:
    picture of table.JPG ‏70 KB

    Find the attached example (saved in version 2009), and you can extract what you need for your code...!!
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.
    Attachments:
    Example (Enter Row Header).vi ‏12 KB

  • How to display a fixed number of rows in a page when using CL_GUI_ALV_GRID

    Hy experts
    How to display a fixed number of rows in a page when using CL_GUI_ALV_GRID?? lets say 500 ?? because my display table it may contain in some cases 10.000 and evidently I can t see all of them..
    I have a button in my toolbar witch triggers this event
    (display 500 records ) but I don t have the logic to do this only with methods of CL_GUI_ALV_GRID.
    can you tell me a standard method of CL_GUI_ALV_GRID witch can help me do this?? any hint will be good..
    Till now I was used to add a column to my structure witch represents a flag that is a number corresponding to every 500 records (a batch containing 500 records )
    first       500 - flag -> 1
    second  500 - flag -> 2
    etc..but I m convinced that exists a way of doing this more easy..without damaging my structure..
    thanx in advance..don t be shy..reply if you have any hints..

    Hi,
    if method SET_FILTER_CRITERIA doesn´t help, I think that you must work with 2 internal tables, a counter and a loop for filtering the records to be displayed:
    case counter.
      when 1.
         loop at int_table1 from 1 to 500.      "<-- your table with all records
           move int_table1 to int_table2
        endloop.
      when 2.
         loop at int_table1 from 501 to 1000.     
           move int_table1 to int_table2
        endloop.
    etc, etc.
    Call grid-->SET_TABLE_FOR_FIRST_DISPLAY
       exporting
         IT_OUTTAB = int_table2                "<-- instead of your currently table int_table1

  • How to get the number of the row added to tabular form by the AddRow()

    using 4.0. User clicks an Add button which calls a javascript function that gets a couple page item values, inserts a row (addRow(), and updates columns in that newly inserted row with the values from the page items. This works fine if I hard code the row number (so it saves the page item values into the row I specify) but I don't know how to get the row number of the newly inserted row?
    i.e html_GetElement('f12_0003').value = DocName; will set the element F12 at row 3 correctly, but I need to have the 0003 replaced with a variable that has its value set after addRow() but can't figure out how.

    hi,
    use the following code:
    CALL METHOD OF gv_selection 'Information' = gv_curpage
        EXPORTING
        #1 = 3. " get current page number
      CALL METHOD OF gv_selection 'TypeText'
        EXPORTING
        #1 = gv_curpage. "show current page number
      CALL METHOD OF gv_selection 'TypeText'
        EXPORTING
        #1 = ' of '.
      CLEAR gv_endpage.
      CALL METHOD OF gv_selection 'Information' = gv_endpage
        EXPORTING
        #1 = 4. "get total page number
      CALL METHOD OF gv_selection 'TypeText'
        EXPORTING
        #1 = gv_endpage. " show total page number
    Edited by: VoonHan on Oct 13, 2009 7:35 AM

  • How to get the row number

    Hi list,
    does any one know how I can get the row number the same as what I have in column rowno?
    thanks
    Arvin
    REATE   TABLE dbo.temptable
    ( y int  NOT NULL,
      e int not null,
      c int not null,
      rowno int not null)
    /* insert values  */
    INSERT INTO dbo.temptable(y,e,c,rowno ) VALUES
    (1,1,1,1),
    (1,1,2,1),
    (1,1,3,1),
    (1,20,1,2),
    (1,20,2,2),
    (1,20,3,2),
    (1,3,1,3),
    (1,3,1,3),
    (2,1,1,1),
    (2,1,1,1),
    (2,2,1,2),
    (2,2,1,2);

    You may update your rownumber column with Column "e".
    But why do you duplicate your data? May be there is no particular reason, you may be wasting space for it
    Try the below:
    CREATE TABLE dbo.temptable
    ( y int NOT NULL,
    e int not null,
    c int not null,
    ronum int null)
    INSERT INTO dbo.temptable(y,e,c ) VALUES
    (1,1,1),
    (1,1,2),
    (1,1,3),
    (1,20,1),
    (1,20,2)
    select * from temptable
    update dbo.temptable Set ronum=e
    Select * From dbo.temptable
    DRop table dbo.temptable

  • TS2846 My Services are from 3 Network UK, what should i do to get my phone number corrected in iTunes as it is displaying still the old number I was given at the time of purchase wheras it is now changed on my request

    My Services are from 3 Network UK, what should i do to get my phone number corrected in iTunes as it is displaying still the old number I was given at the time of purchase wheras it is now changed on my request

    Try Settings > General > Reset > Reset Network Settings on your device.
    Note you may have to re-enter stored Wi-Fi passwords after using this feature.
    tt2

  • Display Line/Row  number in Grid

    Hi,
    How to display the row number (1,2,3...) in a grid?
    Should I go only by changing the query?
    Or is there any SDK supported way of doing that?
    Please help me with this information.
    Thanks.
    Geetha

    Hi Geetha,
    didn't have time to answer your earlier ...
    you are looking for something like
    SELECT (SELECT COUNT(*)
              FROM OCRD T2
             WHERE T2.CardCode <= T1.CardCode) as RowIndex, T1.*
    FROM OCRD T1
    ORDER BY RowIndex
    this sample will display a row number of the complete ocrd table

  • Adding a counter that keeps track of the total number of times a loop has run, even if LabVIEW has been restarted.

    Hi all,
    I am writing a VI for measuring data and inserting it into a database. The measurements are controlled by a loop that runs once every minute. I want to give each measurement a unique id number and store this too in the database.
    To do this, I want to add a counter to this loop so that I can count the number of times the loop has executed in total. This is, even if the VI, LabVIEW or even th PC is restarted, I want the counter to keep track of the number of executions. If say, the loope executes two times and then the VI is stopped and restarted, I want the following number on the counter to be three.
    Does anyone have an idea about how to do this? I am gratefule for any help!
    Clara
    Message Edited by Clara G on 05-11-2010 08:21 AM
    Solved!
    Go to Solution.

    Not allowed to give away code but I can describe one of my "Totalizers" used to keep track of how much stuff has passed through a fliter so we know when to change it.
    THe Total izer is implemented as an Action Engine.
    It has three actions (methods)
    1) Init - Opens an ini file and reads the last values read and cahces these in shift registers. It also inits a timer so we now how long since the last file I/O.
    2) Update - Uses the data passed by the caller to update the totals. It also checks how long since the last save and if more than one minute it writes to the ini file (forced write).
    3) Read - returns the totals for display and evealuating if a an alarm should be triggered to change the filter.
    Note:
    THe pre-LV 8.6 version of the ini file exposed methods to allow writing to the file. The new ini functions do not expose that functionality and require closing the file.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to display more rows in Master-detail form

    I am working on APEX3.2.
    I have a master-detail form. The detail form always display 15 rows. However, my customer wants the detail display all the rows. I tries to configure the Number of Rows in the report. It doesn't work. How do I do it?
    Thanks a lot!

    Hi:
    To increase number of rows displayed you have to set Number of Rows and pay attention to both Number of Rows (Item) and Maximum Row Count.
    After that if didn't work, sign out or close the browser then open it again. Sometimes it keeps the value in current session.
    Saad,

  • How to display first row value returened from a query as checked as default in a report

    How to display first row value returned from a query as checked as default in a report
    Example
    Parameter 1
    Paramerter2
    ABD
    x(checked)
    Test
    DEF
    JMG
    Mudassar

    Hi Mudassar,
    The issue is caused by the order in which the parameters appear in the report data tab can be difference between our report execution and it failing. In other words, “Parameter2” is execution before parameter “A” due to this issue. We can adjust the parameter’s
    order to solve the issue.
    If “Parameter2” is parameter “A”, we cannot use that expression. Because fields cannot be used in report parameter expression, if we want to display the first value returned from a query as default value, we have to fill the “Specify values” text box with
    the specific value in Default Values dialog box.
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • How to display All User Logged in time & Logout Time?

    How to display All User Logged in time & Logout Time?
    Hi..
    I want to display All user who logged in the portal,
    their username,
    their time logged in,
    their time logged out..
    where can i find these information?
    do Portal have already something like this?
    Plz advise..Thanks.

    The login information is in the wwlog_activity_log. The logout action is only logged when it is explicit. I am using the last user action time for the logout time so I can determine the duration of the visit.

  • How to return the week number starting from Sunday as the first day

    Hi Friends,
    My application needs to have a report for the weekly totals and must have the Sunday as the first day for the week. For example, January of 2005 should be in the report for having six weeks, Jan 1 is Saturday, this is week 1, Week 2 is from 2 to 8, and the last week , week 6 has 30 and 31. Days need not be displayed, only the week number as follows:
    Week Number Total Sales
    =========== =========
    Week 1 8,525
    Week 2 8,168
    Week 3
    Week 4
    Week 5
    Week 6
    The discoverer hierarchies function for week (eul_date_trunc(item_date, '"W"W')) seems to start the week from the first day of the month regardless of the day. Oracle function TO_CHAR(item_date, 'W') does the same thing, .As the result, the January of 2005 has only 5 weeks.
    Any help or advice for this issue will be greatly appreciated.
    Thank you very much,
    J.K

    Try this
    ---------------------------------------------actual formula---------------
    select ceil(
    ( to_number(to_char(to_date('1-'||to_char(sysdate,'MON-YYYY'),'DD-MON-YYYY'),'D')) -1
    + to_number(to_char(sysdate,'DD'))
    ) / 7
    week_number
    from dual
    e.g try different dates below by replacing 31-Jan-2005
    select ceil(
    ( to_number(to_char(to_date('1-'||to_char(to_date('31-JAN-2005'),'MON-YYYY'),'DD-MON-YYYY'),'D') ) -1
    + to_number(to_char(to_date('31-JAN-2005'),'DD'))
    ) / 7
    week_number
    from dual
    How does it work
    week number is calculated by dividing the current day number by number of days
    so in your case if the week starts at a different day , you just add the offset and divide by 7
    In the first part, i am finding the week day number for the 1st day of the current month and this is used as offset.
    Hope this helps
    -nj
    http://www.infocaptor.com

  • Retrieving the row number where a certain value exists

    Hi,
    I wanted to find out if there is a way to retrieve the row number of a row where a certain value exists. For example, if I had a query
    Create or replace Procedure p1
    IS
    v_Stmt varchar2(100);
    BEGIN
    v_Stmt := 'Select * from emp where lname = 'Davis'';
    Execute Immediate v_Stmt;
    END;
    SQL> exec p1;
    Then, I would like to find out that this name is on row 3.
    Can anyone tell me how this can be done?
    Thanks in advance.
    Sincerely,
    Nikhil Kulkarni

    theres is no rownum related to a particular row. A rownum is a pseudocolumn which value may be different for the same row depending on the query you do. What you can use is the rowid which is the row's address.
    HTH
    Maurice

Maybe you are looking for