SQL to search for GENERIC characters

Nice day


Hi MASTER had a small problem

got a table

DIESEL_DETAIL
___________

DATE_PO
PLATE_NO
DRIVER-NAME

I NEED TO LOOK FOR HERE IS MY REQUEST

SELECT * FROM DIESEL_DETAIL
WHERE TO_CHAR(DATE_PO,'DD-MON-YYYY')
FROM: P1_FROM
AND: P1_TO
AND PLATE_NO =: P1_PLATE_NO
OR DRIVER-NAME =: P1_DRIVER_NAME



ITS WORKING PERFECTLY BUT IT MUST HAVE A VALUE
WHAT I WANT TO IS WHAT HAPPENS IF THE USER ENTERED NO VALUE
IT WILL AUTOMATICALLY RUN THE SEARCH WITH GENERIC CHARACTERS

IS THERE A POSSIBLE WAY?

GOOD DAY MASTER THANK YOU...

Hi Mike,.

Here it is... You can use the NVL() to achieve this goal for the treatment of NULL values.

If the entry is not specified, you can assign values by default if the entry by the user truncates to null...

SELECT *.
OF diesel_detail
WHERE TO_CHAR (date_po, 'DD-MON-YYYY') BETWEEN NVL (: p1_from,)
To_char (date_po,
"MON-DD-YYYY".
)
)
AND NVL (: p1_to,)
To_char (date_po,
"MON-DD-YYYY".
)
)
AND plate_no = NVL (: p1_plate_no, plate_no)
OR driver-name = NVL (: p1_driver_name, driver-name);

In above query, if the entry for: p1_from is not specified,
By default, the entry is TO_CHAR (date_po, 'DD-MON-YYYY') and the query is executed.

Thank you
Shankar

Tags: Database

