Finding exact matches using WITHIN clause or?

We are storing documents in XML format in a CLOB. We need to find exact matches within an element through intermedia. Is there a way we can use the WITHIN clause or a different type of clause to get only exact matches for a phrase?
e.g., a search on 'accord' would not bring back 'peace accord' etc.

Hi,
I recommend asking your question in an Excel forum:
http://social.technet.microsoft.com/Forums/en-us/home?forum=excel&filter=alltypes&sort=lastpostdesc
There's an Excel forum over on the MSDN side as well, but it focuses more on VBA:
http://social.msdn.microsoft.com/Forums/en-us/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
This is a PowerShell forum.
Don't retire TechNet! -
(Don't give up yet - 12,950+ strong and growing)

Similar Messages

  • Java Regex - Find Last Match Using Pattern and Matcher

    I'd like to write some regex which would allow me to grab the last occurance of match based on a specified list of items. So for:
    Pattern languageRegex = Pattern.compile("(len|end)");
    And a string of:
    "00| 0lend|"
    I want it to extract "end". However, I'd grab "len" using the above regex.
    If it was
    "00| 0lenend|"
    I'd grab "end" which is right.
    What regex would allow me to grab "end" rather than "len" from:
    "00| 0lend|"
    Thanks for your help.

    user3940995 wrote:
    I have a list of 3 letter codes that I need to check for in a field. The list is finite but about 100 or so items:
    len, end, ren, onm, enl, etc.
    However, the field I'm checking in has some other data in it which can bleed into the code but the code will always be at the end.
    An example would be "000 0rend"
    From this I'd want to extract "end". If there is a better way to do this than using regex then I'd be happy to use that, but as I have to process millions of items I'm keen to not loop trying to find a match so I was hoping there would be a regex solution.
    Your regex would work for that particular example. I think if I modify it to be
    Pattern.compile("len(?!\\D)|end(?!\\D)|enl(?!\\D)"); (which would then be extended for all the list items)
    Then I seem to pick up the last occurance as I'd like to.
    Thank you for your help!Doesn't sound like you want to use regexp. I would instead build a character graph/tree with my commands in reversed order. I would then search each line backwards and check if it matches something in my tree.

  • Find exact string using formula (excel)

    I'm trying to use FIND statement to find multiple strings in the context of a larger formula. The original formula I'm basing it off of is as follows:
    =IF(ISNUMBER(FIND("INC",A1))," ","Y")
    Obviously, this yields a Y if it finds whatever text in " ". However, I have many strings for which I'd like to check and they need to be exact; ie when I search INC and inc, I do not want Inc to be counted. So, I tried the following formulas.
    =IF(ISNUMBER(FIND(OR("INC",inc"),A1))," ","Y")
    =IF(SUM(COUNTIF(A1,"* INC*","* inc*}))," ","Y")
    The second one works best, but it also counts "Inc" as a match. Any suggestions?

    bk284,
    Well you've posted to the wrong forum as this forum is dedicated to questions/issues about customizing and programming Microsoft Project, a planning and scheduling application. However, your question is simple enough that I'll just take a shot at helping.
    Try the LOWER function, it converts a text string to lower case so the upper case, lower case issue goes away.
    If this answered your question, please mark it as the answer.
    In the future, for Excel related questions, use this forum: http://social.msdn.microsoft.com/Forums/office/en-US/home?category=officedev
    John

  • REGEX: question about finding Overlapping matches using regular expressions

    I have the following problem.
    Say for my pattern I use:
    Pattern pattern = Pattern.compile("AAA");
    Matcher matcher = pattern.matcher("AAAAAA");when I run a loop
    while (matcher.find())
    System.out.println("Match Found: "+matcher.start()+" "+matcher.end());I get 2 Hits shown in the following output:
    Match Found: 0 3
    Match Found: 3 6
    therefore the regex is seeing the first AAA then the second AAA.
    I want it to find the other AAA's in there that are overlapping the other two finds i.e. I want the output to find
    AAA from 0 to 3
    AAA from 1 to 4
    AAA from 2 to 5 and finally
    AAA from 3 to 6
    thereby including the overlapping finds.
    How can I do this using regex? what am I missing that prevents the overlapping matches to be found? Do I need a quantifier?
    Thanks for the help!

    While the solutions above work fine with the given input, they don't really find all overlapping matches. They just find the longest possible match at each start position. Here's a more thorough approach:import java.util.*;
    import java.util.regex.*;
    public class Test
      public static List<String> matchAllWays(String rgx, String str)
        Pattern p = Pattern.compile(rgx);
        Matcher m = p.matcher(str);
        List<String> result = new ArrayList<String>();
        int len = str.length();
        int start = 0;
        int end = len;
        while (start < len && m.region(start, len).find())
          start = m.start();
          do
            result.add(m.group());
            end = m.end() - 1;
          } while (end > start && m.region(start, end).find());
          start++;
        return result;
      public static void main(String[] args)
        List<String> matches = matchAllWays("a.*a", "abracadabra");
        System.out.println(matches);
    }This approach requires JDK 1.5 or later; that's when the regions API was added to Matcher.

  • Searching exact match.

    Hello all,
    How to perform exact match using CONTAINS?
    For Eg. to fetch all rows having some exact text like "2003 and 2006" how to do with Contains? I know we can do this with Like operator (Like '%2003 and 2006%') but how to do it with Contains operator?
    I tried
    1. Contains(field, '{2003 and 2006}',1)>0
    2. Contains(field, '"2003 and 2006"',1)>0
    3. Contains(field, '%2003 and 2006%',1)>0
    Nothing worked. BTW i am using 10g.
    Thanks

    If you do not specify a stoplist, then Oracle uses the default stoplist. You can specify empty_stoplist when creating your index or provide your own stoplist. You can find the stopwords by selecting from ctx_stopwords. The stopwords are also listed in the online documentaiton. The example below uses an empty stoplist.
    SCOTT@orcl_11g> CREATE TABLE your_table
      2    (field VARCHAR2 (60))
      3  /
    Table created.
    SCOTT@orcl_11g> begin
      2    insert INTO your_table VALUES ('again the');
      3    insert INTO your_table VALUES ('again and the');
      4    insert INTO your_table VALUES ('again');
      5    insert INTO your_table VALUES ('again something here the');
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11g> CREATE INDEX your_index ON your_table (field)
      2  INDEXTYPE IS CTXSYS.CONTEXT
      3  parameters
      4    ('sync        (on commit)
      5        stoplist  ctxsys.empty_stoplist')
      6  /
    Index created.
    SCOTT@orcl_11g> SELECT * FROM your_table
      2  WHERE CONTAINS (field, '{again and the}', 1) > 0
      3  /
    FIELD
    again and the
    SCOTT@orcl_11g>

  • I am wanting to exactly match two ID numbers from two differing worksheets within one work book. Once matched I am wanting to retrieve a row value from the second worksheet into the first. Any help much appreciated.

    I am wanting to exactly match two ID numbers from two worksheets within the one work book. ID numbers are non linear. Once exactly matched I wish to retrieve a corresponding row value from worksheet two and have it appear in worksheet one against the correct ID number. I have been looking at IF, VLOOKUP, and MATCH functions and suspect that what I want to do requires a combination of two or more. Any help will be greatly appreciated.
    regards Vaughanh

    Vaughan,
    Data A:D is all cells start at column A thru column D.
    There is built-in help using the menu item "View > Show Function Browser"  in the search field (top right) you can enter vlookup and you will see the detailed description.
    From this we see:
    VLOOKUP
    (search-for, columns-range, return-column, close-match)
    search-for:  The value to find. search-value can contain any value type.
    columns-range:  A range of cells. range is a reference to a single range of cells, which may contain values of any type.
    return-column:  A number that specifies the relative column number of the cell from which to return the value. return-column is a number value. The leftmost column in the range is column 1.
    close-match:  An optional value that determines whether an exact match is required.
    close match (TRUE, 1, or omitted):  If there’s no exact match, select the column with the largest top-row value that is less than the search value. Wildcards can’t be used in search-for.
    exact match (FALSE or 0):  If there’s no exact match, return an error. Wildcards can be used in search-for.
    So... the 2,0 means return the value form the same row as the lookup value but from the 2nd column of the range.  3, 0 means from the 3rd column.  the ", 0" means exact match

  • I want to purchase Adobe Lightroom from the App Store but cant find the exact match.  Please help! Thanks

    I want to download Lightroom from the App Store but I can't find the exact match (I think its $149 Aus dollars).  There seems to be many other items related to Lightroom but not the one I need.
    This is the first time I'm purchasing online so I am wondering if I need to enter my credit card details to see the full range of software available?
    Your assistance would be appreciated.
    Thank you.

    No, you can view items to purchase even if you have nothing on your account at all.
    You may wish to check with the developer forums for clarificaion on finding exactly what you want.

  • How to find smartform that is used within a transaction

    Hi experts,
    Im trying to find the smartform that are used behind transaction FNVS/me22n/zab1/zapb
    From me22n i know it uses zmedruck and i could find this by doing the following:
    transaction nace - ef - neu. there i could find everything, even the printprogram.
    this i found because someone told me you can find everything from orders there within EF.
    but the other transactions i don't know how to start looking for the smartform, as i cant debug those printpreviews neither.
    If someone can explain me how i can find the smartform used behind those printscreens that would help me a lot.
    regards,
    michael

    hi,
    i've put a external breakpoint and a normal breakpoint within the function module,
    but when i press the print preview it doesnt trigger :/
    [image breakpoint|http://img256.imageshack.us/img256/2888/capturede.png]
    even within me22n.
    Am i doing something wrong?
    thx already for the fast reaction.
    regards,
    Michael

  • No exact match was found. Click the item(s) that did not resolve for more options. You can also use Select button to choose External Data.

    HI,
    I have SharePoint Online 2013 environment, i have created a external content type from wcf service. I want to use this as External Data column in document library. When i look for values in content type it populates and when i click any values and adds and
    then click saves it shows the below error
    No exact match was found. Click the item(s) that
    did not resolve for more options. You can also use Select button to choose External Data
    __fkc000950056003700kc000950056003700kc000e400f2001400kc000950056003700k830035004700160027004700d20057000700020064009600870056004600:
    No Matching Items
    Please help on this.
    varinder

    I don't understand the question exactly, could you restate it.  Sorry mate, I might just be braindead.
    But, as far as the issue, it is by design.  the column is a lookup columns which essentially ties to the external data.  if that data is removed, the column on your simple list becomes invalid and any edits of the simple list item will require
    it to be changed.
    are you wanting to make the ECT read only?  that's simple enough.  you can pop open SPD and edit the ECT, then remove the C/E/D operations (create/update/delete).  That will not, however make it read-only in any other systems that access that
    external data, as I assume its not just SP or else it wouldn't be external
    Christopher Webb | MCM: SharePoint 2010 | MCSM: SharePoint Charter | MCT | http://christophermichaelwebb.com

  • Regular expression in exact match

    Hi,
    Please let me know how do i find an exact match within a string using Regular expression,
    var str1:String = "s1 + s2 + sf_s1 + s1 - s2";
    var replceableStr:String = "s1";
    var reggular:RegExp = /\s+(s1)\s+/gi;
    var str2:String;
    str2 = str1.replace(reggular,"format");
    i want only s1 to be replaced with format but sf_s1 should not be replaced, please let me know which Reg exp to use
    Expected output: format + s2 +sf_s1 + format -s2

    Odd, though. I thought regex wouldn't pick upthe
    \n unless you explicitly told it to with DOTALL or
    MULTILINE or (?s) or (?n).
    I thought "String.matches" matched the wholestring.
    So, since the string had a newline, it didn'tmatch.
    It does.Ah, that would explain it then.

  • How can I return all line in a file that matches using regexp

    Hi!
    I want to return whole line from a file. This lines must to contains matches for a pattern.
    How Can I do this.
    I make some samples, but only return the matches segment of the line.
    Sample code to look for 00:00
    If I put .*00:00.* in the pattern this return whole line, but is to slow in this file about 300,000 lines.
    If I put just 00:00 in the pattern only return the 00:00, but so fast.
    What can I Do, or I must use indexOf in a sequential read?
              try {
                   // Create matcher on file
                   Pattern pattern = Pattern.compile(".*00:00.*");
                   Matcher matcher = pattern.matcher(fromFile("logusers_0712"));
                   // Find all matches
                   while (matcher.find()) {
                        // Get the matching string
                        String match = matcher.group();
                                     //Here I display the matches
                        System.out.println(match);
              } catch (IOException e) {
                   e.printStackTrace();
              }Thanks in advance

    My two cents:
    Grep is a Bad Idea (TM). It is not java and itties
    es the solution to a the operational system.Not necessarily bad. Like you say--we don't know much
    about the OP's requirements, so grep may be just
    fine.
    !java != badYour assertion is true. But creating an solution tied to the system when you can do it pure java does not seem like a good Idea especially when we not even know which system he is using. What if he is using Windows or MacOS? Sure he can use grep on non *nix systems, but that would fore him to install the necessary tools, making his solution even more complex.
    >
    About using indexOf, it is a little limited, not
    ot knowing what exactly the OP is searching for itis
    difficult to say if it is enough. RegEx would workin
    both ways.He said he was searching for "00:00". I think that was just a sample. He apears to be scanning a log file as far as I understood. 00:00 could be a timestamp for whose he wants to see the entries. Using a RegEx make the job easier, like "01:\\d{2} am" to get the whole range of entries inside that morning hour.
    If it's really
    that literal string he needs to match, as opposed to
    say "\\d\\d:\\d\\d" then indexOf is simpler. It will
    probably perform better too. I don't know if that
    difference will be significant, but on a file of
    300,000 lines, it might be noticable.The only way to know that is testing both solutions. But you are right, we are just wondering here, with no better info on the requirements anything can go. I agree with you, indexOf is the simple way to go and probably will sufice.
    May the code be with you.

  • Search MS Word for Exact Match

    I've got a script that opens an MS Word document, then searches through a directory for each image file (.jpg), then does a find and replace using the filename as the search string, and inserts the image in place of the text it finds. My problem is that
    it's not doing an exact match. This means for example that if it looks for image1.jpg and that text exists in the word document inserts the image in it's place (the text being a placeholder). But if mimimage1.jpg was in place before it then it would insert
    the .jpg there - not doing an exact match.
    Here's the code I've got so far:
    # Get variables from XML file
    $MyDir = Split-Path $MyInvocation.MyCommand.Definition
    # Get settings from variables.xml.
    [xml]$settings = get-content "$MyDir\variables-test.xml"
    # Assign the settings to local variables.
    $SMTP = $settings.Settings.Setting.SMTP
    $port = $settings.Settings.Setting.port
    $from = $settings.Settings.Setting.EmailFrom
    $to = $settings.Settings.Setting.EmailTo
    $subject = $settings.Settings.Setting.Subject
    $body = $settings.Settings.Setting.Body
    $savepath = $settings.Settings.Setting.SavePath
    $docfile = $settings.Settings.Setting.WordDoc
    $XMLpath = "$MyDir\variables.xml"
    [String[]]$strXML=@()
    [xml]$xml = get-content $XMLpath
    $parse_results = New-Object System.Collections.ArrayList
    add-type -AssemblyName "Microsoft.Office.Interop.Word"
    $wdunits = "Microsoft.Office.Interop.Word.wdunits" -as [type]
    $application = New-Object -comobject word.application
    $application.visible = $false
    $document = $application.documents.open($docfile)
    set-variable -name wdGoToLine -value 3 -option constant
    set-variable -name wdGoToAbsolute -value 1 -option constant
    # Create new directory
    $date = (Get-Date -format "dd-MM-yyyy")
    $newdir = $savepath + "archive" + "-" + $date
    New-Item -ItemType directory -Path $newdir
    # Search Word document for filename and insert image
    foreach($file in Get-ChildItem $savepath -Filter *.jpg)
    if ($application.Selection.Find.Text = $file)
    if ($application.Selection.Find.Execute())
    $insertfile = $savepath + $file
    $objSelection = $application.selection
    $objShape = $objSelection.InlineShapes.AddPicture($insertfile)
    $gotoline = $objSelection.GoTo($wdGoToLine, $wdGoToAbsolute,1)
    # Move spreadsheets and images to archive location and cleanup after dfm2xls.ps1 before ending script
    foreach($movexlsx in Get-ChildItem $savepath -Filter *.xlsx)
    $xlpath = $savepath + $movexlsx
    Move-Item $xlpath $newdir
    foreach($movejpg in Get-ChildItem $savepath -Filter *.jpg)
    $imgpath = $savepath + $movejpg
    Move-Item $imgpath $newdir
    # Save document then close application
    $newsave = $savepath + $date + "-report.docx"
    $document.SaveAs([ref]$newsave)
    $document.Close()
    $application.quit()
    At the moment it doesn't do an exact match but I've tried using:
    $MatchWholeWord = $True
    $MatchCase = $False
    and then
    $application.Selection.Find.Execute($MatchWholeWord, $MatchCase)
    But that stopped it from finding any matches. Can anyone help?
    Thanks in advance

    Hi AJ Mellor,
    If you want to replace the words of the .jpg file's name with the picture in word file, this script should be helpful for you to modify your script:
    Hey, Scripting Guy! How Can I Read Words in a Text File and Make Those Same Word Italic in a Word Document?
    Insert pictures in a folder into a Word document (PowerShell)
    In addition, to get the words of the file name instead of the full path name, please refer to the script below:
    $files = Get-ChildItem $savepath -Filter *.jpg
    $words = $files.basename
    foreach($word in $words){
    I hope this helps.

  • Open item Settlement for exact match.

    Hi All,
    We have requirement in our project to clear the exact match first ahead of the oldest due debt.
    To elaborate on the requirement, please have a look at the following example.
    1st Invoice -$100  Due date-1/11/2010
    2nd Invoice-$250  Due date-1/12/2010
    Customer makes a payment of $250 on 10/12/2010.
    As per our requirement, It should clear the 2nd Invoice first, as it gets an exact match and not the oldest debt due.
    However, if the customer makes a payment of say $300, then it does not find any exact match and hence will clear the oldest due first.In this case,the 1st invoice.
    In the clearing Step under the clearing variant , we have tried to use the Amount rule as '0'-Clearing only possible when amounts are same.....but it is not working as per our requirement.
    Can any one of you give any thoughts on the issue?
    Thanks,
    Amlan

    Hi - tried this config, and I cleared an open item based on exact amount, that was due later that 2 other items. See below.
    Ivor Martin
    Clearing Var.   ZEX  Exact matching test
    Clearing Step   1    Exact match on amount
       Char.                    Grpng rule    Sort charact.           Rank     Sort
    1. 013  Open Amount Without In          1.
    2.                                      2.
    3.                                      3.
    4.                                      4.
    5.                                      5.
      Amount Rule     0
      Clearing rule                                  Paymt rem. var.  ZEX / 2
                                                     End of assgmt
                                           / 0
    Clearing Step   2    Oldest due date
       Char.                    Grpng rule    Sort charact.           Rank     Sor
    1. 015  Contract Account                1. 010  Due date
    2.                                      2.
    3.                                      3.
    4.                                      4.
    5.                                      5.
      Amount Rule
      Clearing rule                                  Paymt rem. var.      / 0
                                                     End of assgmt    9
                                           / 0

  • How to execute exact match & contains text search simultaneoulsy in Oracle 10g

    Hi,
    We have scenario where there are more than 50 million rows in a table with description column length as 1000 character. We have a web interface from where we generate a rule of comma separated keywords like
    "Standard", Single, Cancel, "deal"    & so on. The words in quotes needs to be checked for exact match & the one without quotes will be searched using contains.
    The problem is that we can have a rule of such a combination as large as 4000 characters of inclusion & 2000 such characters for exclusion (not to consider the description under exclusion) and this search when run on the table with millions of rows does not work using oracle regular expression, but works with smaller no. of search keywords.
    Is there a better way to do such a kind of search in Oracle or if not then outside oracle using any other tool
    Thanks,
    AP

    Please find below the table script, few insert statements along with the SP & function. Please help.
    -- Create Table
    CREATE TABLE Roomdescriptionmaster
    ID long,
    ROOMDESCRIPTION nvarchar2, --- max 1000 charaters
    Createddate datetime
    ----- Insert statements
    INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Double Room (2 Adults + 2 Children) | FREE cancellation before Mar 16, 2014 PAY LATER All-Inclusive [ Included:10 % VAT] Meals:All meals and select beverages are included in the room rate.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
    INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Double or Twin Room | FREE cancellation before Feb 1, 2014 PAY LATER All-Inclusive [ Included:10 % VAT] Meals:All meals and select beverages are included in the room rate.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
    INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Quadruple Room (3 Adults + 1 Child) | FREE cancellation before Mar 16, 2014 PAY LATER Full board included [ Included:10 % VAT] Meals:Breakfast, lunch & dinner included.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
    INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Triple Room with Lateral Sea View (2 Adults + 1 Child) | FREE cancellation before Dec 6, 2013 PAY LATER All-Inclusive [ Included:10 % VAT] Meals:All meals and select beverages are included in the room rate.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
    INSERT INTO ROOMDESCRIPTION (ID, ROOMDESCRIPTION, Createddate ) VALUES (1, 'Single Room with Lateral Sea View | FREE cancellation before Dec 6, 2013 PAY LATER All-Inclusive [ Included:10 % VAT] Meals:All meals and select beverages are included in the room rate.Cancellation:If canceled or modified up to 2 days before date of arrival,no fee will be charged.If canceled or modified later,100 percent of the first two nights will be charged.In case of no-show, the total price of the reservation will be charged. Prepayment:No deposit will be charged', sysdate)
    --SP
    CREATE OR REPLACE PROCEDURE
    SP_PGHGETROOMDESCRIPTION(v_BId                number,
                               v_DaysOfData         integer,
                               v_Incl1              nvarchar2,
                               v_Incl2              nvarchar2,
                               v_Incl3              nvarchar2,
                               v_Excl1              nvarchar2,
                               v_CurrentIndex       integer,
                               v_RecordPerPage      integer,
                               v_IndexMultiplier    integer,
                               ref_recordset        out sys_refcursor
                               ) as
    start_index        integer;
    end_index          integer;
    Incl1              nvarchar2(2000);
    Incl2              nvarchar2(2000);
    Incl3              nvarchar2(2000);
    Excl1              nvarchar2(2000);
    v_desc_utf_value   VARCHAR2(10);
    begin
    v_desc_utf_value:= 'utf8';
      if v_incl1 is null or trim(v_incl1) = '' then
         --dbms_output.put_line('include 1 is null or blank');
         Incl1 := '';
      else
         Incl1 := lower(v_Incl1);
      end if;
      if v_incl2 is null or trim(v_incl2) = '' then
         --dbms_output.put_line('include 2 is null or blank');
         Incl2 := '';
      else
         Incl2 := lower(v_Incl2);
      end if;
      if v_incl3 is null or trim(v_incl3) = '' then
         --dbms_output.put_line('include 3 is null or blank');
         Incl3 := '';
      else
         Incl3 := lower(v_Incl3);
      end if;
      if v_Excl1 is null or trim(v_Excl1) = '' then
         --dbms_output.put_line('Exclude 1 is null or blank');
         Excl1 := '';
      else
         Excl1 := lower(v_Excl1);
      end if;
       -- Old code
       --     and regexp_like(lower(ROOMDESCRIPTION), Incl1, 'i')
       --    and regexp_like(lower(ROOMDESCRIPTION), Incl2, 'i')
       --     and regexp_like(lower(ROOMDESCRIPTION), Incl3, 'i')
       --     and not regexp_like(lower(ROOMDESCRIPTION), Excl1, 'i')
    --- First call to SP
      if v_CurrentIndex = 1 then
          start_index := v_RecordPerPage * v_IndexMultiplier;
          end_index   := (v_CurrentIndex - 1 + v_IndexMultiplier) * v_RecordPerPage;
          open ref_recordset for
         select * from (
          select ROOMDESCRIPTION, Createddate,  rownum as rn
          from roomdescriptionmaster
          where BID = v_BId
          and TO_NUMBER(trunc(sysdate) - to_date(to_char(createddate, 'yyyy-mm-dd'),'yyyy-mm-dd')) <= v_DaysOfData
          and length(FN_GET_RESTRICTION(lower(ROOMDESCRIPTION),Incl1,Incl2,Incl3,Excl1,v_desc_utf_value)) > 0
          and row_num <= v_RecordPerPage * v_IndexMultiplier
          order by row_num;
      else
      --- Subsequent calls to SP using paging from UI
          start_index := (v_CurrentIndex - 1) * v_RecordPerPage + 1;
          end_index   := (v_CurrentIndex - 1 + v_IndexMultiplier) * v_RecordPerPage;
          open ref_recordset for
          select * from (
          select ROOMDESCRIPTION, Createddate,  rownum as rn
          from roomdescriptionmaster
          where BID = v_BId
          and TO_NUMBER(trunc(sysdate) - to_date(to_char(createddate, 'yyyy-mm-dd'),'yyyy-mm-dd')) <= v_DaysOfData
          and length(FN_GET_RESTRICTION(lower(ROOMDESCRIPTION),Incl1,Incl2,Incl3,Excl1,v_desc_utf_value)) > 0
          order by roomdescriptionmasterid desc
          where rn >= start_index
          and rn <= end_index
          order by rn;
      end if;
      commit;
    end SP_PGHGETROOMDESCRIPTION;
    --Function
    CREATE OR REPLACE FUNCTION FN_GET_RESTRICTION(
    v_rate_description IN NVARCHAR2,
    v_include_1 IN NVARCHAR2,
    v_include_2 IN NVARCHAR2,
    v_include_3 IN NVARCHAR2,
    v_exclude IN NVARCHAR2, v_desc_utf_value IN VARCHAR2)
      RETURN NVARCHAR2
    IS
    CURSOR include_1_cur IS
    select regexp_substr(str, '[^,]+', 1, level) str
    from (select v_include_1 str from dual)
    connect by level <= length(str)-length(replace(str,','))+1;
    CURSOR include_2_cur IS
    select regexp_substr(str, '[^,]+', 1, level) str
    from (select v_include_2 str from dual)
    connect by level <= length(str)-length(replace(str,','))+1;
    CURSOR include_3_cur IS
    select regexp_substr(str, '[^,]+', 1, level) str
    from (select v_include_3 str from dual)
    connect by level <= length(str)-length(replace(str,','))+1;
    CURSOR exclude_cur IS
    select regexp_substr(str, '[^,]+', 1, level) str
    from (select v_exclude str from dual)
    connect by level <= length(str)-length(replace(str,','))+1;
    include_1_rec include_1_cur%rowtype;
    include_2_rec include_2_cur%rowtype;
    include_3_rec include_3_cur%rowtype;
    exclude_rec exclude_cur%rowtype;
    tmp_var NVARCHAR2(200);
    tmp_var_int NUMBER;
    tmp_flag_int NUMBER;
    return_str NVARCHAR2(200);
    tmp_length NUMBER;
    tmp_length_include_1 NUMBER;
    tmp_length_include_2 NUMBER;
    tmp_length_include_3 NUMBER;
    tmp_length_exclude NUMBER;
    tmp_regex_pattern VARCHAR2(1000);
    flag_include_1_match INTEGER;
    flag_include_2_match INTEGER;
    flag_include_3_match INTEGER;
    flag_exclude_match INTEGER;
    BEGIN
      tmp_length_include_1 := nvl(length(v_include_1),0);
      tmp_length_include_2 := nvl(length(v_include_2),0);
      tmp_length_include_3 := nvl(length(v_include_3),0);
      tmp_length_exclude := nvl(length(v_exclude),0);
      flag_include_1_match := 0;
    flag_include_2_match := 0;
    flag_include_3_match := 0;
    flag_exclude_match := 0;
      IF tmp_length_include_1>0 OR tmp_length_include_2 >0
      OR tmp_length_include_3 >0 OR tmp_length_exclude >0 THEN
      IF v_desc_utf_value ='utf8' THEN
        ----------------------------------------------------- UTF 8 STARTED --------------
    -----------------------------------------   INCLUDE 1
      tmp_length := tmp_length_include_1;
      IF tmp_length > 0 THEN
      tmp_flag_int :=0;
    FOR include_1_rec in include_1_cur
    LOOP
      tmp_var := trim('' || include_1_rec.str);
      --dbms_output.put_line(tmp_var);
      tmp_regex_pattern := '[^[:alnum:]]'||tmp_var||'[^[:alnum:]]|^'||tmp_var||'$|^'||tmp_var||'[^[:alnum:]]|[^[:alnum:]]'||tmp_var||'$';
      tmp_var_int := nvl(regexp_instr(v_rate_description,tmp_regex_pattern,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int :=1;
      flag_include_1_match := 1;
      EXIT;
      END IF;
    END LOOP;
    ELSE
      flag_include_1_match := 1;
    END IF;
    --------------------------------------------  INCLUDE 2
    tmp_length := tmp_length_include_2;
      IF tmp_length > 0 THEN
        tmp_flag_int :=0;
    IF flag_include_1_match =1 THEN
      FOR include_2_rec in include_2_cur
    LOOP
      tmp_var := trim('' || include_2_rec.str);
    tmp_regex_pattern := '[^[:alnum:]]'||tmp_var||'[^[:alnum:]]|^'||tmp_var||'$|^'||tmp_var||'[^[:alnum:]]|[^[:alnum:]]'||tmp_var||'$';
      tmp_var_int := nvl(regexp_instr(v_rate_description,tmp_regex_pattern,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int :=1;
      flag_include_2_match := 1;
      EXIT;
      END IF;
    END LOOP;
    END IF;
    ELSE
      flag_include_2_match := 1;
    END IF;
    -------------------------------------------- INCLUDE 3
    tmp_length := tmp_length_include_3;
      IF tmp_length > 0 THEN
      tmp_flag_int :=0;
       IF flag_include_2_match =1 THEN
      FOR include_3_rec in include_3_cur
    LOOP
      tmp_var := trim('' || include_3_rec.str);
    tmp_regex_pattern := '[^[:alnum:]]'||tmp_var||'[^[:alnum:]]|^'||tmp_var||'$|^'||tmp_var||'[^[:alnum:]]|[^[:alnum:]]'||tmp_var||'$';
      tmp_var_int := nvl(regexp_instr(v_rate_description,tmp_regex_pattern,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int :=1;
      flag_include_3_match := 1;
      EXIT;
      END IF;
    END LOOP;
    END IF;
    ELSE
      flag_include_3_match := 1;
    END IF;
    -------------------------------------------- EXCLUDE
    tmp_length := tmp_length_exclude;
    IF tmp_length > 0 and flag_include_3_match =1 THEN
      FOR exclude_rec in exclude_cur
    LOOP
      tmp_var := trim('' || exclude_rec.str);
    tmp_regex_pattern := '[^[:alnum:]]'||tmp_var||'[^[:alnum:]]|^'||tmp_var||'$|^'||tmp_var||'[^[:alnum:]]|[^[:alnum:]]'||tmp_var||'$';
      tmp_var_int := nvl(regexp_instr(v_rate_description,tmp_regex_pattern,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int := -1;
      return_str := '';
      EXIT;
      END IF;
    END LOOP;
    END IF;
      ELSE
      ----------------------------------------------------- UTF 16 STARTED --------------
      -----------------------------------------   INCLUDE 1
      tmp_length := tmp_length_include_1;
      IF tmp_length > 0 THEN
      tmp_flag_int :=0;
      FOR include_1_rec in include_1_cur
    LOOP
      tmp_var := trim('' || include_1_rec.str);
      --dbms_output.put_line(tmp_var);
    tmp_var_int := nvl(INSTR(v_rate_description,tmp_var,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int :=1;
      flag_include_1_match := 1;
      EXIT;
      END IF;
    END LOOP;
    ELSE
      flag_include_1_match := 1;
    END IF;
    --------------------------------------------  INCLUDE 2
    tmp_length := tmp_length_include_2;
      IF tmp_length > 0 THEN
        tmp_flag_int :=0;
    IF flag_include_1_match =1 THEN
      FOR include_2_rec in include_2_cur
    LOOP
      tmp_var := trim('' || include_2_rec.str);
    tmp_var_int := nvl(INSTR(v_rate_description,tmp_var,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int :=1;
      flag_include_2_match := 1;
      EXIT;
      END IF;
    END LOOP;
    END IF;
    ELSE
      flag_include_2_match := 1;
    END IF;
    -------------------------------------------- INCLUDE 3
    tmp_length := tmp_length_include_3;
      IF tmp_length > 0 THEN
      tmp_flag_int :=0;
       IF flag_include_2_match =1 THEN
      FOR include_3_rec in include_3_cur
    LOOP
      tmp_var := trim('' || include_3_rec.str);
    tmp_var_int := nvl(INSTR(v_rate_description,tmp_var,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int :=1;
      flag_include_3_match := 1;
      EXIT;
      END IF;
    END LOOP;
    END IF;
    ELSE
      flag_include_3_match := 1;
    END IF;
    -------------------------------------------- EXCLUDE
    tmp_length := tmp_length_exclude;
    IF tmp_length > 0 and flag_include_3_match =1 THEN
      FOR exclude_rec in exclude_cur
    LOOP
      tmp_var := trim('' || exclude_rec.str);
      tmp_var_int := nvl(INSTR(v_rate_description,tmp_var,1,1),0);
      IF (tmp_var_int <> 0) THEN
      tmp_flag_int := -1;
      return_str := '';
      EXIT;
      END IF;
    END LOOP;
    END IF;
    END IF;
    IF tmp_flag_int = 1 THEN
    return_str := 'truely matched';
    ELSE
    return_str := '';
    END IF;
    ELSE
    return_str := '';
    END IF;
    return return_str;
    EXCEPTION
      WHEN OTHERS THEN
      --dbms_output.put_line('Exception');
        RAISE;
    END FN_GET_RESTRICTION;

  • WITHIN clause for XML

    I know that within clause works for XML in clob, but I tried to save XML in bfile, after I create index, the WITHIN query always return 0 rows, does WITHIN work for bfile?
    Thanks

    Note:121405.1
    Subject:
    How to load a XML file into a Database table
    Type:
    BULLETIN
    Status:
    REVIEWED
    Content Type:
    TEXT/PLAIN
    Creation Date:
    05-OCT-2000
    Last Revision Date:
    06-OCT-2000
    Language:
    USAENG
    This article is being delivered in Draft form and may contain
    errors. Please use the MetaLink "Feedback" button to advise
    Oracle of any issues related to this article.
    PURPOSE
    This note is intended to explain the way to load a XML file into database table from PL/SQL.
    SCOPE
    It is intended for XML developers and technical analysts who want to integrate XML and Oracle.
    Pre-requisites :
    1. Oracle RDBMS version is 8.1.6 or higher.
    2. Oracle JServer is installed.
    3. XML-SQL (XSU) Utility is installed.
    XML file ( example.xml ):
    Note :
    The <ROWSET> tag specifies the default tag name for the document.
    The <ROW> tag specifies the default tag name for the ROW elements.
    - - - - - - - - - - - - - - - - File begins here - - - - - - - - - - - - - - - -
    <ROWSET>
    <ROW>
    <DOCID> 91739.1 </DOCID>
    <SUBJECT> MTS: ORA-29855, DRG-50704, ORA-12154: on create index using Intermedia </SUBJECT>
    <TYPE> PROBLEM </TYPE>
    <CONTENT_TYPE> TEXT/PLAIN </CONTENT_TYPE>
    <STATUS> PUBLISHED </STATUS>
    <CREATION_DATE> 14-DEC-1999 </CREATION_DATE>
    <LAST_REVISION_DATE> 05-JUN-2000 </LAST_REVISION_DATE>
    <LANGUAGE> USAENG </LANGUAGE>
    </ROW>
    </ROWSET>
    - - - - - - - - - - - - - - - - File ends here - - - - - - - - - - - - - - - -
    Program Notes :
    The following data structures are to be set up for the example to work :
    Create directory object mapped to physical directory which contain the XML file.
    Note Oracle user should have atleast read permission for the directory and the XML file.
    CREATE DIRECTORY XML_DIR AS '/tmp';
    Create a table containing a BFILE and insert a row for the XML file.
    CREATE TABLE XML_TEMP (key NUMBER, f_lob BFILE);
    INSERT INTO XML_TEMP VALUES (1,BFILENAME('XML_DIR','example.xml'));
    Create table into which the XML document has to be loaded.
    Note that the column names of the table should match the XML tags.
    CREATE TABLE XML_DOC (
    DOCID VARCHAR2(10),
    SUBJECT VARCHAR2(100),
    TYPE VARCHAR2(20),
    CONTENT_TYPE VARCHAR2(20),
    STATUS VARCHAR2(20),
    CREATION_DATE VARCHAR2(15),
    LAST_REVISION_DATE VARCHAR2(15),
    LANGUAGE VARCHAR2(10)
    Program :
    - - - - - - - - - - - - - - - - Code begins here - - - - - - - - - - - - - - - -
    CREATE OR REPLACE PROCEDURE loadxml AS
    fil BFILE;
    buffer RAW(32767);
    len INTEGER;
    insrow INTEGER;
    BEGIN
    SELECT f_lob INTO fil FROM xml_temp WHERE key = 1;
    DBMS_LOB.FILEOPEN(fil,DBMS_LOB.FILE_READONLY);
    len := DBMS_LOB.GETLENGTH(fil);
    DBMS_LOB.READ(fil,len,1,buffer);
    xmlgen.resetOptions;
    insrow := xmlgen.insertXML('xml_doc',UTL_RAW.CAST_TO_VARCHAR2(buffer));
    DBMS_OUTPUT.PUT_LINE(insrow);
    IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    DBMS_LOB.FILECLOSE(fil);
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('In Exception');
    DBMS_OUTPUT.PUT_LINE(SQLERRM(SQLCODE));
    IF DBMS_LOB.FILEISOPEN(fil) = 1 THEN
    DBMS_LOB.FILECLOSE(fil);
    END IF;
    end;
    - - - - - - - - - - - - - - - - Code ends here - - - - - - - - - - - - - - - -
    Sample Output :
    SQL>set serveroutput on
    SQL>exec loadxml;
    SQL> column subject format a20 truncated
    SQL> select * from xml_doc;
    SQL>
    DOCID SUBJECT TYPE
    CONTENT_TYPE STATUS CREATION_DATE LAST_REVISION_D LANGUAGE
    91739.1 MTS: ORA-29855, DRG PROBLEM TEXT/PLAIN
    PUBLISHED 14-DEC-1999 15-JUN-2000 USAENG
    R eferences :
    1. Oracle8i Supplied PL/SQL Packages Reference
    2. Oracle8i Application Developer's Guide - Large Objects (LOBs)
    3. PL/SQL User's Guide and Reference
    4. XSU's PL/SQL API -- XMLGEN

Maybe you are looking for