Search only first occurrence of numbers

Hello

Oracle: 11 g

REDHAT Linux 64-bit

I have a query where I m get the first occurrence of numbers after a string "RFC" in my query, but I'm getting wrong output. Here is the example:

Select regexp_replace (substr ("service number: 123456 RFC # 645596 dfghvcv345673', instr (" service number: 123456 RFC # 645596 dfghvcv345673 ',' RFC'"), 20 ''),'[^ [: digit:]]') twice;

The output is:

REGEXP

------

645596

But in the chain when I pass data the query gives bad results:

Select nvl (regexp_replace (substr ("RFC #-MGF107DATA_MIG', instr (" RFC #-SCM107_EMR_Forecast_Data_Migration ',' RFC'), 20),'[^ [: digit:]]'), null) double;

NVL

---

107

107 is not RFC number I want because in this case the user has not entered any RFC

I want only only the first occurrence of numbers RFC and if not then its simply send back some 'X' saying character not seen

strings can type:

1 RFC #-ABC107_GTH_asdasd_data_MIG / / no RFC is mentioned here so it shud return no data found

2 RFC 1474 FA Rpr of mig

3.RFC MKL                                                            // Here also

4.RFC # 42 asdasdsd asdasd

Please suggest a logic!

1. you do not mention the fact that the number after that RFC can be the comma (,) separated. You must include the colon with: figure: in the regular expression

2. When you enter the value a single quotes, you need to be like two apostrophes or use the notation Q.

3. you dint refers to the fact that it may be an exaggeration (-) between the RFC and the number. If you need to register it to the RESULT.

SQL> with t
  2  as
  3  (
  4  select 'Mikulov : Logical AppsRule (FA KOL Asset number) : New : 26-May-08 (D1,S1):RFC 158,171' str
  5    from dual
  6  union all
  7  select q'[Iasjhhm -asdh -ashd:Modification of attribute 6 of 'Repair Orders' dff - RFC 284678]' str
  8    from dual
  9  union all
 10  select 'adasd-2 : RFC-166 : 12-June-2008(D1)' str
 11    from dual
 12  )
 13  select str
 14       , nvl(replace(regexp_substr(translate(str,'.#- ', '.'),'RFC[[:digit:]|,]+'), 'RFC'), 'no data found') str_output
 15    from t;

STR                                                STR_OUTPUT
-------------------------------------------------- ----------
Mikulov : Logical AppsRule (FA KOL Asset number) : 158,171
 New : 26-May-08 (D1,S1):RFC 158,171
Iasjhhm -asdh -ashd:Modification of attribute 6 of 284678
 'Repair Orders' dff - RFC 284678
adasd-2 : RFC-166 : 12-June-2008(D1)               166

SQL>

Filtering is never finished. You must keep on adding logic when you get the new model series. What I provided I have just a basic starter. You must improvise on it.

Tags: Database

Similar Questions

  • Replace only first occurrence in the string

    Hello

    Have we not function in sql where in only the first occurrence in the string is replaced by the desired string.

    Example:

    original string: "Oracle is the best. Oracle is awesome"

    Now, I need to change only the first occurrence of the oracle

    changing string: "replaced is the best." Oracle is awesome"

    do we not have any function to do?
    regexp_replace (str, '(Oracle)', 'Replace', 1, 1)
    

    as in

    SQL>  with test as
      2   (select 'Oracle is the best. Oracle is great' str from dual)
      3   select regexp_replace (str, '(Oracle)', 'Replace', 1, 1) str
      4    from test
      5  /
    
    STR
    ------------------------------------
    Replace is the best. Oracle is great
    
  • Problem with player search - only the First Instance is highlighted

    I use WIN 8.1 with Adobe Acrobat Reader DC [15.10.200056.167417 'updated 12/18/15"indicated in the program properties] as my default PDF reader.

    Until recently, I was able to do a search of words/texts of .pdfs using CTRL-F, who showed me every instance highlight of this word.  I would simply hit 'find' several times.  These days, only the first occurrence of the word is highlighted.  Along the right margin are yellow "tics" that, in my opinion, indicate the existence of other occurrences.

    If something has changed in the drive?  Some can tell me how to regain the ability that I hope

    mikec2222 wrote:

    Bernd - Do I understand you though, when you search for "" this document, you can find a second occurrence of "the" highlighted by pressing 'find' or 'next' or 'enter' again?  If this is true, my copy of AA CD player must be faulty.  I can't wait to see your response.

    It's true.

  • Script works only on the first occurrence of a masterpage

    I adopted a dynamic shape on LiveCycle to maintain and update. I have no programming experience, but are working with LiveCycle for over three months to know that I'm going every day.

    I have a problem of script that I don't know how to handle. I use javascript. I currently have a script that will look at the < State > tag to an xdp. If the value < status > is a certain State, then a text in the subform 'footer' of a master page will be hidden while another text with a larger font becomes visible.

    if (xfa.datasets.data.job.data.state.value, == , "NJ") { }

    jobs. MasterPages.Liability_Continued.footer.liabilityFooterBig.presence = 'visible ';

    jobs. MasterPages.Liability_Continued.footer.liabilityFooter.presence = "invisible";

    }

    My problem is that the script only works on the first instance of the master page. On all other occurrences, it always displays the text smaller.

    I tried the script on initialization, enter, exit, calculate, validate, validation status, presave, postsave, preprint, post-press, presubmit, postsubmit, docready, docclose, form ready, ready, available and index change the subform "footer" events, but these events have not worked at all, or only worked on the first occurrence of the subform.

    How can I get the visibility of these text objects to change all occurrences of the subform?

    Hello

    There are two possible options. We need to loop through all instances of the Master Page and change the presence of objects on each instance. The other would be to have the script in the event layout: ready for each of the objects referring to this.presence = "invisible";

    Thus, for example, if your Master Page named Page1, then this should work:

    var oMaster = xfa.resolveNodes("Page1"); 
    
    for (var i=0; i
    

    The exact reference in the script would be according to your hierarchy.

    Niall

  • Topics by opening the first occurrence in the table of contents

    Background: I created HTML5 Responsive help using HR 2015 for a web application. I organized the Hep role, then pages with these roles, users can access, and then by the tasks users can perform on this page. In many cases, a subject is listed under multiple roles and reuse and efficiency, I just dragged the same theme in the list of the topic in the table of contents as appropriate.

    I also used the text conditionalized on table of contents by role level. Using the example below, I have conditions for physician, nurse, and Patient, but I don't think that this is part of the issue well. Conditionalized roles were created for filtering purposes.

    Question: I have the overview topics that include hyperlinks to headings in red in the example below for each role. When a user clicks the hyperlink in this topic of presentation, he brings them to the FIRST occurrence of this topic in the table of contents, not the link that is associated with their role. When a user with the role of the Patient is in the topic view of their role and click the hyperlink 'Research for patients', help opens on this subject, but the "Searching for patients" in the topic role of physician in the table of contents on the left is highlighted.  Not a show-stopper, but it is confusing for users.

    Also, we had originally planned to use the filter feature to filter role help topics. When I filter to view only a specific role (nurse) and do the steps above, by clicking on the Preview 'Search for patients' hyperlink opens but there is no highlighting in the table of contents because this first occurrence is hidden in all the subjects physician.

    Note: This problem does not occur when I generate the content as WebHelp.

    What I want to do: When the nurse click on the hyperlink for 'Research for patients' of their overview topic, researching topic of patients is open and the search for patients is highlighted in the table of contents under the nurse, not the first occurrence (doctor).

    Questions: Is this a bug or is it repairable? And is it possible to fix it without creating the specific role of topics such as finding doctors for Patients, nursing research for Patients and so forth? I tried to delete the table of contents and start again, but the problem persists.

    Here is an example:

    Doctor

    Patient portal page

    Overview (contains links to sections below - view patient demograhic data, looking for patients, to renew orders)

    Display of the demographics of the patients

    Looking for patients

    Renewal of prescriptions

    Nurse

    Patient portal page

    Overview (contains links to sections below)

    Display of the demographics of the patients

    Looking for patients

    Display of orders

    Patient

    Patient portal page

    Overview (contains links to sections below)

    Update your demographic data

    Display of your prescrpitions

    My opinion would be that this is the expected behavior. My theory is that there is no information within the syntax of hyperlinks. A hypertext link is encoded such that when you click on it, you are taken to the landing page, as if sending the message "find the page named and post it by the specified parameters. What is happening is that the hyperlink goes to the first instance of the HTML page in your table of contents (.hhc file). There is no intelligence, he doesn't "know" that you are in the doctor or the nurse section - section he knows only that the page specified in the table of contents is listed in the file and thus, it only takes you there. The syntax of hyperlinks don't "know" where you are in the help system.

    I just also wanted to report the fault of strike in the Patient section, look a your orders of your example, assuming that you have copied and pasted into this thread.

  • First Occurrence

    Hello

    I have 2 tables in my PB and I need to compare a string to find the first occurrence of multiple possibilities.

    For example:

    Main table:

    (1) Peter like walk, run and jump.

    Jogging 2) is Mike's favorite but also likes to jump.

    (3) jumping, market and jogging are great fun.

    Search table

    Walk

    Jump

    Jogging

    Swim

    Currently, using an inner join with a similar statement. Plug 1 returns 3 times, recorded 2 twice and recording 3 three times.

    I want only to return with the first word that it finds. So record we again walk, save 2 jog and save 3 jump.

    Not sure it can still be done in a query may be a procedure or function is necessary.  Thanks for any help.

    Perhaps as suggested by Frank already

    with

    the_data as

    (select 1 the_row, q'~ Peter likes to walk, run and jump. ~' the_text from all the double union)

    q 2, select ' ~ Jogging is favorite Mike but also likes to jump. ~' of all the double union

    q 3, select ' ~ Showjumping, market and jogging are a lot of fun. ~' double

    ),

    the_search as

    (select the_key, 'Walk' in the union double all the)

    Select "Jump out" of all the double union

    Select 'Jog' Union double all the

    Select 'Swim' double

    )

    Select d.the_row,

    d.the_text,

    min (s.the_key) keep (dense_rank first-rate by instr (lower (d.the_text), lower (s.the_key))) the_key

    the_data d,

    s the_search

    where instr (lower (d.the_text), lower (s.the_key)) > 0

    D.the_row group, d.the_text

    order of the_row

    Concerning

    Etbin

  • How can I add a style "BOLD" grep on the first occurrence of a Word?

    Hi all

    I need help on adding a style "BOLD" grep on the first occurrence of a Word.

    I can add the "BOLD" to the word, but it adds to all occurrences, see below:

    GREP style (Incorrect)

    Apply Style: "BOLD"

    Text: \ < Lorem Ipsum\ >

    Nam Lorem Ipsum semper pellentesque tincidunt. UT nisi sit amet arcu nulla tristique dictum. SED commodo total non mauris cursus pretium. Lorem Ipsum Aliquam erat volutpat. Morbi id pretium justo. Nam lorem quis facilisis molestie risus fermentum. Vestibule ut sem elit. Nunc eget neque Sed elementum augue EU outbound.

    I need only the "BOLD" to add to the first occurrence of the word, as below:

    Nam Lorem Ipsum semper pellentesque tincidunt. UT nisi sit amet arcu nulla tristique dictum. SED commodo total non mauris cursus pretium. Lorem Ipsum Aliquam erat volutpat. Morbi id pretium justo. Nam lorem quis facilisis molestie risus fermentum. Vestibule ut sem elit. Nunc eget neque Sed elementum augue EU outbound.


    Thanks in advance for the help!

    This should do it for you

    Apply style

    "BOLD"

    text (? i) ^(.+?) Lorem Ipsum

    apply the stye

    Book

    text: ^. * ? (? = Lorem Ipsum)

    The first expression search all the text from the beginning of the parapgrah through the Lorem Ipsum

    The other defines the rest of the text before the Lorem Ipsum to the base style (book, novel, or whatever your basic style)

  • You want to search ONLY the names of files in the Explorer of Windows 7?

    I want to usually just looking for a word "in a file name& record' - and can often give a date of the range. In the Explorer of Windows 7, as soon as I type the word, I get all the files that contain the word in the content, as well.  How can I have search only the file or folder name?

    I also don't use 'my documents' or 'libraries '... I create my own subfolders - and usually on a stick... disc so I don't really understand "crawler" or if it is relevant to how I organize my files.

    I miss the Windows XP search feature in the Explorer of Windows 7!

    No need for anything that it is complicated.  Simply type what you are looking for.  If it's in the name of the file, these results will be returned first, above all results corresponding to your searchinside of the file term.  Easy.

    Without indexing places such as stick readers can always be sought, but take a little more time looking for (like XP).

    If it solves your problem, click on the link "Propose as answer" below and vote as useful by clicking on the green triangle for the lelft. Thank you!

  • Search only partial textField rawValue

    My form has a textField that users enter numbers separated by commas. I want to write an if statement, trying to find out if one of the part numbers is included in the list. Is it possible for the script to search only a portion of a textField rawValue or formattedValue?

    So if the rawValue of textField1 is 1234, 4569, 3582

    I want to be able to enter 4569 textField2 (a different textField), then click on a button that runs a script to see if 4569 is included in the list of reference numbers.

    Is this possible?

    Also: is it possible to send part numbers separated by commas in a list box?

    I appreciate any assistance.

    Here you go:

    var aWords = TextField1.rawValue.split(","),
      cTest = this.rawValue,
      isIncluded = function (value) {
        return value.replace(/\s/g, "") == this.testValue.replace(/\s/g, "");
      },
      toTest = {
        testValue : cTest
      },
      iCount = 0;
    
    // Check all words against the entered value
    if (aWords.some(isIncluded, toTest) === true) {
      iCount += 1;
    }
    
    // Show a message, if the word was found
    if (iCount > 0) {
      xfa.host.messageBox("The word '" + cTest + "' is already included in the list.", "Match found.", 0, 0)
    }
    
  • First occurrence but not in the same table

    As we know, to search for the first occurrence of a particular record, we go with the MIN function. It is however, if all of your records are in the same table.

    My scenario is a little different. I have 4 tables (maybe more), but keeping this is simple for the exercise. I need to find the first occurrence of a student who appear in a table and this registration Date. The trick is to NOT include this student in the following tables. To do this, I can use SQL or PL/SQL.

    Thanks in advance.

    Scripts for Tables (CREATE TABLE and INSERT scripts)

    create table time_period(id varchar2(1), start_date date, end_date date);
    insert into time_period values('0', to_date('01-DEC-2005', 'DD-MON-YYYY'), to_date('31-MAY-2006','DD-MON-YYYY'));
    insert into time_period values('1', to_date('01-JUN-2006', 'DD-MON-YYYY'), to_date('30-NOV-2006','DD-MON-YYYY'));
    insert into time_period values('2', to_date('01-DEC-2006', 'DD-MON-YYYY'), to_date('31-MAY-2007','DD-MON-YYYY'));
    insert into time_period values('3', to_date('01-JUN-2007', 'DD-MON-YYYY'), to_date('30-NOV-2007','DD-MON-YYYY'));
    insert into time_period values('4', to_date('01-DEC-2007', 'DD-MON-YYYY'), to_date('31-MAY-2008','DD-MON-YYYY'));
    
    create table student_test1(student_id varchar2(4), exam_date date);
    create table student_test2(student_id varchar2(4), exam_date date);
    create table student_test3(student_id varchar2(4), exam_date date);
    create table student_test4(student_id varchar2(4), exam_date date);
    
    insert into student_test1 values('1001',to_date('01-DEC-2005','DD-MON-YYYY');
    insert into student_test1 values('1002',to_date('01-DEC-2005','DD-MON-YYYY');
    insert into student_test2 values('1003',to_date('01-JUN-2006','DD-MON-YYYY');
    insert into student_test3 values('1001',to_date('01-NOV-2007','DD-MON-YYYY');
    insert into student_test3 values('1004',to_date('01-NOV-2007','DD-MON-YYYY');
    insert into student_test4 values('1001',to_date('01-MAY-2008','DD-MON-YYYY');
    insert into student_test4 values('1002',to_date('01-MAY-2008','DD-MON-YYYY');
    insert into student_test4 values('1003',to_date('01-MAY-2008','DD-MON-YYYY');
    insert into student_test4 values('1004',to_date('01-MAY-2008','DD-MON-YYYY');
    

    Desired output should be as follows:

    ID Start Date End Date County

    0 1 December 05 31 May 06 2 - student ID 1001 and 1002

    1 1 June 06 30 November 06 1 - Student ID 1003

    2 1 December 06 31 May 07 0 - no

    3 1st June 07 1st November 07 1 - Student ID 1004 (1001 should not be taken to the top)

    4 1st December 07 to 31 May 08 0 - no. They have all been included in the previous periods

    could be done with a UNION ALL operation student_test-tables (and a join with the time table):

    with

    BaseData as)

    Select * from student_test1

    Union of all the

    Select * from student_test2

    Union of all the

    Select * from student_test3

    Union of all the

    Select * from student_test4

    )

    ,

    min_values like)

    Select student_id, min (exam_date) exam_date

    of basedata

    Student_id group

    )

    Select tp.id

    tp.start_date

    tp.end_date

    count (mv.student_id) student_id

    of time_period tp

    left outer join

    min_values mv

    on (mv.exam_date between tp.start_date and tp.end_date)

    Tp.id group

    tp.start_date

    tp.end_date

    order of tp.id

    ;

    I HAVE START_DA STUDENT_ID END_DATE

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

    01.12.05 0 31.05.06 2

    1 01.06.06 30.11.06 1

    2 01.12.06 31.05.07 0

    3 01.06.07 30.11.07 1

    4 01.12.07 31.05.08 0

    Concerning

    Martin

  • Find the first occurrence of a Word

    I have a script which detects and counts all occurrences of a Word.

    I need the script to find the FIRST occurrence of a Word only.

    Can any advise please how do I change the script to find the first occurrence of the word?

    Script as follows:

    {

    numWords = this.getPageNumWords var (0);

    for (var i = 0; i < numWords; i ++)

    {

    var ckWord = this.getPageNthWord(0,i);

    If (ckWord is 'MATERIAL')

    {

    / * Script going here based on the finds the first occurrence of the word 'MATTER ' * /.

    }

    }

    }

    I tried var CKWord = this.getPageNthWord (0,0); but reports from the rear console is UNDEFINED?

    numWords = this.getPageNumWords var (0);

    var number = 0;

    for (var i = 0; i)
    var ckWord = this.getPageNthWord(0,i);
    If (ckWord == "ISSUED") {}
    Count ++;
    If (count == 2) {}
    var = this.mouseX Coord.

    var annot = this.addAnnot({)
    page: 0.
    type: "Stamp."
    name: "AppStamp."
    Rect: [coord + 1000, 2300, 30, 2820]
    rotation: 90,.
    ({AP: '#C94cHAFFa42U1gTH5Tug5C'});
               
    break;
    / * this.flattenPages (); */
    }
    }
    }

  • TMS Type of update directory: search only

    Currently, we have two telephone directories that "import us in TMS' of their source of the telephone directory, but you want to change the settings for"Search only"due to the length of this particular directory.  I know that rather than display all entries in the phone book in a huge list like it does when it is set to import, to search to pull up to the entrance they want.  In what way, if any will to change this setting has no effect on demand conferences that use this particular directory if it is set to import or search?

    Thank you!

    If the directory is set to "Search only", you will not be able to use these contacts in regular conterences.

    -Zac

    * UPDATE *.

    You will be able to add the contact to the conferences, but TMS will display 'Entry deleted directory' for contact when go back watch the Conference. TMS also displays a warning if you view the connection tab for the routing of the call of the Conference details. I confirmed this today, and I filled a defect with regard to this. CSCui45154 The default is new, so it will not be publicly visible.

  • Regex to allow only integer and decimal numbers.

    Hi all

    I need a regex to allow only integers and decimal numbers.

    Examples:

    100 licences

    100.00 - Unauthorized

    100 - unauthorized

    100.11.22 - unauthorized

    all characters other than numbers - unauthorized

    I used the regular expression - ^ [0-9] +. ? [0-9] * $- but its allowing the "100" also.

    Can someone help me solve this problem.

    Your timely assistance is greatly appreciated.

    Thanks in advance.

    Hello

    inDiscover wrote:

    Hi all

    I need a regex to allow only integers and decimal numbers.

    Examples:

    100 licences

    100.00 - Unauthorized

    100 - unauthorized

    100.11.22 - unauthorized

    all characters other than numbers - unauthorized

    I used the regular expression - ^ [0-9] +. ? [0-9] * $- but its allowing the "100" also.

    Can someone help me solve this problem.

    Your timely assistance is greatly appreciated.

    Thanks in advance.

    Use

    ^[0-9]+(\.[ 0-9] +) ? $

    to make the decimal point and the following figures (of which there must be at least 1), as a unit, as an option.

  • Grep search only on the current page, return array "search everything".

    Hello

    Is there a way to grep search only the current page, or any page chosen in my paper (myDocument.pages [i])?

    I can only manage to search for in the document.

    app.findGrepPreferences = app.changeGrepPreferences = null;

    app.findGrepPreferences.findWhat = "Chapter (\d+)";

    myDocument.findGrep)

    Also, is there a way to return the content to find? In this case, I want the $1 this research...

    var a = myDocument.findGrep (). ?

    Thank you

    Christopher

    the error is because you have not initialized the tabular myRet variable.

    Another problem is the use of textframes.everyItem (), because that returns a different object.

    and another is what happens if a textframe is empty you will get an error on the meaning of "object has no text for find/replace.

    Here is the fixed code:

    var myRet=[]
    var myDocument=app.activeDocument;
    var tf = myDocument.pages[0].textFrames.everyItem().getElements(),
    tf1 = myDocument.pages[0].textFrames.count();
    app.findGrepPreferences = app.changeGrepPreferences = null;
    app.findGrepPreferences.findWhat = "Chapter";
    for (var i = 0; i < tf1; i++){
     if (tf[i].characters.length){
    myRet=myRet.concat(tf[i].findGrep());
    }
    }
    alert(myRet)
    
  • No puedo open only first creative cloud, no the opcion open viene desde.

    No puedo open only first creative cloud, no the opcion open viene desde.

    You MUST have a 64-bit computer what is your computer?

    MINIMUM for After Effects and Premiere Pro http://helpx.adobe.com/premiere-pro/system-requirements.html

Maybe you are looking for

  • PROTECTED Z930-108 - error of fingerprints after restore complete

    I had to use recovery SSD (full restore) option. When I started the Setup program the labtop, fingerprints can be registered, as there is a message coming:Operation failed. The same footprint already exists.However, in the list of fingerprints, there

  • HPE H8-1110 SUPPORT RAID?

    Currently I have a H8-1110 and would like to know if it supports Raid1. Before going to another HARD drive, I started to search. In the configuration menu, I get the SATA ACHI or IDE EMULATION... no Raid. Does this mean that I'm out of luck?

  • Call from the Complutense University of MADRID with Ajax service gives 404_Error

    Hi allI called a service of the University Complutense of MADRID (which runs a query in the background) in the context of application SSXA using AJAX call.(http://address:16290 / application-context-root/wcm/idc/cs/idcplg? IdcService = ServiceName &

  • Report of the apex - line break

    HelloI have a table with the information from the log.In the region of report I did a simple sql query asSelect logdata.l_id, logdata.textof logdatawhere logdata.l_id =: P1_ID;Now, I have all the information for my client, but for now the apex report

  • miniature description

    Hello, I would like to know if it is possible to briefly describe the thumbnails in a diashow js widget. The thumbnails have the status when hover etc., the summary should have this.Is there a solution?