Search function with multiple keywords

hi everybody,
im a beginner apex developer, im trying to develope a search function on my page.
i have created an item "where" where u can give the adress u r looking for.
my problem is that the search works only when i insert one word into the item e.g. street or city.
when i try to look for street and city at the same time it doesnt work.
in my database i have columns for city, street, zipcode... etc
and im using Application Express 3.1.2.00.02
this is my search code
select country, city,zipcode, street
from mytable
where
+( lower(city) like '%' || lower(trim(:P1_WHERE)) || '%'+
OR lower(zipcode) like '%' || lower(trim(:P1_WHERE)) || '%'
OR lower(street) like '%' || lower(trim(:P1_WHERE)) ||  '%'
OR lower(country) like '%' || lower(trim(:P1_WHERE)) || '%')
i have tried to solve the problem by adding combination after OR:
lower(concat(trim(city) like '%' ||  lower(replace(:P1_WHERE,' ','')) || '%'||,trim(zipcode) like '%' ||  lower(replace(:P1_WHERE,' ','')) || '%'||))
but this is not working. and i will have too many combinations.
any help is highly appreciated!
Edited by: user12976392 on 14-Jun-2010 07:08

Oracle don't provide any SPLIT() function, I don't know why.
But you can use INSTR() and SUBSTR() functions instead.
There are some split functions on the web, like this one for example (don't really split but get tokens) : http://glosoli.blogspot.com/2006/07/oracle-plsql-function-to-split-strings.html.
Then you can loop to get all the tokens (here I used the ' ' separator) :
DECLARE
      oneToken VARCHAR2(100) ;
      cpt INTEGER := 1;
BEGIN
      LOOP
      oneToken := get_token(html_GetElement(P1_WHERE).value, cpt , ' ') ;
      EXIT WHEN oneToken IS NULL ;
      cpt := cpt + 1 ;
    END LOOP ;
END ;Using this you can build your query as string, then open a cursor to run it, using :
open my_cursor for my_string;I really don't know if it's the best way to do this, it's just an idea.

Similar Messages

  • FileNotFoundException with multiple keywords

    With multiple keywords 'pi_keyword=account and manager', my program generates: java.io.FileNotFoundException.......sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:702). But the url works fine in IE address box. In addition, if only single keyword
    'pi_keyword=account ', my program works no problem. Any solution? Thanks.
    The following is my program:
    URL url = new URL(str);
    URLConnection connection = (URLConnection) url.openConnection();
    connection.setDoOutput(true);
    BufferedReader in = new BufferedReader(
    new InputStreamReader(connection.getInputStream()));
    The fullurl is:
    http://jobs.workopolis.com/jobshome/db/work.process_job?pi_post_date=&pi_smart=N&pi_sort_col=&pi_employer=Dummy&pi_advertiser=Dummy&pi_category=Dummy&pi_industry=Dummy&pi_msg=LOCATION&pi_language=EN&pi_keyword=manager and account&pi_location=British Columbia

    I think whitespace isn't allowed in the keyword values, what do you get if you replace space with '+'?
    That is: "pi_keyword=account+and+manager" and "pi_location=British+Columbia"

  • Search for photos with multiple keywords

    I'm trying to figure out if it's possible to search for photos that have multiple keywords.   When selecting multiple keywords in a Bridge search the default behavior is to find photos that have any of the keywords rather than all of the keyword.  In other words I want to do an AND keyboard rather than an OR search.

    You should be able to do so in the find menu of Bridge (Edit/Find or cmd+F)
    With the plus sign you can add an extra (and) keyword to it.
    A shortcut may be to first find one keyword and then use the filter panel
    keyword section and select the other wished keywords by putting a checkmark
    in front, only the selected files will show in the content window.
    In other words I want to do an AND keyboard rather than an OR search.

  • Can I filter clips with multiple keywords?

    Hi,
    I have ingested hundreds of video clips into Prelude CC and at some point I want to filter these using multiple keywords. Entering one keyword only is going fine but as soon as I enter a second keyword, and I reassured that there are clips containing both of them, I end up with zero results. If multiple keywords are at all possible then, how do I have to enter them, separate them? Are Boolean searches possible?
    Thank you for your response.

    Hi -
    Thanks for your interest and support for enhanced searching methods in Prelude. We're excited to bring those to you. Unfortunately we are not permitted to discuss timeframes for features still under consideration and not yet assigned to an official release. We will certainly share this information as soon as we are able.
    Regards,
    Michael

  • People Picker search order with multiple forest domains

    I had customer with multiple forest domain environment. Now the problem is that all users from one domain synced to the resource domain(Domain A) where sharepoint is installed.
    The peoplepicker is now finding at first the user in Domain A where sharepoint is installed. My Solution is now to specify the order of searching in People Picker that first all users in Domain B will return and if there is noting will return Domain A.
    All SharePoint Server(s) had Network Access to the other Domains. And there are two-way-trust konfigured.
    Any Solution for that?
    Thanks for your feedback!
    P.

    Regardless of search order, you would get both results returned. Have you tried using the UserAccountDirectoryPath property on the Site Collection to specify DC=domainB,DC=com?
    Trevor Seward
    Follow or contact me at...
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.
    Nice to now that i can set it up per site collection. But it do not work in my case, it indeed returned users from Domain B but Domain A, C, D and F(Examples) are excluded from People Picker.

  • Searching images having multiple keywords

    When searching for images having multiple keywords, how do i search for one keyword and exclude others. For example an image has keywords "adults, pub" "how do I ask for "adults but not adults in a pub?

    Use a smart collection:
    See how you go!
    Tony Jay

  • Smart folder with multiple keywords?

    Is it possible to set up a smart folder to filter on more than one keyword assigned to an image? I'd like to set up a smart folder that will find images that have 2 specific keywords. I've searched, and wrestled with it every which way, but haven't landed on the solution.
    For example:
    Img_001 has keywords of "Animal" and "Vegetable"
    Img_002 has keywords of "Animal", "Vegetable" and "Mineral"
    Img_003 has keywords of "Animal" and "Mineral"
    Img_004 has keywords of "Vegetable" and "Mineral"
    I'd like my "Animal and Vegitable" smart folder to find Img_001, and Img_002 only.
    Thanks for any ideas,
    Guy

    Guy,
    Yes, you can do that. You would enter these criteria:
    "Keyword is Animal." +
    "Keyword is Vegetable."
    When you enter the second condition, an additional menu appears above them. You need to set it to:
    "Match all of the following conditions."
    That will give you only photos which are tagged with both keywords.
    FYI, you can do something similar with the keywords pane. In Preferences, Keywords, you can set iPhoto to filter based on any keyword or based on all keywords. With it set to match all keywords when filtering, clicking on your "Animal" and "Vegetable" keywords will give you only photos which contain both. The cool thing about this method is that you can Option-click a keyword to exclude it from the filter. So if you didn't want photos containing "Animal," "Vegetable," and "Protozoa," you could exclude "Protozoa" from the filter. Of course, this is done in real time, and doesn't create a self-updating Smart Album. But it's a fun trick for seeing what you have very quickly.
    Regards

  • Search function with Java script

    Hi, i'm using ADF 11g . In one of the application page , i need to give a search function , in which user can enter any text , the entered text needs to be highlighted . Since ADF is very new to me , could some one point me how to use the javascript API to do this. Thanks.

    Thanks for your response Shay.
    The function should be like the find function in (Ctl-F) in Firefox browser. (In IE the find function finds only the node of the xml not the value of the node displayed in outputText Component. )
    The page displays a xml file in a tree structure. The value of a node is displayed in the output text component.
    The requirement is , a search field will be given at the bottom of the page, where user can enter any text and the function should find and highlight the matching Node as well as values. If user hits the button again, the function should highlights the next match.
    You mentioned i can use a backing bean to find and highlight the words. does it mean i no need to use the javascript API. Could you point me some docs or any demo piece. Thanks again.

  • Robohelp 9 search: heavier weight with multiple keywords?

    We are working with the new search engine (moved from 7 to 9) and are having some issues with the way that our users are used to searching.  One thing was came up was the question of whether a single keyword added multiple times to a topic would bring it a higher weight in the Robohelp 9 search ranking.  Does anyone know if it will disregard multiple instances of the same word in the Keywords in the Topic Properties or if we can use that to stack the deck?

    Hi there
    One way to "stack the deck" so to speak is to ensure the keyword is used in the Topic Title. Aside from that, ensure it is also used in the Keywords field of the topic as well as in heading levels. For example, a keyword in a Heading 3 will be trumped by the same keyword in a Heading 1. And that is trumped by the keyword in the Topic Title.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7, 8 or 9 within the day!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

  • Search help with multiple key fields

    Hi,
    I want to dispaly search help on a field from a internal table have multiple key fields i.e combination of fld1 + fld2 +fld3 makes one single row. Therfore can any one tell me how to return that single row , because if I am using function F4IF_INT_TABLE_VALUE_REQUEST I get only one return field that I select by which I can't get the actual line that I have selected as there may be more that one line for that field.
    please suggest any way through programming not by creating any search help through se11.
    thanks

    Hi,
    Use select query to select the fields & display them.
    In the following code i've selected only a single field in select query but u can do it for more than 1 & proceed similarly.i've tried it before using this code.
    SELECT WERKS
             NAME1
             FROM T001W
             INTO TABLE ITEMP
             WHERE IWERK = 'M011'.
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                  DDIC_STRUCTURE   = ' '
                RETFIELD         = 'WERKS'
                  PVALKEY          = ' '
                  DYNPPROG         = ' '
                  DYNPNR           = ' '
                  DYNPROFIELD      = ' '
                  STEPL            = 0
                  WINDOW_TITLE     =
                  VALUE            = ' '
               VALUE_ORG        = 'S'
                  MULTIPLE_CHOICE  = ' '
                  DISPLAY          = ' '
                  CALLBACK_PROGRAM = ' '
                  CALLBACK_FORM    = ' '
           TABLES
                VALUE_TAB        = ITEMP
                  FIELD_TAB        =
               RETURN_TAB       = T_RETURN
                  DYNPFLD_MAPPING  =
             EXCEPTIONS
                  PARAMETER_ERROR  = 1
                  NO_VALUES_FOUND  = 2
                  OTHERS           = 3
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      S_WERK-LOW = T_RETURN-FIELDVAL.
    Hope this helps.
    Reward if helpful.
    Regards,
    Sipra

  • How to search data with multiple parameters =SESSION

    Dear Günter Schenk
    Please help
    I have two Tables with many fields
    1.       tbl_users
    2.       tbl_transection
    Now problem is that I want when user login he make search in " tbl_usr_transection " related its own Transactions other then he view all user data
    I have one column about user in transaction table i.e. "fld_transection_by"
    I am using SESSION to filter all transaction its related user and its working fine.
    <?php echo $_SESSION['login_id']; ?>=<?php echo $row_rstbl_transections[' fld_transection_by ']; ?>
    Now how to make search from filter rows in many field
    Please explain in detail
    Thanks in Advance

    Hi, It sounds like you need to carry those variables into your mySQL statement.

  • Using "Save as" functionality with multiple dataproviders

    Is there a way to use the <bi:SAVE_AS> command in a web template to save multiple dataproviders in a single analysis in BEx Portfolio? When I don't specify a dataprovider the command doesn't function.
    Thanks,
    Jason

    pod0 --
    At the top of your screen for this page,
    you will see that you have a "Solved" rating available.
    Perhaps you don't know what that means, as it is a new system here.
    It seems to be that CyberTaz did actually "Solve" your problem.
    By using the Rating System provided by Apple,
    you will be actively encouraging finding solutions
    and helpful responses throughout these boards.

  • Select statement inside function with  into keyword

    Hi Everyone,
    i have a function which contains a select statement
    create or replace
    function fun_1(Table_Name1 in varchar2)
    RETURN VARCHAR2
    is
    VAR_GEN_TYPE NUMBER(10);
    TA_U varchar2(256);
    VAR_DATA_FLAG varchar2(1);
    begin
    select T.FLAG into VAR_GEN_TYPE ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG  from T_DYNAMIC_TABLE T  where T.TABLE_NAME=TABLE_NAME1;
    end
    whene ever i am executing this function giving error message: From Keyword  Not Found
    when i change select statement to
    select T.FLAG ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG, VAR_GEN_TYPE from T_DYNAMIC_TABLE T where T.TABLE_NAME=TABLE_NAME1;
    then it is working
    why first statements will not work ?
    i.e.,
    select T.FLAG into VAR_GEN_TYPE ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG from T_DYNAMIC_TABLE T where T.TABLE_NAME=TABLE_NAME1;
    why in select statement we cannot use into keyword more than one time ?
    Edited by: karteek on Jun 7, 2012 4:23 AM
    Edited by: karteek on Jun 7, 2012 4:24 AM

    select T.FLAG into VAR_GEN_TYPE ,T.DATA_UID_GEN_TYPE into VAR_DATA_FLAG, from T_DYNAMIC_TABLE T where T.TABLE_NAME=TABLE_NAME1;
    into should be only once..
    the syntax should be
    select <column list>
    into
    <variable list>
    from <table name> where <condition>
    --This query shuold return only one row.
    column list count and variable list count should match
    there should be no comma after last variable.andbefore from.

  • Importing function with multiple ref cursors in Stored Procedure of Oracle 12c database Using EF6

    Hi Good day!
    I can able to import function for stored procedure of oracle db and able to add the complex type and get the output but i tried to import the procedure which having two ref cursors and unable to retrieve the column information. Only able to retrieve the
    columns of first ref cursor.  Please help me to get the result of two ref cursors which acting as out parameters.

    Having to ref cursors return mutiple recordsets in an Oracle package is like haveng two resultsets return from a MS SQL Server sparc.
    The link may point you in the right direction.
    http://www.codeproject.com/Articles/675933/Returning-Multiple-Result-Sets-from-an-Entity-Fram

  • Ago Function with multiple Facts

    Hi,
    I have two fact tables that are coneccted to the same time dimension. One of this fact has a column that uses the AGO function. In Answers when I select the column with the function and any other from the other fact, I get the following error:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 14026] Unable to navigate requested expression: Ago(VAL_PUBLICIDADE:[DAggr(F_PUBLICIDADE_MENSAL.VAL_PUBLICIDADE by [ D_CANAL.COD_CANAL, D_CANAL.NOME_CANAL, D_TEMPO_MES.Mes, D_TEMPO_MES.Ano, F_PUBLICIDADE_OBJECTIVOS.VALOR_BRUTO_OBJECTIVO] )], [Level Ano], 1). Please fix the metadata consistency warnings. (HY000)
    The metadata is consistent, there are no errors on the Administrator... Is it possible to do?

    Hi,
    The problem is that I only know the offset values at row level, i.e., when I run my answer report some records use a certain offset value (offset1) while others use another offset value (offset2)
    The offset value can be determinate by a logical column.
    Is it possible?
    Thanks.

Maybe you are looking for