Similar Questions

  • How do I search for special characters in the Explorer?

    I have a collection of 1000 + files in an FTP folder. The problem is that about 50 of them contain & symbols in their file names. I need to find and delete all the files containing the symbol '& '. I thought it should be easy enough to search for the symbol '&' File Explorer. However, in doing so, nothing happens. It returns all files. Is it possible to search for special characters like '&' in the file Explorer?

    Type filename: * & in the Explorer search field, it finds all files where appears the & character in the file or file name extension.

  • Windows Search - search for special characters

    Hello

    I didn't chance for this search for this kind of things via the interwebs/googlebing (probably due to the wick to 'Search'...

    In any case, I'm looking in the files for the XML files that contain specific characters, and when I'm looking her apparent there are many parts of these (INDEXED location) are ignored...

    for example:

    content: ~ "change."

    Does NOT return the file that starts:

    you are simply looking for a 'Change' returns this file but also returns files that have things in it that I don't want...

    Research Action = 'Change' returns nothing...

    The CustomerOrder search also returns nothing...

    What is the secret for including things like - mark, equal to, oblique, oblique, braces, brackets, single quote, double quote and so on...?

    Indexing is not necessary for the search function.  It is only necessary for the use of the libraries feature and to be able to search for files in the search/ORB box start and also to allow to change the options to search for specific file types.  In any case, I did a test earlier - apparently Windows 7 search search files for all the texts present xml content.  I found this link which describes the hoops to jump through.  We must be able to search xml files in plain text to the search, not the default filter special MS to xml files.

    http://blog.sdbonline.com/2011/09/Windows-search-and-XML-files.html

  • Need help with the search for special characters in oracle text

    Hi all

    Oracle 11g sql developer 4.0 help

    I am facing this challenge where Oracle text when it comes to searching for text that contains a special character.

    What I've done so far with the help of http://www.orafaq.com/forum/t/162229/

    "CREATE TABLE"SOS" COMPANY ".

    (SELECT "COMPANY_ID" NUMBER (10,0) NOT NULL,)

    VARCHAR2 (50 BYTE) "COMPANY."

    VARCHAR2 (50 BYTE) "ADDRESS1"

    VARCHAR2 (10 BYTE) "ADDRESS2"

    VARCHAR2 (40 BYTE) 'CITY ',.

    VARCHAR2 (20 BYTE) 'STATE ', HE SAID.

    NUMBER (5.0) "ZIP".

    ) CREATION OF IMMEDIATE SEGMENT

    PCTFREE, PCTUSED, INITRANS 40 10 1 MAXTRANS 255 NOCOMPRESS SLAUGHTER

    STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)

    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS USER_TABLES DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT 1)

    TABLESPACE 'USERS ';

    Insert into COMPANY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (1, 'LSG SOLUTIONS LLC', null, null, null, null, null);

    Insert into COMPANY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (2,' LOVE "S TRAVEL', null, null, null, null, null);

    Insert into COMPANY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (3, 'DEVON ENERGY', null, null, null, null, null);

    Insert into COMPANY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (4, 'SONIC INC', null, null, null, null, null);

    Insert into COMPANY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (5, "MSCI", null, null, null, null, null);

    Insert into COMPANY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (6, 'ERNEST AND YOUNG', null, null, null, null, null);

    Insert into COMPANY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (7, "JOHN DEER", null, null, null, null, null);

    Insert into COMPANY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (8,'Properties@Oklahoma, LLC', null, null, null, null, null);

    Insert into COMPANY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (9, 'D.D.T L.L.C.', null, null, null, null, null);

    BEGIN

    CTX_DDL. CREATE_PREFERENCE ("your_lexer", "BASIC_LEXER");

    CTX_DDL. SET_ATTRIBUTE ("your_lexer", "' SKIPJOINS,"., @-"'); -to jump. , @ - ' symbols

    END;

    /

    CREATE INDEX my_index2 ON COMPANY (COMPANY_NAME)

    INDEXTYPE IS CTXSYS. CONTEXT IN PARALLEL

    PARAMETERS ("LEXER your_lexer");

    SELECT
    company_name
    FROM company
    WHERE CATSEARCH(company.COMPANY_NAME, 'LLC','') > 0
    ORDER BY company.COMPANY_ID;
    
    

    output

    company_name

    1 LSG SOLUTIONS LLC

    2 Properties@Oklahoma, LLC

    only 2 rows back but must return 3

    It helps if you post a copy and paste of effective enforcement of the full code, including the results.  You posted an index of context with the query with catsearch, which requires a ctxcat index.  You must be a context clue that you did not post and did not add your lexer to.  The following table shows it returns all the lines of 3 as planned using either a with catsearch ctxcat index or a context index with contains, as long that you include the lexer in your create index.  You must also be sure that the index is created, or synchronized after inserting or updating data.

    Scott@ORCL >-version:

    Scott@ORCL > SELECT banner version of v$.

    BANNER

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

    Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production

    PL/SQL Release 11.2.0.1.0 - Production

    CORE 11.2.0.1.0 Production

    AMT for 64-bit Windows: Version 11.2.0.1.0 - Production

    NLSRTL Version 11.2.0.1.0 - Production

    5 selected lines.

    Scott@ORCL >-table and the test data:

    Scott@ORCL > CREATE TABLE 'SOCIETY '.

    2 ("COMPANY_ID" NUMBER (10,0) NULL NOT ACTIVATE,)

    3 'COMPANY_NAME' VARCHAR2 (50 BYTE),

    VARCHAR2 (50 BYTE) 4 "ADDRESS1"

    5 "ADDRESS2" VARCHAR2 (10 BYTE),

    VARCHAR2 (40 BYTE) 6 'CITY',

    7 VARCHAR2 (20 BYTE) 'STATE ', HE SAID.

    NUMBER (5.0) 8 'ZIP '.

    (9) THE CREATION OF IMMEDIATE SEGMENT

    PCTFREE 10 10 PCTUSED 40 INITRANS, MAXTRANS NOCOMPRESS SLAUGHTER 1 255

    11 STORAGE (INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645)

    12 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS USER_TABLES DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT 1)

    TABLESPACE 13 "USERS."

    Table created.

    Scott@ORCL > START

    2 insert in SOCIETY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (1, 'LSG SOLUTIONS LLC', null, null, null, null, null);

    3 insert in SOCIETY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (2,' LOVE "S TRAVEL', null, null, null, null, null);

    4 insert into SOCIETY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (3, 'DEVON ENERGY', null, null, null, null, null);

    5 insert into SOCIETY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (4, 'SONIC INC', null, null, null, null, null);

    6 insert in SOCIETY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (5, "MSCI", null, null, null, null, null);

    7 insert into SOCIETY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (6, 'ERNEST AND YOUNG', null, null, null, null, null);

    8 insert in SOCIETY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (7, "JOHN DEER", null, null, null, null, null);

    9 insert in SOCIETY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (8,'Properties@Oklahoma, LLC', null, null, null, null, null);

    10 insert into SOCIETY (COMPANY_ID, COMPANY_NAME, Address1, Address2, CITY, STATE, ZIP) values (9, 'D.D.T L.L.C.', null, null, null, null, null);

    11 END;

    12.

    PL/SQL procedure successfully completed.

    Scott@ORCL >-lexer:

    Scott@ORCL > START

    CTX_DDL 2. CREATE_PREFERENCE ("your_lexer", "BASIC_LEXER");

    CTX_DDL 3. SET_ATTRIBUTE ("your_lexer", "' SKIPJOINS,"., @-"'); -to jump. , @ - ' symbols

    4 END;

    5.

    PL/SQL procedure successfully completed.

    Scott@ORCL >-ctxcat index and using catsearch queries:

    Scott@ORCL > CREATE INDEX my_index2 ON COMPANY (COMPANY_NAME)

    2 INDEXTYPE IS CTXSYS. CTXCAT PARALLEL

    3 PARAMETERS ("LEXER your_lexer");

    The index is created.

    Scott@ORCL > SELECT

    2 company_name

    3 the COMPANY

    4. WHERE the CATSEARCH (company.COMPANY_NAME, 'LLC', ") > 0

    5 ORDER BY company.COMPANY_ID;

    COMPANY_NAME

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

    LSG SOLUTIONS LLC

    Properties@Oklahoma, LLC

    D.D.T L.L.C.

    3 selected lines.

    Scott@ORCL >-context and using the query index contains:

    Scott@ORCL > CREATE INDEX my_index3 ON COMPANY (COMPANY_NAME)

    2 INDEXTYPE IS CTXSYS. CONTEXT IN PARALLEL

    3 PARAMETERS ("LEXER your_lexer");

    The index is created.

    Scott@ORCL > SELECT

    2 company_name

    3 the COMPANY

    4 WHERE CONTAINS (company.COMPANY_NAME, 'LLC') > 0

    5 ORDER BY company.COMPANY_ID;

    COMPANY_NAME

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

    LSG SOLUTIONS LLC

    Properties@Oklahoma, LLC

    D.D.T L.L.C.

    3 selected lines.

  • GREP search for all characters

    (Indesign CS6, Windows 7)

    For a book that I'm layout, the author marked text that should be indented like this:

    [indent]

    < paragraph >

    < paragraph >

    ...

    [indent]

    (Of course, in an ideal world, the Publisher would have charged the author simply use a word for this function.)

    I made a for the text indented paragraph style. I wanted to replace it in one shot, GREP search:

    (\[indent\]) ([.| \s|\r]+) (\[/indent\]) the middle part meaning one or more (+) of any character (.) or space or paragraph return. Replace it with:

    $2 and the paragraph style (getting rid of the markers at the same time).

    Nothing has been found. I changed it to (\[indent\])([\w|\s|\r]+) (without the end marker [indent], to see what would happen) and now he found something - but stop at the first mark of punctuation (only reaching no not the end marker). So I tried to fill in punctuation: (\[indent\)] ([\w|\.|-, |: | \s|\r]+]) and each time more was found (by the way,------. here means a complete stop). If it works more or less.

    The problem is, is a technical manual and most equations etc are in the text that should be indented, so there are a lot of characters who are neither letter or number. And of course you can not call it a clean solution.

    It's the kind of string search and replace I would also use on many other projects. Does anyone know a better solution? Now, 'any character' doesn't seem to work, there at - it a code for "any character being not not a letter or number? Thanks in advance.

    Try (? s)(\[indent\]\r?) (.+?) (\[/indent\]\r?)

    The (? s) runs on single line mode so it can be found through several paragraphs and the (. +?) is the shortes match between the tags. I've included returns after the tags, if there has, based on your example that the tags are separate paragraphs. If they are at the end of the paragraph that you want to keep, remove the \r? to avoid losing the paragraph breaks.

  • Search for wildcard characters

    Hello

    Can we use the wildcard search in Berkeley Java Edition. The joker that interests me is to search a text field that begin with the specific prefix. For example, in SQL query can find all text that start with the prefix "XML", by specifying the lookup key to be "XML %". Can it be done in Berkeley I if I use a Direct persistence layer?
    Thank you

    Samir

    Samir,

    If you search the forum for 'DPL query', you will find the wire this query is possible using DPL? which is the same kind of question. In particular, if you read the white paper recommended (http://www.oracle.com/technology/products/berkeley-db/pdf/performing%20queries%20in%20oracle%20berkeley%20db%20java%20edition.pdf) you can see an example of the query, that you ask the subject.

    Kind regards

    Linda

  • Search for accented characters

    Hi all

    We have a column that has the focus. But when we do research we would like to use no accented characters.
    For example, when we type in "ALKARAKPEI", we get "ALKARAKPEI" and "ALKARAKPEI".

    ALKARAKPEI = > ALKARAKPEI
    DIKPOR = > DIKPOR

    Please give me some suggestions and ideal...

    Thanks in advance!

    Maybe

    SQL>  select *
      from (select 'ALKARAKPËI' str from dual)
     where convert (str, 'us7ascii') = 'ALKARAKPEI'
    /
    STR
    ----------
    ALKARAKPËI
    1 row selected.
    
  • Search for combining diacritical characters in Unicode

    Unicode allows to put accents different characters using diacritical signs. I'm learning Russian, and put accents on words makes a big difference. I use Alt-0769 (301 to hexacimal) to put in the combination acute accent marks, and I put these accents on any character. My problem is that I can't find any way to make Windows Search deal with these characters. In Unicode, a typical accented vowel will be represented by two Unicode characters. I need a way to get these characters in the search string. If I try to use Alt + 0769, the search box is a hollow box, but am not actually for her. Microsoft has a way to include Unicode characters less commonly used in search strings? Anyone found a way to search for words containing combining diacritics?

    Hello

    Please contact the Microsoft Community.

    I apologize for the delay in contacting you.

    I would have you post your query in TechNet.

    http://social.technet.Microsoft.com/forums/Windows/en-us/home?category=w7itpro

    We know you if you find a solution.

  • How can I search for characters with no applied font?

    I have a document with many Chinese mixed with the English. Unfortunately the conversion of the Word always remove part of the formatting of the characters. It's time consuming to manually find a square with a cross boxes, anyone knows a method to search for characters with no police?

    There seems to be no option in find/replace to choose no font / no as it does with the paragraph styles and character styles.

    See here http://www.kahrel.plus.com/indesign/missing_glyphs.html

    and here http://indesignsecrets.com/tackling-missing-glyphs.php

  • BY SPECIFYING THE NUMBER OF IDENTICAL CHARACTERS WHEN SEARCHING FOR A STRING

    Hey everybody,

    built-in indexOf() finds a character "." in the string "1.2.3." If value == 1.

    It looks nothing if the value == 0 or 2 or a number greater than 2.

    var txt:String = '1.2.3.';

    var: output string = String (this);


    If (txt.indexOf(".") == 1)

    {

    trace (output);     [object MainTimeline]

    }

    The must be a simple method to specify the number of characters "." When you search for the string "1.2.3.".

    For example, if there are 2 characters "." in the string "1.2.", then run it through a statement but if contains no 2 characters "." then do nothing.

    There is a built-in function called contains , but it is mainly used in XML.

    indexOf() resembles codes javascript unstable, one of these framework which unixers hatred.

    You don't have to use regular expressions to determine how many points is in the string. Use of split and read the length:

    var txt:String = '1.2.3.';

    trace (txt. Split("."). (length);

  • Search for several words in SQL

    I want to be able to search on multiple words in sql.  If someone entered in the field search for several words like "industry of corn for biofuels". I want to return all records that has one of these words in them.  Here is my code: (brings back only the sentence and not individual words in the database)

    and)
    path as < cfqueryparam cfsqltype = "cf_sql_varchar" value="%#arguments.searchterms#%" > "
    or
    the body as < cfqueryparam cfsqltype = "cf_sql_longvarchar' value="%#arguments.searchterms#% ">"
    or
    Summary as < cfqueryparam cfsqltype = "cf_sql_varchar" value="%#arguments.searchterms#%" > "
    or
    the author as < cfqueryparam cfsqltype = "cf_sql_varchar" value="%#arguments.searchterms#%" > "
    )

    something like this:

    Select somefields

    of sometables

    where 1 = 1

    and

    (

    or concat (Field1, Field2, etc.) like ' %#word #% ".

    or 1 = 2

    )

    Just to let you know, it will be slow.   Also, if one of these fields accept NULL values, you will have to deal with that.

  • Search for string in SQL Developer

    Hello

    I am trying to run a search function in SQL Developer, which locates a string in database objects. I can't find out how to do it-if it is possible. I just saw that I can search for objects not strings in their breast. How to find all the procedures/functions which includes a specific string?

    Concerning
    Marika

    Reports | All reports | DataDictionary reports | PL/SQL | Search the Source Code

  • Generic search for string

    PLEASE HELP ME...

    I HAVE A TABLE THAT IS

    WITH T AS

    (

    SELECT "MS 16 MM ARCHING HORN" DOUBLE NAME

    UNION ALL

    SELECT "MS 16 MM ARCHING HORN" DOUBLE NAME

    UNION ALL

    SELECT "EN-8 HEX LOCK NUT M20" DOUBLE NAME

    UNION ALL

    SELECT "EN-8 HEX LOCK NUT M20" DOUBLE NAME)

    SELECT * FROM T

    CASE 1->

    WHEN I SEARCH FOR "HORN ARCHING."

    SO I WANT TO OUTPUT LIKE

    OUTPUT-

    1-MS 16 MM ARCHING HORN

    THE 16 MM 2 MS ARCHING HORN

    CASE 2->

    WHEN I SEARCH FOR "NUT M20 LOCK,"

    SO I WANT TO OUTPUT LIKE

    OUTPUT-

    1 EN-8 M20 HEXAGONAL LOCKNUT

    2 EN-8 M20 HEXAGONAL LOCKNUT

    Hello

    Here's one way:

    VARIABLE target_words VARCHAR2 (50)
    EXEC: target_words: = 'HORN ARQUANT ';

    WITH all_targets AS
    (
    SELECT "%" | REGEXP_SUBSTR (: target_words)
    , '[^ ]+'
    1
    LEVEL
    )
    || '%' AS target
    , (MAX LEVEL) (AS target_cnt)
    OF the double
    CONNECTION OF REGEXP_SUBSTR (: target_words)
    , '[^ ]+'
    1
    LEVEL
    ) IS NOT NULL
    )
    SELECT DENSE_RANK () OVER (ORDER BY t.ROWID) n
    MIN (t.nom) AS the name
    T
    JOIN all_targets a ON ' ' | t.Nom
    || ' ' AS a.target
    GROUP BY t.ROWID
    HAVING COUNT (DISTINCT a.target) = MIN (a.target_cnt)
    ORDER BY n
    ;

    This assumes that the words in the target string are unique, that is, it will not be entered as "HORN HORN HORN".  It's not serious if the t.nom words are not unique; in other words, there is no problem if name = "MS 16 MM HORN ARCHING HORN HORN".

    It is not that there is something unique about each line in t.  If t is a real table, then it should really have a primary key, but, otherwise, it will automatically have a unique ROWID (which is what I assumed above).  If t is not a real table and lacks a unique key, you can use the ROW_NUMBER analytic to assign a unique number to each line.  If t is something unique for each line, yopu should use it instead of ROWID.

  • Using synonyms in the search for name

    Hello

    I try to use synonyms in an oracle namesearch. Set up a seqarch name as in the second example described in the developer's guide to the oracle text to http://download.oracle.com/docs/cd/E18283_01/text.112/e16594/search.htm application

    Now the name, for I am looking can hold one '&', for example 'B & V '.

    I would like to find this text when I enter "B & V", B & V' or 'B and V.

    I found a thread on how to set up a thesaurus with synonyms for '&' and 'and' to 'and' and ampersand or special characters

    Now I'm wondering how to combine this.

    Thanks for the help in advance,
    Dirk

    Your change was correct and it works. For reserved words in the braces enclosing aims to tell Oracle Text as text rather than apply the special meaning they have as reserved words. Since "und" is not a reserved word, it didn't need to be escaped by placing braces. When you set "&", then "und" synonymously as you did the search for 'B und V' correctly found "B and V, as in the modified below demo. In this particular case, the search might work without applying the format_string, but you need to keep it in the query so that it is applied to these values in need, for example, if you searched for "B & V' or 'B & V".

    SCOTT@orcl_11gR2> create table emp (
      2        first_name    varchar2(30),
      3        middle_name   varchar2(30),
      4        last_name     varchar2(30),
      5        email            varchar2(30),
      6        phone            varchar2(30));
    
    Table created.
    
    SCOTT@orcl_11gR2> -- added row of data:
    SCOTT@orcl_11gR2> set define off
    SCOTT@orcl_11gR2> insert into emp values
      2  ('Jane', 'Doe', 'B & V', '[email protected]', '321-654-0987');
    
    1 row created.
    
    SCOTT@orcl_11gR2>
    SCOTT@orcl_11gR2> create or replace procedure empuds_proc
      2       (rid in rowid, tlob in out nocopy clob) is
      3         tag varchar2(30);
      4         phone varchar2(30);
      5  begin
      6    for c1 in (select FIRST_NAME, MIDDLE_NAME, LAST_NAME, EMAIL, PHONE
      7              from emp
      8              where rowid = rid)
      9    loop
     10         tag :='';
     11         dbms_lob.writeappend(tlob, length(tag), tag);
     12         if (c1.EMAIL is not null) then
     13             dbms_lob.writeappend(tlob, length(c1.EMAIL), c1.EMAIL);
     14         end if;
     15         tag :='';
     16         dbms_lob.writeappend(tlob, length(tag), tag);
     17         tag :='';
     18         dbms_lob.writeappend(tlob, length(tag), tag);
     19         if (c1.PHONE is not null) then
     20           phone := nvl(REGEXP_SUBSTR(c1.PHONE, '\d\d\d\d($|\s)'), ' ');
     21           dbms_lob.writeappend(tlob, length(phone), phone);
     22         end if;
     23         tag :='';
     24         dbms_lob.writeappend(tlob, length(tag), tag);
     25         tag :='';
     26         dbms_lob.writeappend(tlob, length(tag), tag);
     27         if (c1.FIRST_NAME is not null) then
     28           dbms_lob.writeappend(tlob, length(c1.FIRST_NAME), c1.FIRST_NAME);
     29           dbms_lob.writeappend(tlob, length(' '), ' ');
     30         end if;
     31         if (c1.MIDDLE_NAME is not null) then
     32           dbms_lob.writeappend(tlob, length(c1.MIDDLE_NAME), c1.MIDDLE_NAME);
     33           dbms_lob.writeappend(tlob, length(' '), ' ');
     34         end if;
     35         if (c1.LAST_NAME is not null) then
     36           dbms_lob.writeappend(tlob, length(c1.LAST_NAME), c1.LAST_NAME);
     37         end if;
     38         tag :='';
     39         dbms_lob.writeappend(tlob, length(tag), tag);
     40       end loop;
     41    end;
     42  /
    
    Procedure created.
    
    SCOTT@orcl_11gR2> show errors
    No errors.
    SCOTT@orcl_11gR2> begin
      2    ctx_ddl.create_preference('empuds', 'user_datastore');
      3    ctx_ddl.set_attribute('empuds', 'procedure', 'empuds_proc');
      4    ctx_ddl.set_attribute('empuds', 'output_type', 'CLOB');
      5  end;
      6  /
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> begin
      2    ctx_ddl.create_section_group('namegroup', 'BASIC_SECTION_GROUP');
      3    ctx_ddl.add_ndata_section('namegroup', 'fullname', 'fullname');
      4    ctx_ddl.add_ndata_section('namegroup', 'phone', 'phone');
      5    ctx_ddl.add_ndata_section('namegroup', 'email', 'email');
      6  end;
      7  /
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> begin
      2    ctx_thes.create_thesaurus ('nicknames');
      3    ctx_thes.create_relation ('nicknames', 'John', 'syn', 'Jon');
      4  end;
      5  /
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2>
    SCOTT@orcl_11gR2> -- added synonyms to thesaurus:
    SCOTT@orcl_11gR2> begin
      2    ctx_thes.create_relation ('nicknames', '&', 'syn', 'and');
      3    ctx_thes.create_relation ('nicknames', '&', 'syn', 'und');
      4  end;
      5  /
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2>
    SCOTT@orcl_11gR2> begin
      2       ctx_ddl.create_preference('NDATA_WL', 'BASIC_WORDLIST');
      3       ctx_ddl.set_attribute('NDATA_WL', 'NDATA_ALTERNATE_SPELLING', 'FALSE');
      4       ctx_ddl.set_attribute('NDATA_WL', 'NDATA_BASE_LETTER', 'TRUE');
      5       ctx_ddl.set_attribute('NDATA_WL', 'NDATA_THESAURUS', 'NICKNAMES');
      6       ctx_ddl.set_attribute('NDATA_WL', 'NDATA_JOIN_PARTICLES',
      7        'de:di:la:da:el:del:qi:abd:los:la:dos:do:an:li:yi:yu:van:jon:un:sai:ben:al');
      8  end;
      9  /
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> create index name_idx on emp (first_name)
      2  indextype is ctxsys.context
      3  parameters
      4    ('datastore  empuds
      5        section    group namegroup
      6        wordlist   ndata_wl');
    
    Index created.
    
    SCOTT@orcl_11gR2>
    SCOTT@orcl_11gR2> -- added function to format search string:
    SCOTT@orcl_11gR2> create or replace function format_string
      2    (p_string in varchar2)
      3    return varchar2
      4  as
      5    v_string     varchar2 (32767) := ' ' || p_string || ' ';
      6  begin
      7    -- add extra spaces around ampersand:
      8    v_string := replace (v_string, '&', ' & ');
      9    -- remove duplciate spaces:
     10    while instr (v_string, '  ') > 0
     11    loop
     12        v_string := replace (v_string, '  ', ' ');
     13    end loop;
     14    -- add { and } around each reserved word:
     15    for r in
     16        (select keyword,
     17             ' ' || keyword || ' ' keyword2
     18         from      v$reserved_words)
     19    loop
     20        v_string := replace (upper (v_string), r.keyword2, ' {' || r.keyword || '} ');
     21    end loop;
     22    return ltrim (rtrim (v_string));
     23  end format_string;
     24  /
    
    Function created.
    
    SCOTT@orcl_11gR2> show errors
    No errors.
    SCOTT@orcl_11gR2> -- example of usage of function:
    SCOTT@orcl_11gR2> select format_string ('B und V') from dual;
    
    FORMAT_STRING('BUNDV')
    --------------------------------------------------------------------------------
    B UND V
    
    1 row selected.
    
    SCOTT@orcl_11gR2>
    SCOTT@orcl_11gR2> -- query modified to apply foramt_string function to :name variable:
    SCOTT@orcl_11gR2> var name varchar2(80);
    SCOTT@orcl_11gR2> exec :name := 'B und V'
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> column first_name  format a10
    SCOTT@orcl_11gR2> column middle_name format a11
    SCOTT@orcl_11gR2> column last_name   format a9
    SCOTT@orcl_11gR2> column phone          format a12
    SCOTT@orcl_11gR2> column email          format a22
    SCOTT@orcl_11gR2> select first_name, middle_name, last_name, phone, email, scr
      2  from   (select /*+ FIRST_ROWS */
      3                first_name, middle_name, last_name, phone, email, score(1) scr
      4            from   emp
      5            where  contains
      6                  (first_name,
      7                   'ndata (phone,'       || format_string (:name) || ') OR
      8                 ndata (email,'       || format_string (:name) || ') OR
      9                 ndata (fullname,' || format_string (:name) || ')',
     10                   1) > 0
     11            order  by score (1) desc)
     12  where  rownum <= 10;
    
    FIRST_NAME MIDDLE_NAME LAST_NAME PHONE        EMAIL                         SCR
    ---------- ----------- --------- ------------ ---------------------- ----------
    Jane       Doe         B & V     321-654-0987 [email protected]           97
    
    1 row selected.
    
    SCOTT@orcl_11gR2>
    
  • I want to search for messages, but the search box wants rather Google search!

    In Xubuntu 14.04 24.5.0 Thunderbird. Your help indicates that the research above the filter box will search for messages but mine happens only with a Google search on the web!

    When you type less than 3 characters in the search box, the option is to Google search. Less than 4 characters, the options are Google and the corresponding entries in the address book. Less than 5 and the options include "the Messages mentioning: asdf" and Google. For example, you must enter a string of at least 4 characters.

Maybe you are looking for

  • X 220 compatible msata ssd

    Hi guys,. I've already walked by boards and couldn't find an answer updated on this topic so I was wondering if someone could clarify if the range of SSD from Samsung Evo mSata would be compatible with the X 220. The only results I found which is cru

  • Cannot install SP1 11 DIAdem

    DIAdem.exe - Entry Point not found The procedure entry point diadataChannelValueTypeChangeExt could not be found in the DIAdata.dll dynamic link library

  • The display can be improved?

    1. number and product name HP Pavilion dv6 Notebook PC A5F76AV I have a screen of 15.6 "that supports 1366 X 768. I was recently browsing through HP Web site and found a dv6 notebook with 15.6 screen "diagonal full HD anti-glare LED backlit (1920 x 1

  • Games on W7 Pro

    How can I get Windows games (solitaire, Minesweeper, etc.) on Windows 7 Professional?  He was the only op system available on the computer and came up with no games.

  • Computer continuously tries to install Fax and Gallery of photos

    It fails and should try again, about four times before he finally STOPPED just after you press on cancel a bunch of times. How can I get rid of these programs?