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

Similar Messages

  • Retrieving the row number of a specific record from the results of a MySQL query

    I want to create a MySQL query that will return a list of
    records, and then retrieve the row number of a record with a
    specific ID. How can I do this?
    *server-side script: PHP

    <?php
    $i = 0;
    do {
    $i++;
    } while (mysql_fetch_assoc($rsWhatever) &&
    $row_rsWhatever['ID'] !=57);
    echo "TADA -" . $i;
    ?>
    (assuming that ID is numeric, and that the test value
    actually exists in the
    database)
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "AngryCloud" <[email protected]> wrote in
    message
    news:g4e6ck$hrb$[email protected]..
    >I will use this scenario for an example:
    >
    > I want to know how far down the list I will find the ID,
    '57'.
    >
    > So I manually look at the list of results and see it is
    the 25th record
    > down
    > on the list.
    >
    > How do I get my PHP script to get this number (25)
    automatically?
    >

  • 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

  • My computer crashed, I don't have the serial number for lightroom 4.  Is there any way to retrieve the serial number.  I can't remember where I purchased this.

    My computer crashed, I don't have the serial number for lightroom 4.  Is there any way to retrieve the serial number.  I can't remember where I purchased this.

    Lfiles37 if the serial number has been registered then it will be available under your account.  You can find more details at Find your serial number quickly - http://helpx.adobe.com/x-productkb/global/find-serial-number.html.

  • Function module to retrieve the account number linked to an SD invoice item

    Hi all,
    I should retrieve the gl account number linked to a certain SD invoice item. The
    program starts from VBRK and VBRP data. Is there a function module which
    enables to get it starting from these header lines? I already used the function
    module: RV_INVOICE_ACCOUNT_DETERM ( release: 4.0 ), but in some cases it
    doesn't seem to function properly ( the export table TKOMV doesn't contain a
    value for the SAKN1 field ). For the invoices for which the function isn't able to
    retrieve the account number, the standard accounting analysis functionality returns
    the following message: account determination carried out via KOFI type. So I'm
    searching for a function module that's able to retrieve the account number in these
    cases also.
    Thanks in advance.
    Adriano.

    Dear Adriano,
    Try with Function Module 'SD_DETERMINE_ACCOUNT_INVOICE '.
    Additional Info:
    BAPIs related salesorder:
    BAPI_SALESORDER_CHANGE Sales order: Change Sales Order
    BAPI_SALESORDER_CONFIRMDELVRY Sales Order: Confirmation of Delivery; Document Flow Update
    BAPI_SALESORDER_CREATEFROMDAT1 Sales order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDAT2 Sales order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDATA Create Sales Order, No More Maintenance
    BAPI_SALESORDER_GETLIST Sales order: List of all Orders for Customer
    BAPI_SALESORDER_GETSTATUS Sales Order: Display Status
    BAPI_SALESORDER_SIMULATE Sales Order: Simulate Sales Order
    FM:
    MB_ADD_PURCHASE_ORDER_QUANTITY (Reading and adding open purchase order quantities)
    SD_SALES_ORDER_STATUS_WWW for complete details including the delivery information.
    Hope this will help.
    Regards,
    Naveen.

  • Able to retrieve the row in toad but unable to fetch the same after executing the VO.........

    Hi all...
    I have a issue where i am able to retrieve the row in TOAD
    but when I try to do the same by creating VO and passing parameters using setWhereClauseParams()
    I am able to execute the VO but the rowcount is 0.....
    any sort of help is appreciated....
    the query in my VO is
    SELECT NVL(WB.VEHICLE_NO,0) VEH_NO
      FROM WAYBILL_TBL WB,
           SERVICE_MASTER_TBL SER
    WHERE WB.SERVICE_ID = SER.SERVICE_ID
       AND WB.DEPOT_CODE = SER.DEPOT_CODE     
       AND WB.VEHICLE_NO=:1
       AND WB.SERVICE_DATE=:2
    the code in my controller is
                  OAViewObject vo=(OAViewObject)am.findViewObject("PopUpFieldsDataLOVVO1");
                  vo.setWhereClauseParams(null);
                  vo.setWhereClause(null);
                  System.out.println("vehicle_number"+vehicle_no);
                  System.out.println("service_date"+service_date);
                  vo.setWhereClauseParam(0,vehicle_no);
                  vo.setWhereClauseParam(1,service_date);
                  vo.getQuery();
                  int rowcount=vo.getRowCount();
                  System.out.println("No.of.rows.returned"+rowcount);
    here i am getting rowcount 0
    i checked the values that are passed to the VO by using SOP even they are working correctly.......
    can any one help me here.
    thanks in advance
    DEV

    Hi Sushant
    I used the code vo.executeQuery();
    sorry  I forgot to mention previously
    even though i am getting the same rowcount that is 0
    thanx and regards
    DEV

  • 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

  • Calculating the row number with DAX

    Hello,
    Can somebody help me to obtain the row number in a calculated column using DAX (PowerPivot 2013) ?
    I do not have any column that would contain unique values (would be easy in that case !). I just want to obtain a different value in each row.
    Thank you.

    Hi DP17000,
    According to your description, you need to add a column with the RowNumber to your Pivot table by using DAX, right?
    Based on my tested, we can use a ranks function to achieve your requirement.
    =RANKX(case0305,[amount],[amount],0,dense)
    Reference
    https://msdn.microsoft.com/en-us/library/gg492185.aspx?f=255&MSPPError=-2147217396
    http://ayadshammout.com/2013/02/19/dax-rankx-function-scenarios/
    Regards,
    Charlie Liao
    TechNet Community Support

  • Alerts not retrieving the correct number of records

    Hi,
    I have created alerts to run plans. These plans are getting records from DB and populating the ADC. The alerts are getting executed but are not retrieving the correct number of records.
    I have created 5 alerts to run 5 plans all in the same time. The error at the "Data Flow service status" window is :
    CACHED RESULT
         REQUEST ID: {4EB6B955-96B3-4AF2-B836-6C9F417D47A6}
         EXECPLAN ID: {11372B4D-9ACE-4CFB-831F-11028FF996D5}
         EXECPLAN NAME: xxxx
         FIX COUNT: 0
         START TIME: 6/8/2006 12:00:01 PM
         EXECUTION TIME: 0:00:00
         Sink Records Blocks Disk Blocks Fix Count Hit Count Execution Status
         0: 0 0 0 0 0
    Complete - ERROR Error while processing the data for the step 'SQL Query'
    This error is seen for 2-3 plans .......
    But if i execute the plan manually from design studio there is no error.
    So
    1. Do i need to change anything in the config files to increase the MAx memory block?
    2. Is there any way, the plans can be run one at a time i.e. configure alerts in such a way that if one plan finishes the other one starts automatically? Currently i have scheduled the plans to run at the same time using Alerts..
    Please help...
    Thanks

    Here is one 'culprit' you can verify. Open DesignStudio. You should "--not--" see any grids or icons on (near) the botton status row. If you see them - right click and delete them. These are plans with same_names put in 'locked' state. After you do this. close your design studio.
    Note- if you ever open a plan in designstudio, always "save" it and close it (exit). Donot click on window [x] mark to close the appl.
    After above verifrication -- restart EnterpriseLink and restart PlanMonitor, verify if everything runs fine.
    --sanjeev                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • TableView -- get the row number of the top most current visible row

    Is there any way to get the row number of the top most visible row, and or bottom most visible row in TableView?

    If you already know the document's name, the sheet's name and the table's name, the easy way is :
    --Here you may replace the three values by the current ones
    set dName to 1
    set sName to 1
    set tName to 1
    tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
    tell first cell of the selection range to set {rowNum1, columnNum1} to {address of its row, address of its column}
    tell last cell of the selection range to set {rowNum2, columnNum2} to {address of its row, address of its column}
    end tell
    Yvan KOENIG (VALLAURIS, France) mercredi 9 février 2011 17:22:21

  • About the row number of the datagrid[Flex 2.0 beta3]

    I want to add a column to the datagrid,which will indicates
    the row number.Who can tell me how to do it?
    And how to keep the number's sequence unchanged when the
    header of one of other columns is cliked to sort the
    data?

    If I understand this correctly. Then would it not make more
    sense to say in
    the LiveDocs --
    makeObjectsBindable - After the remote call (RPC, HTTP, SOAP,
    etc) returns
    its value. Flex tries to automatically convert the result
    into an
    ArrayCollection (if it looks like an array, even if it was
    XML) [Or
    others???] format. This automatic conversion controlled by
    the
    makeObjectBindable property. If false, Flex does not attempt
    the conversion
    and the result will be in (xml?) format.
    "peterent" <[email protected]> wrote in
    message
    news:eali1i$1q9$[email protected]..
    > Results that come back which look like Arrays will be
    turned into
    > ArrayCollections automatically. Since most people
    immediate turn an Array
    > into
    > an ArrayCollection, we went ahead and did it for you.
    Try getting rid of
    > your
    > new ArrayCollection in the result handler.
    >

  • I can't get the row number of the current selection

    Hi all,
    How can I get the row number of a selection if I don't know the range selected? I need it to store in variable.
    I've tried in many ways, but unsuccesfully.
    Thank's in advance.

    If you already know the document's name, the sheet's name and the table's name, the easy way is :
    --Here you may replace the three values by the current ones
    set dName to 1
    set sName to 1
    set tName to 1
    tell application "Numbers" to tell document dName to tell sheet sName to tell table tName
    tell first cell of the selection range to set {rowNum1, columnNum1} to {address of its row, address of its column}
    tell last cell of the selection range to set {rowNum2, columnNum2} to {address of its row, address of its column}
    end tell
    Yvan KOENIG (VALLAURIS, France) mercredi 9 février 2011 17:22:21

  • How do I change the phone number where sms is sent to activate keychain?

    How do I change the phone number where sms message is sent to activate Keychain?  It keeps sendingit to an old phone #, and is most frustrating!

    System preferences > iCloud > Keychain > options.

  • How to retrieve the vendor number during creation of Purchase Order?

    Dear SAP experts,
    For our Purchase Orders, during PO creation (t-code ME21 or ME21N) we want to achieve the following:-
    1) default the delivery address to our plant A address if the vendor is local and
    2) default the delivery address to our plant B address if the vendor is foreign.
    At the moment, we are trying to use the user exit enhancement "MMDA0001" to achieve the above.
    The problem is how to retrieve the vendor number from the screen so we could pass the vendor number to ZXM06U32 to check the ktokk field in LFA1 table in the whether the vendor is foreign or local.
    Thank you in advance.
    Regards,
    Alex

    u can do one thing, create 2 partner function, like 1 for local, and second for import vendor.
    or make 2 batch  n activate vendor batch and make mandatory field from SPRO. 
    then goto SHD0, and do one by one step. first time take 1st requirement and second time take second . like that make two variant .
    i dont know how much it will be helpful. bt i want to suggest smth like that only.
    or, go for ABAPER help
    thanks
    nisha

  • 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

Maybe you are looking for