Is it possible to select a subset of rows from a Numbers table?

I know I can use the COUNTIF, SUMIF, AVERAGEIF functions to operate on a subset of rows in a Numbers table based on a condition. What I would like is to be able to use other functions, for example the MAX and MIN functions.
For example, give a table like this:
A
B
1
Fred
20
2
George
30
3
Fred
25
4
Bob
15
5
Bob
20
6
Fred
10
7
George
9
8
George
25
9
Fred
12
10
Bob
13
What I want could be expressed as =MAX( SELECTIF(A1:A10, "=Fred", B1:B10) )
Where the SELECTIF function would return a range containing B1,B3, B6 and B9 that could be operated on by the MAX function.

There is no single function to do what you want.  Here is a way you can achive your goal:
This is a down-and -dirty solution because I am not sure how you want to use the informtion (so I kept it all in one table):
E1=IFERROR(MATCH($D$1, B, 0), "")
F1=IFERROR(VLOOKUP(E1-1,$A$2:$C$11, 3), "")
E2=IFERROR(E1+MATCH($D$1, INDIRECT("B"&E1+1&":B"&ROWS(Table 11)), 0), "")
F2=IFERROR(VLOOKUP(E2-1,$A$2:$C$11, 3), "")
select E2 and F2, then fill down
Now find the max:
D2=MAX(F)

