Instr not returning all the occurance

hi i used this to get the space occurance.
SQL> select instr('hi madam bye madam',' ',1) from dual;
INSTR('HIMADAMBYEMADAM','',1)
3
there is a space in 3,9,13 th position but the above query gives 0nly 3.so how to get all the space occurance.

You need to pass an additional parameter to get the Nth occurrence of a value.
  1* select instr('hi madam bye madam',' ',1,1) from dual
SCOTT @ nx102 JCAVE9420> /
INSTR('HIMADAMBYEMADAM','',1,1)
                              3
Elapsed: 00:00:00.00
SCOTT @ nx102 JCAVE9420> ed
Wrote file afiedt.buf
  1* select instr('hi madam bye madam',' ',1,2) from dual
SCOTT @ nx102 JCAVE9420> /
INSTR('HIMADAMBYEMADAM','',1,2)
                              9
Elapsed: 00:00:00.00
SCOTT @ nx102 JCAVE9420> ed
Wrote file afiedt.buf
  1* select instr('hi madam bye madam',' ',1,3) from dual
SCOTT @ nx102 JCAVE9420> /
INSTR('HIMADAMBYEMADAM','',1,3)
                             13
Elapsed: 00:00:00.01
SCOTT @ nx102 JCAVE9420> ed
Wrote file afiedt.buf
  1* select instr('hi madam bye madam',' ',1,4) from dual
SCOTT @ nx102 JCAVE9420> /
INSTR('HIMADAMBYEMADAM','',1,4)
                              0
Elapsed: 00:00:00.01Justin

