where contains and table

I have a package which splits a string to a separate expression in table:
CREATE OR REPLACE PACKAGE STRING_FNC
IS

TYPE t_array IS TABLE OF VARCHAR2(50)
   INDEX BY BINARY_INTEGER;

FUNCTION SPLIT (p_in_string VARCHAR2, p_delim VARCHAR2) RETURN t_array;

END;

CREATE OR REPLACE PACKAGE BODY STRING_FNC
IS

   FUNCTION SPLIT (p_in_string VARCHAR2, p_delim VARCHAR2) RETURN t_array 
   IS
   
      i       number :=0;
      pos     number :=0;
      lv_str  varchar2(50) := p_in_string;
      
   strings t_array;
   
   BEGIN
   
      -- determine first chuck of string  
      pos := instr(lv_str,p_delim,1,1);
   
      -- while there are chunks left, loop 
      WHILE ( pos != 0) LOOP
         
         -- increment counter 
         i := i + 1;
         
         -- create array element for chuck of string 
         strings(i) := substr(lv_str,1,pos);
         
         -- remove chunk from string 
         lv_str := substr(lv_str,pos+1,length(lv_str));
         
         -- determine next chunk 
         pos := instr(lv_str,p_delim,1,1);
         
         -- no last chunk, add to array 
         IF pos = 0 THEN
        
            strings(i+1) := lv_str;
         
         END IF;
      
      END LOOP;
   
      -- return array 
      RETURN strings;
      
   END SPLIT;

END;  
To test if it works, I use:
DECLARE    
     str string_fnc.t_array;
BEGIN    
     str := string_fnc.split('word1 word2 word3');     

     FOR i IN 1..str.count LOOP     
          DBMS_OUTPUT.PUT_LINE(str(i));
     END LOOP;     