Similar Messages

  • How do I select a range of rows from an internal table in the debugger?

    Hi,
    I have a case where I wanted to delete a range of rows (several thousand) from an internal table using the debugger.
    It seems that rows can only be selected one at a time by selecting (clicking) on the far left side of the row.
    This is cumbersome, if not impossible when wishing to delete several thousand rows. 
    Other tools, such as Excel for example, allow for selecting a range of rows by selecting the first row and then holding the SHIFT key and selecting the last row and all rows in between will be selected.
    I can't seem to find the combination of keys that will allow this in the table (or structure) tab of the debugger.
    Is it possible to select a range of rows without having to select each row one at a time?
    Thanks for your help,
    Andy

    While it's a Table Control and should/could have a button to select all fields (or visible fields)...I don't think we can do it right now...I know it's a pain to select each row one at a time...but I don't we have any more options...
    Greetings,
    Blag.

  • Randomly selecting some rows from the database table

    Hi can some one help me in selecting some rows from a database table which has around 90,000 rows.
    Thanks.

    One thing you might try is the "sample" clause if you have 8i which is supposed to return a random percentage of the table. Say for example, you have a sequence number on your table as the pkey. Then you might try:
    select * from <table_name> where pkey in(select pkey from <table_name> sample(10));
    This should give you a random 10 percent of the rows in the table but I tried this once and the results seemed unpredictable. For example it returned a different number of rows each time even though the number of rows in the table didn't change.
    Hope this works for you.

  • Select subset of rows from league - help!

    I have a league with 15 teams, but I only want to show 5 teams at a time. However, one of these teams must be my team (TeamX).
    So I need a select statement that will find TeamX and will return 5 teams with 3 teams above and 1 below it.
    However, if TeamX is within the top 3, I just need to display the top 5 teams, and if TeamX is bottom of the league, I just need to display the 4 teams above it!
    I have absolutely no idea how to go about doing this!

    This is not a very inspired solution...I guss I've been in the sun too long today. But, if your teams are ranked in order 1st, 2nd, 3rd, etc. then this should do the trick. You can move TEAMX around in the list to see the different use cases.
    WITH teams AS
    SELECT 'TeamA' team_name, 1 rank FROM dual
    UNION ALL
    SELECT 'TeamB', 2 FROM dual
    UNION ALL
    SELECT 'TeamC', 3 FROM dual
    UNION ALL
    SELECT 'TeamD', 4 FROM dual
    UNION ALL
    SELECT 'TeamE', 5 FROM dual
    UNION ALL
    SELECT 'TEAMX', 6 FROM dual
    UNION ALL
    SELECT 'TeamF', 7 FROM dual
    UNION ALL
    SELECT 'TeamG', 8 FROM dual
    UNION ALL
    SELECT 'TeamH', 9 FROM dual
    UNION ALL
    SELECT 'TeamI', 10 FROM dual
    SELECT t1.team_name,
           t1.rank
    FROM   teams t1,
            SELECT team_name,
                   rank,
                   max(rank) OVER () max_rank
            FROM   teams
           ) t2
    WHERE  t2.team_name = 'TEAMX'
    AND    t1.rank >= least(greatest(t2.rank-3,1),t2.max_rank-4)
    AND    t1.rank <= least(greatest(t2.rank-3,1),t2.max_rank-4)+4
    ORDER BY t1.rank;
    TEAM_       RANK
    TeamC          3
    TeamD          4
    TeamE          5
    TEAMX          6
    TeamF          7Here's how it came out with TEAMX in 2nd...
    TEAM_       RANK
    TeamA          1
    TEAMX          2
    TeamB          3
    TeamC          4
    TeamD          5And in 9th...
    TEAM_       RANK
    TeamF          6
    TeamG          7
    TeamH          8
    TEAMX          9
    TeamI         10Greg

  • Deleting Millions of Selected rows from a production Table.

    Hi Friends.
    I have to copy millions of Rows from one table to a second one to do and export of its Data and run a Truncate command after(Second one). The main problem is the Time spend it in the Deleting process. The Inserting is nice and easy with /* +Append */ But The Deleting is a mess because required to much time and make the process really slow....Could someone give me a tip with this issue?  Thanks for your time!
    Emmanuel G. Carrillo Trejos.

    It would help if you could quntify "subset" here. If you are deleting 75% of the table, it will likely be faster to follow Syed's suggestion and move the data you want to keep to a new table, drop the old table, and rename the new table to the old table name. If you are going to be deleting a small fraction of rows, but you are going to be doing this regularly (i.e. you delete all rows older than X days), it will be faster to partition the table and drop the partition.
    I see no possible beneit to playing around with any transaction-related comands.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to efficiently select random rows from a large table ?

    Hello,
    The following code will select 5 rows out of a random set of rows from the emp (employee) table
    select *
      from (
           select ename, job
             from emp
           order by dbms_random.value()
    where rownum <= 5my concern is that the inner select will cause a table scan in order to assign a random value to each row. This code when used against a large table can be a performance problem.
    Is there an efficient way of selecting random rows from a table without having to do a table scan ? (I am new to Oracle, therefore it is possible that I am missing a very simple way to perform this task.)
    thank you for your help,
    John.
    Edited by: 440bx on Jul 10, 2010 6:18 PM

    Have a look at the SAMPLE clause of the select statement. The number in parenthesis is a percentage of the table.
    SQL> create table t as select * from dba_objects;
    Table created.
    SQL> explain plan for select * from t sample (1);
    Explained.
    SQL> @xp
    PLAN_TABLE_OUTPUT
    Plan hash value: 2767392432
    | Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT    |      |   725 | 70325 |   289   (1)| 00:00:04 |
    |   1 |  TABLE ACCESS SAMPLE| T    |   725 | 70325 |   289   (1)| 00:00:04 |
    8 rows selected.

  • HOW TO GET THE SELECTED VALUE IN A ROW FROM ONE VIEW TO ANOTHER VIEW?

    hi all,
    I  have a small issue.
    i have created two views.In the table of the first view i'm selecting a row and pressing the button it will move to next view.
    i am adding some fields manually in the table of the second view and pressing the save button.Here all the values should get updated corresponding to the field which i have selected in the first view.
    I want to know how to get the particular field in the selected row from one view to another view.
    Kindly help me.

    Hi,
            Any data sharing accross views can be achiveved by defining CONTEXT data in COMPONENT CONTROLLER and mapping it to the CONTEXT of all the views. Follow the below steps.
    1. Define a CONTEXT NODE in component controller
    2. Define same CONTEXT NODE in all the views where this has to be accessed & changed.
    3. Go to CONTEXT NODE of each view, right click on the node and choose DEFINE MAPPING.
    This is how you map CONTEXT NODE and same can be accessed/changed from any VIEW or even from COMPONENT CONTROLLER. Any change happens at one VIEW will be automatically available in others.
    Check the below link for more info regarding same.
    [http://help.sap.com/saphelp_nw04s/helpdata/EN/48/444941db42f423e10000000a155106/content.htm]
    Regards,
    Manne.

  • How do I select rows from the same table that have multiple occurances

    Hi Everybody,
    I am trying to select records from a detail table by grouping it. The table has more than 1 million records and the query is not performing well. The basic question is how to select a distinct record from a table which matches all values in one column and any in the other.
    desc SCV
    ID NUMBER PK (ID + SCRID)
    SCRID NUMBER FK(SC)
    ID SCRID
    1 1
    2 1
    3 1
    4 2
    5 2
    6 3
    7 4
    8 4
    desc PROJECTS
    ID NUMBER PK
    NAME VARCHAR2(100)
    ID NAME
    1 PROJECT1
    2 PROJECT2
    3 PROJECT3
    4 PROJECT4
    desc PJS
    ID NUMBER
    PROID NUMBER FK (PROJECTS)
    SCRID NUMBER FK (SCV(SCRID + SCVID)
    SCVID NUMBER
    ID PROID SCRID SCVID
    1 1 1 1
    2 1 1 2
    3 1 2 5
    4 1 3 6
    5 1 4 7
    6 2 1 3
    7 2 2 4
    8 2 2 5
    9 2 4 7
    There are over 1 million records in PJS.
    desc TBP
    SCRID NUMBER
    SCVID NUMBER
    SCRID SCVID
    1 1
    1 2
    1 3
    2 4
    2 5
    3 6
    4 7
    4 8
    The requirement is to select projects that have matching SCRID, SCVID from TBP such that
    all distinct SCRID should match and within that and any SCVID match will do. (A "AND" between each SCRID and an "OR" for each SCVID in that SCRID like 'SCRID = 1 AND (SCVID = 1 OR SCVID = 2 OR SCVID = 3) AND SCRID = 2 AND (SCVID =....)
    So, for the sample data it should return us PROID = 1
    I have few queries written for this:
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 1
    INTERSECT
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 2
    INTERSECT
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 3
    INTERSECT
    SELECT PROID FROM PJS,TBP WHERE TBP.SCVID = PJS.SCVID AND TBP.SCRID = 4
    This query performs well but the cost is very high, hardcoding, sorting.
    The 2nd option is to:
    SELECT pjs.PROID proid
    FROM TBP tbp,
    PJS pjs
    WHERE pjs.SCVID = tbp.SCVID
    AND pjs.SCRID = tbp.SCRID
    GROUP BY pjs.PROID
    HAVING COUNT(DISTINCT pjs.SCRID) = (SELECT COUNT(DISTINCT SCRID ) FROM TBP)
    This has a low cost but runs slowly.
    One more way I tried was with the IN operator like
    SELECT DISTINCT PROID FROM PJS A,TBP T WHERE T.SCRID = 1 AND T.SCVID = A.SCVID
    AND PROID IN (SELECT PROID FROM PJS A,TBP T WHERE T.SCRID = 2 AND T.SCVID = A.SCVID
    AND PROID IN (...SO ON with each DISTINCT SCRID.
    Again this involves too much of sorting.
    Any help will be appriciated.
    Thanks in advance.

    Hi Andrew,
    Use DELETE t_itab statement inside the loop.
    I have modified your code. It is perfectly working.See bellow  -
    LOOP AT it_zmember01 INTO wa_zmember01.
    WRITE: / wa_zmember01-mnumber UNDER 'NUMBER',
    wa_zmember01-mname UNDER 'NAME',
    wa_zmember01-mdob UNDER 'DOB'.
    WRITE / '-----------------------------------------------------------------'.
    DELETE it_zmember01.               " Modified
    ENDLOOP.
    DELETE it_zmember01. statement inside the loop will delete the current row of the table.
    Regards
    Pinaki

  • Selective deletion of a row from a cube

    Hi Friends,
    I need to delete a row from a cube through selective deletion from manage tab. I had struck while giving selecting the criteria for that deletion.
    My Quesion is;
    1) What criteria i need to give to delete the row apart from business related information?
    2) What is data packet SID ? what i have to mention in that column?
    3) What is Request id SID? what i have to mention in that column?
      Please help me on the above issue.
    regards,
    Mahesh

    Hallo
    Of xourse you do it for example from Infoprovider, right click maanage, Content (first tab) Selective deletion.
    Then you get a tab where you can schedule the job according to the selections in the tab Selective Deletion where you can set a filter for the characteristics included in the Cube.
    You can select single Characteristics vlue oder range or multiple.
    If you want to dlete a record than you have to know the key of this records. For example if you have
    customer
    company
    month
    if you select only month, then you delete all month but if you restrict to month and cusotmer than you delete the combination of them.
    Reuest sid is the identifier of the request which you see on the tab manage of the cube. you select on that and in this case you will delete all request it means all records loaded with the request.
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/e60138fede083de10000009b38f8cf/frameset.htm
    Mike
    Best Regards
    Mike

  • How can i select the rows from the 3 tables by particular column name?

    Vehicle Passing Summary table structure
              PsngSmry_ID(Number),Vehicle_iD(Number),PsngSmryTime(datetime)
    Vehicle table structure
              Vehicle_iD(Number),VehicleName(VarChar2),VehicleType(VarChar2)
    Here Vehicle_iD is the Primary Key
    Equipment Table Structure
              Eqpmt_id(Number),Vehicle_iD(Number),EqpmtName(VarChar2),EqpmtType(VarChar2)
    Here Eqpmt_id is the Primary Key and Vehicle_iD is the foreign Key
    Equipment Component Table Structure
              Eqpmt_Cmpnt_id(Number) ,Eqpmt_id(Number),EqpmtCmpntName(VarChar2),EqpmtCmpntName(VarChar2),Parent_Eqpmnt_ID(Number)
    Here Eqpmt_Cmpnt_id is the Primary Key and Eqpmt_id is the foreign Key
    The rows in the Vehicle Passing Summary table
         PsngSmry_ID Vehicle_ID     PsngSmryTime
         111111          80986246     2010/10/11
         111112          80986247     2010/10/12
         111113          80986248     2010/10/10
    The rows in the Vehicle Table
         Vehicle_iD     VehicleName     VehicleType
         80986246          Lorry          Four Wheeler
         80986247          Van          Four Wheeler
         80986248          Bus          Four Wheeler
    The rows in the Equipment Table:
         Eqpmt_id     Vehicle_iD     EqpmtName          EqpmtType
         109846          80986246          2 Axle Lorry          CAR
    109821          80986246          4 Axle Lorry          CAR
    109825          80986246          4 Axle Lorry          CAR
         109562          80986247          2 Axle VAn          CAR
    109555          80986247          3 Axle VAn          CAR
    109777          80986247          3 Axle VAn          CAR
         109587          80986248          2 Axle Bus          CAR
    The rows in the Equipment Component Table :
         Eqpmt_Cmpnt_id Eqpmt_id EqpmtCmpntName Parent_Eqpmnt_ID
         20904146          109846          Truck               
         20904147          109846          Truck
         20904148          109846          Axle               20904146
         20904159          109846          Axle               20904146
         20904167          109846          Wheel               20904148
         20904177          109846          Wheel               20904148
         20904185          109846          Wheel               20904159
         20904325          109846          Wheel               20904159
         20904188          109846          Axle               20904147
         20904189          109846          Axle               20904147
         20904195          109846          Wheel               20904188
         20904196          109846          Wheel               20904188
         20904197          109846          Wheel               20904189
         20904398          109846          Wheel               20904189
         10904146          109562          Truck               
         10904147          109562          Truck
         10904148          109562          Axle               10904146
         10904159          109562          Axle               10904146
         10904167          109562          Wheel               10904148
         10904177          109562          Wheel               10904148
         10904185          109562          Wheel               10904159
         10904325          109562          Wheel               10904159
         10904188          109562          Axle               10904147
         10904189          109562          Axle               10904147
         10904195          109562          Wheel               10904188
         10904196          109562          Wheel               10904188
         10904197          109562          Wheel               10904189
         10904398          109562          Wheel               10904189
    Note : In Equipment Component Table,the hierarchy will be Truck-->Axle-->Wheel.So
    1.the Parent_Eqpmnt_ID of Axle is Truck's Eqpmt_Cmpnt_id.
    2.the Parent_Eqpmnt_ID of Wheel is Axle's Eqpmt_Cmpnt_id.
    Now I want to write the store procedure which will take "PsngSmry_ID(Number)" as input and the o/p will be in the format :
         Eqpmt_Cmpnt_id Eqpmt_id EqpmtCmpntName Parent_Eqpmnt_ID
         20904146          109846      Truck     
         20904148          109846      Axle               20904146
         20904167          109846      Wheel               20904148
         20904177          109846      Wheel               20904148     
         20904159          109846      Axle               20904146
         20904185          109846      Wheel               20904159
         20904325          109846      Wheel               20904159
         20904147          109846      Truck
         20904188          109846      Axle               20904147
         20904195          109846      Wheel               20904188
         20904196          109846      Wheel               20904188
         20904189          109846      Axle               20904147
         20904197          109846      Wheel               20904189
         20904398          109846      Wheel               20904189
         10904146          109562          Truck     
         10904148          109562          Axle               10904146
         10904167          109562          Wheel               10904148
         10904177          109562          Wheel               10904148     
         10904159          109562          Axle               10904146
         10904185          109562          Wheel               10904159
         10904325          109562          Wheel               10904159
         10904147          109562      Truck
         10904188          109562      Axle               10904147
         10904195          109562      Wheel               10904188
         10904196          109562      Wheel               10904188
         10904189          109562      Axle               10904147
         10904197          109562      Wheel               10904189
         10904398          109562      Wheel               10904189
    **Please add these columns in the o/p **
    1.EqpmtName and EqpmtType from Eqpmt table
    2.VehicleName and Vehicle Type from Vehicle table
    3.PsngSmryTime from PassingSummary table **
    Can anyone tell me the solution?
    Edited by: 865216 on Jun 22, 2011 2:14 AM

    Hi,
    I am new to this technology;But, just wanted to help you.
    Please refer the code it might be atleast helpful for you.
    But am facing PL/SQL: ORA-00933: error and unable to resolve it.could anyone please correct this code.
    sorry if my code is totally wrong.
    Thank you,
    Rupa
    create or replace procedure Equipment_proc
    is
    begin
    DECLARE
    TYPE EQP_record IS RECORD (
    Vehicle_iD Vehicle.Vehicle_iD%TYPE,
    Eqpmt_Cmpnt_id Equipment_Component.Eqpmt_Cmpnt_id%type,
    EqpmtCmpntName Equipment_Component.EqpmtCmpntName%type,
    Parent_Eqpmnt_ID Equipment_Component.Parent_Eqpmnt_ID%type,
    Eqpmt_id Equipment.Eqpmt_id%type,
    vehicleId NUMBER);
    EQP_rec EQP_record;
    CURSOR EQP_cursor IS
    select a.Vehicle_iD,c.Eqpmt_Cmpnt_id,b.Eqpmt_id,c.EqpmtCmpntName,c.Parent_Eqpmnt_ID
    from Vehicle a,Equipment b,Equipment_Component c
    where a.Vehicle_iD=b.Vehicle_iD
    and b.Eqpmt_id=c.Eqpmt_id
    and a.vehicle_id=&EQP_rec.vehicleId;
    BEGIN
    OPEN EQP_cursor;
         FETCH EQP_cursor INTO EQP_rec;
         dbms_output.put_line(EQP_rec.Vehicle_iD,EQP_rec.Eqpmt_Cmpnt_id||','||EQP_rec.Eqpmt_id||','||EQP_rec.EqpmtCmpntName||','||EQP_rec.Parent_Eqpmnt_ID);
    CLOSE EQP_cursor;
    END;
    END;

  • Select images for a book from a light table?

    Hi,
    the light table seems to be a good place to group pictures, set relative sizes and define some general ordering. Once I have done that using the light table, I want to create a book based on the light table. One way would be to create a new empty book and drag pictures from the light table to the pages of the book.
    Is there a way to view a light table and the book's pages at the same time?
    Regards,
    Rainer Joswig
    PowerMac Dual G5, 2.5Ghz   Mac OS X (10.4.3)  

    No, you don't have to crop them. The "frames" on each page are set for the 4:3 size so that when a photo is put in a frame and enlarged to fill it all portions of the photo are still visible. You can but a 3:2 photo in a frame and it should enlarge it just so the long edge fill the frame leaving you with a little more white space.
    There's a slide bar to enlarge if necessary. If you Control-click on the image, there will be an option to Fit photo to frame size. There you may cut some off. But you'll need to experiment to see if it will suit your needs.
    Do you Twango?

  • POSSIBLE TO SELECT SPECIFIC APPLICATIONS WITH MIGRATION ASSISTANT?

    Is it possible to select specific applications to transfer from a Powerbook to an iMac? So far I've only found the given option, which imports the entire folder.
    Thanks for helping.

    http://discussions.apple.com/thread.jspa?threadID=1876275&tstart=0
    That question was answered not more than an hour ago...

  • Is it possible to select multiple values from an enumerated list?

    I have a Category with an Attribute defined as an enumerated list. Is it possible to select more than one value from the enumerated list? If not, does anyone have a recommended approach for configuring Categories or Attributes that often have more than one of the Attribute values selected? Do I just use multiple Categories and/or Attributes with the same enumerated list? If so, is there an efficient way (API, maybe) to copy the enumerated list values from one Attribute to a new one (or one Category to another)?
    Thanks for any ideas!
    ~Mark

    Boy, this is something we're struggling with too. So we'd like to hear others' ideas on this also.
    thank you,
    iggy

  • Returning a subset of rows through a ResultSet WITHOUT rownum?

    I am trying to figure out a way to get a subset of rows from a ResultSet (or ResultSet equivalent) without using rownum and without sending all the rows before the requested row over the wire.
    My problem is this: I am not in control of the SQL that is sent to the database. It is autogenerated by a third party tool (TOPLink). Therefore using the rownum solution isn't practical. My steps of operation are:
    1. Get SQL from TOPLink
    2. Pass SQL through a Statement
    3. Get resulting ResultSet
    At this point, I want to say, "Mr. ResultSet, I only want rows 200-250." And I then want Mr. ResultSet to fetch only rows 200 to 250, and no others. I don't want to see rows 1 to 199 coming over the wire.
    Anyone have any ideas? Is this possible at all? Also, if there's a way to do this through the TOPLink mechanisms (ScrollableCursors and ReportQuery objects and whatnot), please do let me know. I have tried using the TOPLink facilities, and sure enough rows 1 to 199 flow across the network.
    Thanks,
    Michael Allen
    [email protected]

    Hi Michael,
    Is there some sort of selection criteria in which you could use return the required 200-250 rows of data? If so, I would embed that into the TopLink query.
    Another option is using the ORDER BY operator. Without order, constructing a query of elements 200-250 twice would not guarentee that they would be the same elements.
    You can also construct your own SQL statement and execute it directly on a TopLink session.
    Darren Melanson
    Strategic Implementation Consultant
    Oracle Canada.
    I am trying to figure out a way to get a subset of rows from a ResultSet (or ResultSet equivalent) without using rownum and without sending all the rows before the requested row over the wire.
    My problem is this: I am not in control of the SQL that is sent to the database. It is autogenerated by a third party tool (TOPLink). Therefore using the rownum solution isn't practical. My steps of operation are:
    1. Get SQL from TOPLink
    2. Pass SQL through a Statement
    3. Get resulting ResultSet
    At this point, I want to say, "Mr. ResultSet, I only want rows 200-250." And I then want Mr. ResultSet to fetch only rows 200 to 250, and no others. I don't want to see rows 1 to 199 coming over the wire.
    Anyone have any ideas? Is this possible at all? Also, if there's a way to do this through the TOPLink mechanisms (ScrollableCursors and ReportQuery objects and whatnot), please do let me know. I have tried using the TOPLink facilities, and sure enough rows 1 to 199 flow across the network.
    Thanks,
    Michael Allen
    [email protected]

  • How to get a subset of text from a varchar2 field

    Hello.  I am trying to select a subset of text from a varchar2 field.  This is login information from dba_audit_trail view.  Here's an example of the field (comment_text from dba_audit_trail):
    Authenticated by: DIRECTORY PASSWORD;EXTERNAL NAME: cn=orcladmin,cn=Users,dc=idacorp,dc=local; Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=555.555.555.555)(PORT=99999))
    I am trying to just select the "orcladmin" text - i.e. everything after the first "=" up to the first ","
    I can get everything after the first "=" with this:
    select substr(comment_text, instr(comment_text, '=') + 1) from dba_audit_trail
    ... but I don't know how to stop at the first ","
    Any help would be greatly appreciated.
    Thanks!
    Message was edited by: DRC

    Hi,
    Here's one way to do it:
    WITH got_pos    AS
        SELECT  comment_text    -- and whatever other columns you need
        ,       INSTR (cooment_text, '=')   AS equal_pos
        ,       INSTR (cooment_text, ',')   AS comma_pos
        FROM    dba_auit_trail
        WHERE   ...             -- any filtering goes here
    SELECT  SUBSTR ( comment_text
                   , equal_pos + 1
                   , comma_pos - (equal_pos + 1)
                   )   AS first_cn
    FROM    got_pos
    You could do it without a sub-query; you'd just have to do the exact same INSTR 2 times, where I used equal_pos 2 times.
    You could also get the results you want using regular expressions, such as:
    SELECT  REGEXP_SUBSTR ( comment_text
                          , '=([^,]*),'
                          , 1
                          , 1
                          , NULL
                          , 1
                          )      AS first_cn
    FROM    dba_audit_trail
    Although this uses less code, it's slower than using INSTR and SUBSTR .

Maybe you are looking for

  • How to remove update

    I keep getting the notice that there is a printer update ready from the app store. I don't want this update. How can I put this update alert on hold without stopping other update alerts that I may want to install?

  • J2IUN Sec cess on Service tax

    Hi, We are updated Latest Service tax Notes regarding Sec CESS. Problem is When we want to post Monthly utilization Sec Cess on Service tax not displaying in Utilization for Sec CESS(Bottom,Purchase Side) 1)ECSTAXCR 2)SERTAXCR is there but SECTAXCR n

  • Debit memo and credit memo rule

    hi may i know why there is debit memo like bank transfer(debit memo), returned debit memo, check debit memo and credit memo like check credit memo through bank in posting rule. what is the meaning of debit memo and credit memo in posting rule of elec

  • Return of scrap from vendor Sub contracting

    Dear gurus Pls advice me on how to map this scenario we are sending two raw materials to subcontractor for a semi finished product. during the process scrap is also generated which is of value to the organization and they need to receive it from the

  • Reciving imges in a midlet sent by sevlet..

    hiii........ i want to images sent by a servlet in a midlet thru this code.. try HttpConnection c = (HttpConnection) Connector.open(url); int i = c.getResponseCode(); if( i == HttpConnection.HTTP_OK ){ int len = (int)c.getLength(); System.out.println