Similar Messages

  • RowSetIterator not returning all the rows

    Hi,
    We have a use-case where we need to create a new row iterator to insert rows(values) in it. Immediately after insertRow(), we are reading the values by creating a secondary row set iterator (createRowSetIterator) but it is not returning all the inserted rows. Here is the code snippet:
    Code to insert rows:
    public void insertTerrLineOfBusiness(CreateOperation operation, TerritoryVORowImpl newTerritoryRow, TerritoryVORowImpl selectedRow){     
    if((operation.equals(CreateOperation.CREATE))
    || operation.equals(CreateOperation.COPY)
    || operation.equals(CreateOperation.ADD_EXISTING)){
    RowIterator selTerritoryLineOfBusinessIter = selectedRow.getTerritoryLineOfBusiness();
    //RowIterator newTerrLineOfBusinessIter = newTerritoryRow.getTerritoryLineOfBusiness();
    ViewRowSetImpl newTerrLineOfBusinessIter = (ViewRowSetImpl) newTerritoryRow.getTerritoryLineOfBusiness();
    newTerrLineOfBusinessIter.setAssociationConsistent(true);
    while(selTerritoryLineOfBusinessIter.hasNext()){
    TerritoryLineOfBusinessVORowImpl selTerrLineOfBusinessRow =
    (TerritoryLineOfBusinessVORowImpl)selTerritoryLineOfBusinessIter.next();
    TerritoryLineOfBusinessVORowImpl newTerrLineOfBusinessRow =
    (TerritoryLineOfBusinessVORowImpl)newTerrLineOfBusinessIter.createRow();
    newTerrLineOfBusinessRow.setTerritoryVersionId(newTerritoryRow.getTerritoryVersionId());
    newTerrLineOfBusinessRow.setLobCode(selTerrLineOfBusinessRow.getLobCode());
    newTerrLineOfBusinessIter.insertRow(newTerrLineOfBusinessRow);
    Code to read:
    public List getTerritoryLobsValues() {
    List <String> lobsValues = new ArrayList<String>();
    if (this.getTerritory().getCurrentRow() != null) {
    TerritoryVORowImpl territoryVORowImpl =
    (TerritoryVORowImpl)this.getTerritory().getCurrentRow();
    if(territoryVORowImpl.getTerritoryLineOfBusiness() != null){
    ViewRowSetImpl territoryLob =
    (ViewRowSetImpl)territoryVORowImpl.getTerritoryLineOfBusiness();
    RowSetIterator itr = territoryLob.createRowSetIterator(null);
    if(itr!=null){
    while(itr.hasNext()) {
    Row r = itr.next();
    String lobCode = (String)r.getAttribute("LobCode");
    lobsValues.add(lobCode);
    itr.closeRowSetIterator();
    return lobsValues;
    Can anybody suggest what could be the issue? How to fix it?
    Thanks,
    Akhila

    Thanks for your response.
    Jdev version:
    Primary == FUSIONAPPS_PT.V1REL6INT_LINUX.X64_120719.0800 (Primary Product for the view)
    Primary depends on FMWTOOLS == FMWTOOLS_11.1.1.6.0_GENERIC_120112.0037.2
    FMWTOOLS depends on label == JDEVADF_11.1.1.6.0_GENERIC_111205.1733.6192.1
    The above label originated from base label == JDEVADF_11.1.1.6.0_GENERIC_111205.1733.6192
    Use case: We have a tree table, each record may or may not have Line of Business(LOB) associated with it. On creating a child node in the tree table, the child node copies all the attributes of parent. These attributes are not committed explicitly, if user wants to save the child node only then the attributes are committed.
    Giving secondary rowSetIterator a name did not help in resolving this issue.
    If I am calling postChanges() before reading from secondary row iterator then its returning all the inserted values. But this.getTransaction().postChanges() is a JAudit violation, so cannot use it:
    RuleId: apps-jbo-category.File.AdfModel.54
    Rule: insertTerrLineOfBusiness - Review DBTransaction.postChanges call to ensure passivation-safety
    Any pointers on this?

  • Database adapter not returning all the records

    I've taken over a BPEL from a developer who left the organization and have been having an issue during our User Acceptance Testing. We are querying a table that will return the insurance enrollment information for employee's and their dependants. When an employee change plans, or adds people, the old plan is terminated and a new once is created. When this happens there will be two records on the database to show the old plan and the new plan.
    When we run the SQL thru JDEV or SQLDeveloper, the data comes out fine. When we run it through a BPEL Database Adapter we are only getting one of the rows returned.
    I have created a small tester BPEL that is easily modified and deployed to run the same query to try multiple configurations changes within the DBAdapter. What I have found is all the records are returned when the "Return single result set" box on the DBAdapter Wizard is unchecked. When it's checked then it only returns one record for the employees with an old and a new plan.
    Can someone explain what the "Return single result set" option does, and what the impact will be if it's unchecked?

    Hello,
    In same way i am using two parent-child(header-line) tables. they have one to many relationship.
    I want to generate XML which contains multiple line items under a child elements for header elements.
    I have tried it but i am getting only one line under that child item. i am using jdev10.0.3.3.0
    can u help me please.
    -regards
    satyendra

  • Return all the values into cursor

    I want to return collection of varray using sys_refcursor. but it is returning only last record. I am wondering how I can return all the four records into result sys_refcursor.
    The following is not returning all the four records under SP.
    resultData OUT sys_refcursor
    for i in 1..4
    loop
    OPEN result FOR
    Select sdo_util.to_wkbgeometry
    (sdo_geometry(2002, 2958, Null,
    Mdsys.Sdo_Elem_Info_Array(1,2,1),
    arr_result123(i)
    )) as geometry
    FROM dual c;
    end loop;
    Thanks
    Al

    I have removed the for loop but no luck. I am posting my whole procedure.
    Can you please let me know what i am missing!..........urgent please.
    PROCEDURE SP_Lines
    mlatlon IN Varchar2,
    resultData OUT sys_refcursor
    ) As
    plat Varchar2(256);
    plon Varchar2(256);
    lPosition number;
    lcounter number;
    newlat number;
    newlon number;
    -- to draw lines
    geometry1 mdsys.sdo_geometry;
    geometry2 mdsys.sdo_geometry;
    begin
    Begin
    arr_result123 := arr_result(
    mdsys.sdo_ordinate_array(-79.7198833241796,43.7437243394591,-79.7170360355377,43.7503404513126),
    mdsys.sdo_ordinate_array(-79.618833241796,43.5437243394591,-79.7170360355377,43.7503404513126),
    mdsys.sdo_ordinate_array(-79.4198833241796,43.3437243394591,-79.7170360355377,43.7503404513126),
    mdsys.sdo_ordinate_array(-79.1198833241796,43.1437243394591,-79.7170360355377,43.7503404513126),
    mdsys.sdo_ordinate_array(-79.0198833241796,43.0437243394591,-79.7170360355377,43.7503404513126),
    mdsys.sdo_ordinate_array(-79.7198833241796,43.007243394591,-79.7170360355377,43.7503404513126),
    mdsys.sdo_ordinate_array(-79.7198833241796,43.7437243394591,-79.7170360355377,43.7503404513126),
    mdsys.sdo_ordinate_array(-79.7198833241796,43.7437243394591,-79.7170360355377,43.7503404513126) );
    lPosition := Instr(mlatlon, '_');
    plat := Substr(mlatlon, 1, lPosition-1);
    plon := Substr(mlatlon, lPosition+1, length(mlatlon) );
    lcounter :=1;
    --get 4 nearest points
    for rec in (
    Select sdo_cs.transform(c.geometry,4326) as geometry
    FROM Ac c
    where SDO_NN(c.GEOMETRY,
    (sdo_geometry(2001, 4326, sdo_point_type(plon, plat, null), null, null) )
    , 'sdo_batch_size =5')='TRUE'
    AND ROWNUM <= 4
    loop
    newlat := get_ordinate(rec.geometry, 2);
    newlon := get_ordinate(rec.geometry, 1);
    -- ~~ building geometries ~~
    geometry1 := sdo_geometry(2002, 4326, sdo_point_type(newlon, newlat, null), null, null);
    geometry2 := sdo_geometry(2002, 4326, sdo_point_type(plon, plat, null), null, null);
    arr_result123(lcounter) := GET_LINE_ORDINATE(geometry1, geometry2);
    lcounter:=lcounter+1;
    end loop;
    end if;
    lcounter:=1;
    OPEN resultData FOR
    Select sdo_util.to_wkbgeometry
    (sdo_geometry(2002, 2958, Null,
    Mdsys.Sdo_Elem_Info_Array(1,2,1),
    arr_result123(lcounter)
    )) as geometry
    FROM dual c, (select level lcounter from dual connect by level <=2);
    END;
    end SP_Lines;

  • Loop Not Returning All Rows

    I finally need to turn to the forum after trying for a few days to resolve my problem I decide to turn to the Oracle people for help.
    The following code below does two things:
    1. If I have the get_menu_label in side of it's own loop it never returns
    2. If I take the get_menu_label out side of it's own loop it returns but does not return all the data.
    DECLARE
    -- GETTING THE DATABASE NAME
    CURSOR get_db_name
    IS
    SELECT DATABASE
    FROM uaf_mfgp_menus_and_groups_vm
    GROUP BY DATABASE
    ORDER BY DATABASE ASC;
    -- GETTING THE OBJECT_ID FOR EACH DATABASE
    CURSOR get_object_id_db (l_db_name VARCHAR2)
    IS
    SELECT object_id
    FROM UAF_FORM_OBJECTS
    WHERE object_label_2 = l_db_name;
    -- GETTING THE GROUP NAME
    CURSOR get_gp_name
    IS
    SELECT group_name
    FROM uaf_mfgp_menus_and_groups_vm
    GROUP BY group_name
    ORDER BY group_name ASC;
    -- GETTING THE OBJECT_ID FOR GROUP WITH GP NAME AND DATABASE
    CURSOR get_object_id_gp (l_gp_name VARCHAR2, db_id NUMBER)
    IS
    SELECT object_id
    FROM UAF_FORM_OBJECTS
    WHERE object_label_2 = l_gp_name AND parent_object_id = db_id;
    -- GETTING MENU LABEL
    CURSOR get_menu_label (l_db_name VARCHAR2, l_gp_name VARCHAR2)
    IS
    SELECT menu_label
    FROM uaf_mfgp_menus_and_groups_vm
    WHERE DATABASE = l_db_name AND group_name = l_gp_name;
    got_object_id_db NUMBER (20);
    got_object_id_gp NUMBER (20);
    got_db VARCHAR2 (100);
    got_menu_label VARCHAR2 (200);
    BEGIN
    FOR c1 IN get_db_name
    LOOP
    FOR c2 IN get_gp_name
    LOOP
    OPEN get_object_id_db (c1.DATABASE);
    FETCH get_object_id_db
    INTO got_object_id_db;
    OPEN get_object_id_gp (c2.group_name, got_object_id_db);
    FETCH get_object_id_gp
    INTO got_object_id_gp;
              CLOSE get_object_id_db;
    CLOSE get_object_id_gp;
    OPEN get_menu_label (c1.DATABASE, c2.group_name);
    LOOP
    FETCH get_menu_label
    INTO got_menu_label;
    END LOOP;
    CLOSE get_menu_label;
    DBMS_OUTPUT.put_line ( 'GP_OBJECT_ID= '
    || got_object_id_gp
    || ' '
    || 'MENU_LABEL= '
    || got_menu_label
    END LOOP;
    END LOOP;
    END;
    /

    Javier, this the wrong way to use PL/SQL. Oracle SQL can do all this for you using JOINs.
    This code, even if it did work, would be terrible slow - unable to scale with data volumes.
    This code breaks a few fundamental Oracle rules:
    - row-by-row processing using PL/SQL
    - huge number of context swicthes per PL/SQL loop iteration
    - not maximizing SQL and minimizing PL/SQL
    I suggest you trash this code and write a SQL JOIN instead.

  • I'm having all sorts of connection issues on a iPhone i brought in the uk 6 months ago. am i able to use a genius bar abroad as I'm not returning to the uk?

    i brought a iphone 5 back in feb/march and since then its slowley getting worse and worse, my wifi hardly pickes up any signals and when it does they drop out all the time. my girlfriends iphone4 picks up and has no trouble holding onto the wifi, whilst sitting at the same table mine shows no signals. Im not returning to the uk any time soon so i want to know if its possible to visit an apple store for replacement abroad? im only 6 months into my apple care so i wouldnt think this should pose an issue. any help would be fantastic
    many thanks

    they will not repair the device in the us you must send it back to the country of purchase or set up repair through them the uk apple car number is as follows (44) 0844 209 0611*** you should be able to set up a mail repair through them

  • I need to download all of my photos from my iPhone 4S and my iPad 2 to my MacBook Air. I want to make sure all my photos are not lost and that they do not return to the original devices because of the cloud. Can someone please help ?

    I need to download all of my photos from my iPhone 4S and my iPad 2 to my MacBook Air because there is no more storage space available. I want to make sure all my photos are not lost and that they do not return to the original devices because of the cloud. Can someone please help ?

    Connect your devices to the computer with the USB cable (one device at a time) and import the photos via iPhoto or Image Capture.
    If you have not changed any default settings on your computer, iPhoto will automatically launch when you plug in the device. Then follow the import prompts.

  • Hi there, I have much files saved on pages ( ios ipad) , I just open it today and did not find .all the files !!!! Just 4!!! Taken in consider that I did not delete or making any wrong action. How I can return the lost files!!!! Help please

    Hi there, I have much files saved on pages ( ios ipad) , I just open it today and did not find .all the files !!!! Just 4!!! Taken in consider that I did not delete or making any wrong action. How I can return the lost files!!!! Help please
    its very important files!

    tis true
    I know, I always do that but I was in a rush to get somewhere and I was relying on my thousand dollar Mac to do some kind of recovery or something. I know Microsoft always keeps temporary files (I think Mac does too, part of me asking here in this forum was for someone to tell me where I can find those files) and when you go to open Office Works then it gives you the option of opening the last recent documents, saved or not saved.
    I usually copy paste into my emial just in case something goes wrong with the created document but I just didn't have the time to login and do all that My loss, you live and you learn, BUT still if ANYONE got any info on this, PLEASE DO CHIME IN *keeping the hope alive*

  • Messaging Server 4.1: Received mail is not returned to the sender if the receiving local account does not exist.

    I have found that received mail is not returned to the sender if the receiving
    local account does not exist. This problem occurs even if I use Console to
    enable the Return message to sender option under the error handling methods.
    In addition, I have used the configutil
    to confirm that I have set the value
    for Unknown account action to "13," which corresponds to the settings "Return
    message to sender," "Notify the postmaster via email," and "Log the error in
    the log file." Yet, in this situation, an error message is being sent to
    postmaster, but not to the sender, and the error is not being recorded in the
    log file.
    <P>
    Do the following steps:<BR>
    <P>
    <OL>
    <LI>From Console, open the appropriate Messaging Server.
    <LI>Click the Configuration tab.
    <LI>Open the Services folder.
    <LI>Select SMTP.
    <LI>Click the System tab.
    </OL>
    <P>
    Check the "Domain handled by this server exclusively" field to make sure that
    your mail domain is listed. If your mail domain is not listed, then Messaging
    Server will assume that there is another mail server that is handling the
    domain listed and will forward requests to this server.
    <P>
    For more information, please see the document <I>Messaging Server
    Administrator's Guide</I>, Chapter 3, Configuring SMTP Services at <BR>
    http://docs.iplanet.com/docs/manuals/messaging/nms41/ag/smtp.htm#1010371

    On Thu, 12 Dec 2013 16:16:02 +0000, lpphiggp wrote:
    > I'm seeing this XTCOM error occur all over our /var/log/messages for one
    > server, running SLES11sp2 / OES11/sp1;
    >
    > I don't really know what this is even for. We don't use NetStorage or
    > iPrint even, this server only does basic NCP file serving, DHCP, and
    > hosts a GroupWise PO.
    > Is this anything to be concerned about?
    If this:
    http://www.linuxquestions.org/questi...entication-vs-
    edirectory-825043/
    is to be believed, it seems to indicate that your NAM configuration on
    this server is not valid. I'm not seeing this message here on the OES
    servers I looked at, and NAM is working correctly here.
    David Gersic dgersic_@_niu.edu
    Knowledge Partner http://forums.netiq.com
    Please post questions in the forums. No support provided via email.
    If you find this post helpful, please click on the star below.

  • Return all the column values using the F4IF_INT_TABLE_VALUE_REQUEST

    Hi,
    How to return all the column values using the F4IF_INT_TABLE_VALUE_REQUEST?
    For example : if the row has 3 columns then after selecting the particular row, the RETURN_TAB internal table should contain all the three column values.
    Regards,
    Raghu

    Hi,
       Try the following...
    DATA : it_fields like help_value occurs 1 with header line.
    data: begin of w_vbap,
            vbeln      like vbap-vbeln,    
            posnr      like vbap-posnr,   
            werks      like vbap-werks,  
          end of w_vbap.
    data: i_vbap   like w_vbap   occurs 0 with header line,
             w_fields type help_value,
          i_dfies type table of dfies,
          i_return_tab type table of ddshretval with header line,
          i_field  type dfies.
      select vbeln posnr werks
          from vbap into table i_vbap up to 5 rows.
    if sy-subrc = 0.
       sort i_vbap by vbeln.
    endif.
      clear it_fields[] , it_fields.
      it_fields-tabname = c_vbap.
      it_fields-fieldname = 'VBELN'.
      it_fields-selectflag = c_on.
      append it_fields.
      it_fields-tabname = c_vbap.
      it_fields-fieldname = 'POSNR'.
      it_fields-selectflag = space.
      append it_fields.
      it_fields-tabname = c_vbap.
      it_fields-fieldname = 'WERKS'.
      it_fields-selectflag = space.
      append it_fields.
      loop at it_fields into w_fields.
        i_field-tabname   = w_fields-tabname.
        i_field-fieldname = w_fields-fieldname.
        i_field-keyflag   = w_fields-selectflag.
        append i_field to i_dfies.
      endloop.
      call function 'F4IF_INT_TABLE_VALUE_REQUEST'
        exporting
          retfield               = 'VBELN'
         window_title           = 'Select'
        tables
          value_tab              = i_vbap
          field_tab                = i_dfies
          return_tab             = i_return_tab
       exceptions
         parameter_error        = 1
         no_values_found        = 2
         others                 = 3
      read table i_return_tab into w_return_tab index 1.
      if sy-subrc = 0.
      endif.
    Regards,
    Srini.

  • BI publisher report is not showing all the data

    Hi All,
    I have created a report using BI Publisher in R12. The report is not showing all the records.
    I have checked the result XML it is also not having all the data. My query returns 846 rows but my report only has 662 rows.
    what might be the issue.please give me some idea to resolve this issue.
    Thanks in advance.
    Regards,
    P.Kalidoss

    Hi Arun,
    In the following code: public SelectItem[] getAllPrinters() {
    if (allPrinters == null) {           // allPrinters is not defined. what type of object it is
    PrintService[] printers = PrintServiceLookup.lookupPrintServices(null, null);
    allPrinters = new SelectItem[printers.length];
    for (int i = 0; i < printers.length; i++) {
    SelectItem printer =
    new SelectItem(printers.getName(), printers[i].getName());
    allPrinters[i] = printer;
    return allPrinters;;;
    Variable allPrinters is not defined. what type of object it is?
    And also the same variable is referenced here <af:selectOneChoice label="Available Printers" partialTriggers="cb1"
    value="#{pageFlowScope.applicationPrinterBean.selectedPrinter}"
    id="soc1"
    autoSubmit="true">
    <f:selectItems value="#{pageFlowScope.applicationPrinterBean.allPrinters}" id="si1"/>
    </af:selectOneChoice>.
    Thanks.

  • My PC does not return to the source document I print from

    I had a setting control for
    this in XP but can't find the page I got it from.<o:p></o:p>
    <o:p> </o:p>
    In ANY application or browser
    this happens.  I print from a specific Excel workbook, by example, when I
    have a number of them open.  The system does not return to the workbook I
    printed from.  This is maddening and causes all kinds of issues.
     Searching the web for this now produces nothing and I know I can't be the
    only person who experiences this.<o:p></o:p>
    <o:p> </o:p>
    This is a Windows 7 platform
    in a networked business environment.  I'm running the Classic Menu add-in
    from Addintools because I can't stand the ribbon and have never liked it.
     In Windows 7, I'm running a couple of other add-ins that restore the XP
    use of the task bar properly so one can work efficiently.<o:p></o:p>
    <o:p> </o:p>
    None of the add-ins are what
    is causing this issue because I'd run the same Classic Menu add-in on the XP
    box and it had the same issue until I found the work-around that I can't
    remember now.<o:p></o:p>
    <o:p> </o:p>
    Has anyone else experienced
    this issue?<o:p></o:p>
    <o:p> </o:p>
    Jeff Lynch<o:p></o:p>

    Hi,
    "I print from a specific Excel workbook, by example, when I
    have a number of them open.  The system does not return to the workbook I
    printed from."
    If I'm not misunderstanding, do you mean that the workbook is automatically closed after you print from that workbook, right?
    As I know, if we use the default ribbon in Excel, no matter in Windows XP or Windows 7, the opened workbook should be stay opened after you print from that Excel workbook.
    So the question is that: what is the version of office? What is the Classic Menu add-in you're running now? Did you manually download and install it to your system? Could you please share a picture with us about the add-ins you're using?
    Yolanda Zhu
    TechNet Community Support

  • API Not returning all RTMP ingest endpoints

    The web portal shows both URLs for RTMP
    rtmp://etcetc.channel.mediaservices.windows.net:1935/live/...
    rtmp://etcetc.channel.mediaservices.windows.net:1936/live/...
    but the API (ex - myChannel.Input.Endpoints) only returns a single one (...:1935).
    Any reason why the web portal and the API don't return the same info?

    Hi,
    According to your post, my understanding is that Search is not returning all STS_Web.
    You need to set the Trim Duplicates to false, please follow the steps as below:
    Export the Search Results Web Part from your page.
    Open the .webpart file in your favorite editor.
    Search for “Trim Duplicates”, you will find it as part of the DataProviderJSON property.
    Set the Trim Duplicates property to
    False.
    Upload the web part.
    Add the web part to your page.
    More information:
    SharePoint Online Search Results Duplicates “Trap”:
    http://www.hartsteve.com/2013/07/sharepoint-online-search-results-duplicates-trap/
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Parameter not returning all values

    I have a crystal report built off an oracle DB.  For one parameter it is not returning all values.  I can display data or the entire table it shows me all values, but when i build a parameter it only shows me through August.  It is a date/time field.

    check the following thread
    [Dynamic Parameter only showing 1000 records when Crystal report is run.;
    regards,
    Raghavendra.G

  • SQL query  which return all the NET SERVICES which are avaiable in tnsname

    hi all
    how to write a sql query which return all the net services which are avaiable in tnsname.ora
    Regards
    s

    Also, tnsnames.ora is stored on the client, and not necessarily on the server; it's possible (and quite likely) that the name I use for a database in my tnsnames.ora could be different from the name you use for the same database; conversely we might use the same name for two different databases.
    Regards Nigel

Maybe you are looking for