DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: parameter to where clause

  1. #1
    Join Date
    May 2002
    Posts
    5

    Question

    I am trying to create a simple form that has a Text Item to accept a "Company Name" (varchar2) and a Push Button to fire a Trigger.

    I would like my Trigger to query my database and return all records containing the "Company Name" in the appropriate column.

    Here is my Trigger code: (FYI: my Block is called search)


    DECLARE

    query_name ia_entity_search.company_name%TYPE;

    CURSOR search_name_cur (comp_name ia_entity_search.company_name%TYPE) IS
    SELECT company_code, company_name, search_names
    FROM ia_entity_search
    WHERE ia_entity_search.company_name LIKE comp_name;

    BEGIN

    -- I've tried building query_name multiple ways...
    -- query_name := ' '' ' || :search.company_name || '%' || ' '' ';
    query_name := chr(39) || :search.company_name || '%' || chr(39);

    FOR curr_search_name IN search_name_cur(query_name) LOOP
    MESSAGE('company name: ' || curr_search_name.company_name);
    END LOOP;

    END;


    I believe that this never enters my CURSOR loop because of my WHERE clause. I believe this has something to do with the way I am handling my varchar2 (comp_name).

    Any suggestions?

    The version of Forms I am using is:
    Forms [32 Bit] Version 4.5.7.1.6 (Production)

    Thank you.

  2. #2
    Join Date
    Jul 2002
    Posts
    9

    Question

    Try this,

    Replace
    query_name := chr(39) || :search.company_name || '%' || chr(39);

    to
    query_name := :search.company_name || '%';


  3. #3
    Join Date
    Nov 2000
    Location
    greenwich.ct.us
    Posts
    9,092
    Originally posted by silasmw
    Replace
    query_name := chr(39) || :search.company_name || '%' || chr(39);

    to
    query_name := :search.company_name || '%';

    Bravo!

    Jeff Hunter

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width