END;
Is it possible to use this package or split function in SELECT such as:
SELECT title
FROM t1
WHERE CONTAINS (title, HERE I have MIS FUNCTION('word1 word2 mot3")) > 0?;

I mean, for example, if I have the table with 4 rows with values word1, word2, mot3 and mot4 and I run this query without function, I get NO LINES FOUND, but you search for word1, word2, and mot3.
SCOTT@orcl_11gR2> CREATE TABLE t1
  2    (title  VARCHAR2 (60))
  3  /

Table created.

SCOTT@orcl_11gR2> INSERT ALL
  2  INTO t1 VALUES ('test')
  3  INTO t1 VALUES ('tests')
  4  INTO t1 VALUES ('tested')
  5  INTO t1 VALUES ('testing')
  6  INTO t1 VALUES ('plan')
  7  INTO t1 VALUES ('plans')
  8  INTO t1 VALUES ('planned')
  9  INTO t1 VALUES ('planning')
 10  INTO t1 VALUES ('game')
 11  INTO t1 VALUES ('games')
 12  INTO t1 VALUES ('other')
 13  SELECT * FROM DUAL
 14  /

11 rows created.

SCOTT@orcl_11gR2> CREATE INDEX t1_title_idx
  2  ON t1 (title)
  3  INDEXTYPE IS CTXSYS.CONTEXT
  4  /

Index created.

SCOTT@orcl_11gR2> VARIABLE string VARCHAR2 (4000)
SCOTT@orcl_11gR2> EXEC :string := 'test plan game'

PL/SQL procedure successfully completed.

SCOTT@orcl_11gR2> SELECT title
  2  FROM   t1
  3  WHERE  CONTAINS (title, '$' || REPLACE (:string, ' ', ' OR $')) > 0
  4  /

TITLE
------------------------------------------------------------
test
tests
tested
testing
plan
plans
planned
planning
game
games

10 rows selected.

SCOTT@orcl_11gR2>

Tags: Database

Similar Questions

  • How to check if a table contains a table

    I have an array array1 say array that contains several tables. I have another table say array2. Now, I want to check whether or not arrray1 contains array2. How can I check this?

    The way hard and obvious, but as strcmp(), you can move to the table following once you are unable to find a match.

  • Report interactive get where clause and change

    Hello

    If it is possible at the Apex 4.2 get interactive report where clause and change before Notre Dame for example result

    We have a report and some of the columns we should exactly match and for some partial matching.

    And the requirement of the company, they can't add % extra to the and of the search string. It should be added automatically for certain fields.

    Thank you.

    If it is possible at the Apex 4.2 get interactive report where clause and change before Notre Dame for example result

    Get it? Yes. Change it? N °

    We have a report and some of the columns we should exactly match and for some partial matching.

    And the requirement of the company, they can't add % extra to the and of the search string. It should be added automatically for certain fields.

    Teach the company how to use the tools at their disposal. Quick filters use the default search "contains", while the more specific filters are accessible through actions > filters.

    You still use IR filters? When you do a quick search (with or without a selected column), then a contains the will find the occurrence of the entered string regardless of its position (starts with, ends with).

    If you use page elements to filter, then you can easily add the % to these clauses, no?

  • BAD RESULTS WITH OUTER JOINS AND TABLES WITH A CHECK CONSTRAINT

    HII All,
    Could any such a me when we encounter this bug? Please help me with a simple example so that I can search for them in my PB.


    Bug:-8447623

    Bug / / Desc: BAD RESULTS WITH OUTER JOINS AND TABLES WITH a CHECK CONSTRAINT


    I ran the outer joins with check queries constraint 11G 11.1.0.7.0 and 10 g 2, but the result is the same. Need to know the scenario where I will face this bug of your experts and people who have already experienced this bug.


    Version: -.
    SQL> select * from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE    11.1.0.7.0      Production
    TNS for Solaris: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production

    Why do you not use the description of the bug test case in Metalink (we obviously can't post it here because it would violate the copyright of Metalink)? Your test case is not a candidate for the elimination of the join, so he did not have the bug.

    Have you really read the description of the bug in Metalink rather than just looking at the title of the bug? The bug itself is quite clear that a query plan that involves the elimination of the join is a necessary condition. The title of bug nothing will never tell the whole story.

    If you try to work through a few tens of thousands of bugs in 11.1.0.7, of which many are not published, trying to determine whether your application would be affected by the bug? Wouldn't be order of magnitude easier to upgrade the application to 11.1.0.7 in a test environment and test the application to see what, if anything, breaks? Understand that the vast majority of the problems that people experience during an upgrade are not the result of bugs - they are the result of changes in behaviour documented as changes in query plans. And among those who encounter bugs, a relatively large fraction of the new variety. Even if you have completed the Herculean task of verifying each bug on your code base, which would not significantly easier upgrade. In addition, at the time wherever you actually performed this analysis, Oracle reportedly released 3 or 4 new versions.

    And at this stage would be unwise to consider an upgrade to 11.2?

    Justin

  • for relaxation: where is the table created by the Wizzard users create in the APEX?

    Hello everyone and Tony in particular since it was followed and mentoring my progress on this.

    Well,.

    Here we have 2 things:



    (1) when the wizzard of Administration > database > manage users creates a user. Where is the table it creates? What name does have? Why is it not visible in the object browser? I need the name of this table to put it on my trigger (I called users_table)



    (2) how to do that whenever a user connects, his formerly generated by the trigger sequence is used by a State to extract personal data (it's sort of VPD) in this case would be, how do you know what surrogate key, we need to call. To do this, I think, the thing would be to request the: = APP_USER (that was created in step 1) and each APP_USER will surrogate that are associated with this key.



    I set up a simple trigger, but just the substring of the concatenation of the given username, the system randomly generated pwd up to 12 characters.



    CREATE OR REPLACE
    GENERATE_SEQUENCE RELAXATION
    AFTER INSERT ON USERS_TABLE
    FOR EACH LINE
    BEGIN
    insert into users_table (surrogate_key)
    values (SUBSTR (¦¦ username password), 1.12);
    END;


    but as I said, this users_table must be the table where the wizzard to create users stores its data,... .but where is this table?


    Thank you very much

    Alvaro

    Published by: Alvaroe on February 6, 2010 09:13

    Published by: Alvaroe on February 6, 2010 10:00

    Hello

    (1) create a table and then start filling in

    I think you need to have a custom table of your patients (and users), say,

    CREATE TABLE patients
      (
        "USER_ID"   NUMBER,
        "USER_NAME" VARCHAR2(100 BYTE),
        "FIRST_NAME" VARCHAR2(100 BYTE),
        "LAST_NAME" VARCHAR2(100 BYTE),
        "PASSWORD"  VARCHAR2(4000 BYTE),
        "CREATED_ON" DATE
        CONSTRAINT patients_PK PRIMARY KEY ("USER_ID")
      );
    

    you need to build customized in your appl authentication and do not use the Apex or Db authentication.
    To do this, you must do this table in the schema that is used in the analysis of your application's schema.
    And you need create the function custom_hash like this:

    create or replace
    function custom_hash (p_username in varchar2, p_password in varchar2)
    return varchar2
    is
      l_password varchar2(4000);
      l_salt varchar2(4000) := '55PSP4P78JLDQ2AMBXQ60DW9OW7G9Z';
    begin
    
    l_password := utl_raw.cast_to_raw(dbms_obfuscation_toolkit.md5
      (input_string => p_password || substr(l_salt,10,13) || p_username ||
        substr(l_salt, 4,10)));
    return l_password;
    end;
    

    (2) then build the trigger when it detects that I completed a line
    It generates this sequence AND inserts it into another table (as you say, I could not put it in the same table)

    users must register themselves?
    Or register?
    Then you must create the free registration form or a form where you fill in your table above users.

    I think that your user_name must be unique. Put a Unique about this strain.

    When creating the patient button is pressed, then the above table is filled (you must and name, user in the form fill password)
    You must calculate USER_ID, user_name, password and created_on, this can be done in the trigger

    create or replace
    TRIGGER patients_trg_bi
      before insert on patients
      for each row
    begin
    if :NEW.USER_ID is null then
        select patients_seq.nextval into :NEW.USER_ID from dual;
    end if;
    
    if :NEW.CREATED_ON is null then
        :NEW.CREATED_ON := SYSDATE;
    end if;
    
    if :NEW.USER_NAME  is null then
        :NEW.USER_NAME  := :NEW.LAST_NAME || :NEW.USER_ID;
    end if;
    
       :NEW.PASSWORD := custom_hash(:NEW.USER_NAME, :NEW.PASSWORD);
    
    end;   
    

    you create the sequence of patients_seq

    In this case the surrogate key be hashed password.
    And you can use it by selecting table using patients: APP_USER
    that is when the user is connected to his USER_NAME, variable APP_USER is filled

    (3) then, the SQL query would recover this surrogate_key and show as connected individual data.

    Yes, when the user logs on, the key is populated by users based on table: APP_USER
    using

    select password
    from patients
    where user_name = :APP_USER;
    

    You must understand how EVP can be implemented at the Apex.

    You can use any application for this SURROGATE_KEY say

    which is calculated by Application of calculation on the new Instance

    4) but in order to know what to ask, surrogate key should be a key with the substitution APP_USER connection

    is that correct?

    Yes. You have the info from the users table

    Do you have examples of Applications Apex somewhere.
    If you use Apex 2.1, you can install it from the repository and if you have 3 Apex, they are normally automatically installed if you create the new workspace.

    You can use it a lot to manage users.

    Concerning
    Oleg

    BTW,

    Alvaro,
    Yo have your appl?
    If you sent your Db and tables all the Pl/SQl, as well as application Apex, you have for me by email, I can check and make/suggest improvements
    (For free, of course)
    I need to check what you did there, otherwise it seems to be a very long subject.
    Well, I have the time to discuss

    Yes, you can make the trigger like this

    CREATE OR REPLACE
    GENERATE_SEQUENCE RELAXATION
    AFTER INSERT ON USERS_TABLE
    FOR EACH LINE
    BEGIN
    insert into GENERATED_SEQUENCES_TABLE (lastinserted_name, surrogate_key)
    values (SELECT name from USER OF USERS_TABLE WHERE USERID..., SUBSTR (lastinsertedname¦¦ password), 1.12);
    END;

    but where the values are made here
    SUBSTR (lastinsertedname¦¦ password), 1.12

    Published by: oleg.lihvoinen on February 6, 2010 14:55

  • Merits and demerits of the replication of schema-level and Table

    Hello

    We evaluate the streams for our needs of replication. We reproduce nearly 2000 two-way tables. Most of the tables are in a schema. The main schema has a few tables that are not replicated.

    Replicate us schema level? Or at the level of the table? What are the advantages and disadvantages?

    Replication of level schema included with a handful of exclusionary rules seems simpler.

    In water courses at the level of the tables as well as creating 2000 table rules in the beginning, add a new table to an existing configuration of streams, will require additional steps to stop capture/apply/spread, creating new rules for the new table and restart replication. However, it seems that level replication table offering flexibility in terms of group tables. We wanted to group tables about 10 groups of 20 to 300 tables in each group. Each group will have its own capture, propagate and apply. In this way, we can isolate large groups of those unimportant?

    Who is a better setup in terms of maneuverability, flexibility, parallelism and performance?

    Thank you.

    Hello Stargaze,

    OK, so I understand that the grouping is based on the type of transactions and its importance. In this case the grouping would help you in many ways such as:

    1. If you encounter a problem or a bug with one of the processes of capture/apply then the other groups would work fine. Therefore, you have the opportunity to shoot a game of capture, propagation and applies until solve you the problem.

    2. in case if you perform any load batch where the transaction will affect over 10000 + records then it is possible that you could get stuck at 'SUSPENDED for FLOW CONTROL' on any of the feed items. With different groups would give you more flexibility to solve this problem by activating and deactivating groups.

    For more information on this please check the following:

    Apply process is active, inactive, and just stopped in change application

    3. with the schema level replication even if you have the advantage of being simple and have fewer rules in the set of rules, you must consider the 2 points above before you implement it. You need to test both diagrams and tables with a typical load (simulation of the production) and need to identify potential problems in both. Some more points to consider:

    -apply the game patches 10.2.0.4 or at least 10.2.0.3
    -apply all the patches required streams (Note: 437838.1> on metalink)
    -follow the recommendations as indicated:
         Note: 418755.1 broadcast 10.2.0.x.x of recommendations
         Note: 335516.1 Performance of flow recommendations
    Note: 413353.1 10.2 best practices for streams in RAC environment

    Thank you
    Florent

  • How can I convert 2400 (0 x 960) in 60 and 9 where 9 and 60 the fourth and fifth elements of an array?

    How can I convert 2400 (0 x 960) in 60 and 9 where 9 and 60 the fourth and fifth elements of an array of 8 elements?

    Thank you.

    Simplified version.

  • Error: _ "Sidebar.exe - bad image"__windows/system32/sfc.dll is not designed to run on windows or it contains and error. " Try to install the program by using the original installation media or contact your system administrator. __

    Help, please!
    I started my computer today and it came with this error:

    "sidebar.exe - incorrect image.
    Windows/System32/SFC.dll is not designed to run on windows or it contains and error. Try to install the program by using the original installation media or contact your system administrator.

    I click on OK, then he said:

    "Acrotray.exe - incorrect image.
    Windows/System32/SFC.dll is not designed to run on windows or it contains and error. Try to install the program by using the original installation media or contact your system administrator.

    I click OK and then it says:

    "hpqtra08.exe - incorrect image.
    Windows/System32/SFC.dll is not designed to run on windows or it contains and error. Try to install the program by using the original installation media or contact your system administrator.

    Also I got an error report saying that windows sidebar stopped working.

    My computer is VERY slow in all the commands I give.
    I also tried to run the sfc (System File Checker command) and acts like he is going to run the program, but then just closed.

    Do you have an idea what is happening with my computer and what I can do to fix this?

    Thank you very much!

    Hi deacon829,

    You did changes to the computer before that happened?

    Step 1: Start the computer in safe mode and check if the problem persists, to do this, follow the steps below,

    Access the menu advanced startup options by turning on your computer and pressing the F8 key before Windows starts. In the advanced startup options select safe mode

    http://Windows.Microsoft.com/en-us/Windows-Vista/advanced-startup-options-including-safe-mode

    Step 2: If you try to install any application before this program, try to uninstall them.

    http://Windows.Microsoft.com/en-us/Windows-Vista/uninstall-or-change-a-program

    If this solves the problem, you can deduct that the demand is probably corrupted, damaged or incompatible. You can check with the manufacturer of the program for more information.

    Step 3: System Restore: System Restore to put the computer's system files to an earlier point in time.

    Look for steps to restore of the system in the link below:

    http://Windows.Microsoft.com/en-us/Windows-Vista/what-is-system-restore

    If the problem persists,

    Step 4: A scanner online for any threat and try to correct

    http://OneCare.live.com/site/en-us/Center/cleanup.htm

    Thank you, and in what concerns:

    Ajay K

    Microsoft Answers Support Engineer

    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Why use push and pop where addChild and removeChild can do the same work?

    Why use push and pop where addChild and removeChild can do the same work?

    What is the advantage of the push and pop on addChild and removeChild?

    It depends on what you're trying to accomplish. If you explain more about under what circumstances you would use them, a more definitive answer can be provided.    Push and pop of the work for arrays.  addChild and removeChild work for displayObjects.

  • Materialized view and Table

    Dear friends,

    A quick question...

    If the name of the materialized view and table name is same truncate table data truncates too materialized view?

    Thanks /.

    kumar73 wrote:
    Dear friends,

    A quick question...

    If the name of the materialized view and table name is same truncate table data truncates too materialized view?

    Thanks /.

    If the materialized view is built on the table and the Table is truncated data will continue to reside in the MView as long as it is not refreshed.

    Once you refresh the MView, data must disappear.

    With MView and Table names even, does not affect.

  • Using OBIEE 11 G with display of the narrative report and table

    Hello

    I have a report designed as the below, I used 'narrative view' for details of the customer and "table view" for the details of the order. In the narrative view, I can say = 1 line and it picks up the first customer detail record, but the details of the order shows all lines. How can I control it for details of the command displays only the detail of the associated client record. Also how can I go to the second record and so forth. Help, please. If this is not possible and there is no substitutes, let me know. Thanks for your time and your help.

    Customer number:
    Customer name:
    Customer address:

    Details of the order:
    Line number | Order No. | Order description. Status of orders

    Hmm, try this:

    (1) create a PivotTable.

    (2) put the customer number, customer name and address of the customer in the area of the Sections. Make sure each column begins "in a new line.

    (3) in the lines section, put the line number, order number, order Description and status of the orders. Put your measurement in the section measures.

    (4) in the properties of a pivot table, he paused after each change of customer number.

    Then break your PDF files on a new page for each customer. The details of each customer's order must be only for each customer.

  • Container and alignment of background


    Q: how to properly align a "container" in the background?
    Please see image attached. For example, I created a page in DW with a simple background with a horizontal strip at the top. Then I inserted a Div tag and call it 'container' and it was aligned to the center of the page by using the left and right margins to the CSS Styles Panel. However, the first thing I noticed was that the container was now ca. 8 px from the top of the page, even if good margins etc. no parameters. Then, when I inserted a header that was the same height (and the ground) as the scratch in the background, what happened is shown in "A." The two are not aligned because the container is not at the top of the page. What I really want to see is displayed in 'B '.


    My solution was to just under 8 px as part of "top margin" Box enter CSS Style Panel for the container (> B).


    one) but is that the right way to do this? It works in my browsers on my computer (not yet published on the web), but it'll work when someone opens the page on their computer?
    (b) is there a better way or a 'proper' way to do it?
    (c) no idea why the container isn't originally at the top of the page (in A) anyway? There is no settings I see who are moving ca 8 px high.
    Any advice or assistance would be, of course, greatly appreciated... frank

    alignment.jpg

    I am afraid that the CSS properties panel cannot do everything for you.  It is sometimes more effective to switch to Code view.  Just copy and paste the following (in red) code between the tags.

    Nancy O.
    ALT-Web Design & Publishing
    Web | Graphics | Print | Media specialists
    http://ALT-Web.com/
    http://Twitter.com/ALTWEB
    http://ALT-Web.blogspot.com

  • Is automatic and Table numbering in the Document to multiple sections

    I want to set up automatic figure and table numbering that includes a reference to the current section number. (Figure 2-1 = the first figure in article 2; Table 3-2 = the second table in Section 3). I understand how to do this with styles if I had to work with a collection of documents with defined chapters. How can I do this in a single document with a number of defined in section?

    Is the only way to define the styles in the list for my items?

    I'm afraid you're right. You can include the numbering of the chapters in style with the numbered list, but you cannot include section prefixes. I think that you will have to use the method you suggested.

  • How to set different fonts for numbers in the titles and tables of contents

    Hello

    I noticed some people to use a different font for the numbers in the titles and tables of contents to get an extra magic. Is it possible to automate the use of fonts in paragraph styles?

    Oh and suggestions on which fonts would be a good thing for numbers?

    Thank you!

    Furthermore, you must doany of this fancy stuff if you use an OpenType font that made OSF glyphs (and if you are not you will need to set the font as part of your style). Just head on to the style definition and enable OSF there OpenType features section.

  • Dissappearing glossary and table of contents

    I use Robohelp 7 for the first time (I used before V6), and I have a problem with my glossary and table of contents. I created the two - and they appear when I generate and publish, but I can't understand how do seem to be edited.

    If I click on in the project manager (they are each listed as helpSysName (Default), if that makes a difference) and then select Edit - nothing seems to happen.

    Thank you, thank you, thank you! The default loading environment did the trick.

    I thought it should be included in a pod somewhere, but I don't couldn't find it. Very frustrating. Thanks for saving me from that.

    Gail

Maybe you are looking for