Wild card searching in sql squery (pl/sql function body returning......)

Hi,
I've a report based on a sql query (pl/sql function body returnin a sql query).
One of the statements is
select .. from ...
where name_of_person = :P17_NAAM
I like to built a wild card possibility (with like '%l%m%') to show all persons with in their name an l, and an m (after the l)
how to modify this statement?
any reaction will be appreciated.
Leo

Leo,
If I understand you correctly, you want to let the user type the value without wild cards, and than to add them programmatically. If that's the case, here is what you can do:
1. Create a new item, say P17_HIDDEN_NAAM, that will contain the actual search criteria
2. Modify your pl/sql to:
begin
  :p17_hidden_naam := null;
  for l_i in 1..length(:P17_NAAM)
  loop
    :p17_hidden_naam := :p17_hidden_naam || '%' || substr(:P17_NAAM, l_i, 1);
  end loop;
  :p17_hidden_naam := :p17_hidden_naam || '%';
  return
    'select ..
       from ...
      where name_of_person like :p17_hidden_naam';
end;By the way, I think that it's much better to train your users to use wild cards than to do it in the program.
Sima

Similar Messages

  • Wild card search in existsNode function

    Hi,
    How can i do a wild card search for the below data?
    I have a table as follows:
    ID VARCHAR2(32 BYTE),
    MESSAGE_TYPE VARCHAR2(64 BYTE),
    MESSAGE_CONTENT XMLTYPE,
    REJECTED_REASON VARCHAR2(256 BYTE)
    And Sample XML as:
    <?xml version="1.0" encoding="US-ASCII"?>
    <MessageEnvelope>
    <Header>
    <Partner>Renault</Partner>
    <MessageType>Release</MessageType>
    <PartnerMessageType>S74</PartnerMessageType>
    <MessageTime>2001-12-17T09:30:47.0Z</MessageTime>
    <LinkToRawMessage>String</LinkToRawMessage>
    </Header>
    <Body>
    <Release>
    <Addresses>
    <DealerDestAddr>ABCD</DealerDestAddr>
    <DestAddr>ABCD</DestAddr>
    <NextDestAddr/>
    <StartAddr/>
    </Addresses>
    <Assignment/>
    <ClientStatus/>
    <Dates/>
    <HoldInfo>
    <HoldCode>HoldTest</HoldCode>
    </HoldInfo>
    <Message/>
    <Partner>
    <OrderGiverCode>CMR00BCV</OrderGiverCode>
    </Partner>
    <ToDo/>
    <Transport/>
    <Vehicle>
    <VIN>W0LGDM9A_Ran11115</VIN>
    </Vehicle>
    </Release>
    </Body>
    </MessageEnvelope>
    I am executing the foll query:
    select * from t_xml x where x.message_type='DBLVEH' and x.MESSAGE_CONTENT.existsNode('//*[*="Release"]')=1;
    This gives me correct result.
    But i need to search *Rel and it should give me the desired result. How can i accomplish that?
    I tried the foll and it did not work:
    select * from t_xml x where x.message_type='DBLVEH' and x.MESSAGE_CONTENT.existsNode('//*[contains(*,"Re")]')=1;
    Regards,
    Sprightee

    sprightee wrote:
    Hi,
    How can i do a wild card search for the below data?I am not sure how this can be achieved using existsNode function but does following work for you?
    SELECT *
      FROM t_xml
      WHERE
        XMLExists(
          'declare namespace ora = "http://xmlns.oracle.com/xdb"; (: :)
           $d//*
             [ora:matches(text(), "Re*")]'
          PASSING MESSAGE_CONTENT AS "d");

  • Wild card search in a FM

    Hi experts,
    I have a FM in which there is one table customer_name
    It has fields as SIGN (type SIGN), OPTION (type OPTION), LOW (type name1_gp), HIGH (type name1_gp).
    Now the user can give single value, or a range of values for the customer name.
    I am familiar with the wild card search for a select option, but not sure how to apply that funda here.
    For ex: If a customer enters the customer name as MG*, then all the names starting with MG should appear
    in the output.
    Similarly, if the user enters AP* in LOW and MG* in high, the corresponding output should be displayed.
    Can you please help me out?
    Thanks,
    Ajay.

    Hi,
    Do like this
    t_table-sign = 'I'.
    t_table-option = 'CP'.
    t_table-low = 'AB*'.
    t_table-high = 'MG*'.
    append t_table.
    Use this in your select query.

  • Case Sensitive problem in Select Option for wild card search

    Hi,
         Can anyone please let me know how to make the wild card search in any select-option non case-sensitive. What I mean by this is for eg. we want to find out all the POs with short text containing the word  'process', what we do we populate a range with OPTION = 'CP' and LOW = 'process' and select EKPO with short text in this range. This select is however case-sensitive and POs with short text containing 'Process' is not retrieved. But my requirement is that this should be non case-sensitive and both the POs should be in the result set.

    Hi,
    Hope this helps you
    CS:
    You can select characters in operand2 for a direct comparison by adding the escape symbol "#" before the required characters. For these characters, upper/lower case is taken into account, wildcard characters and the escape symbol itself do not receive special treatment, and trailing blanks in operands of type c are not cut off.
    Covers Pattern: True, if the content of operand1 fits the pattern in operand2. Wildcard characters can be used for forming the operand pattern, where "" represents any character string, and "+" represents any character. Upper/lower case is not taken into account. If the comparison is true, sy-fdpos contains the offset of operand2 in operand1, whereby leading wildcard characters "" in operand2 are ignored if operand2 also contains other characters. If the comparison is false, sy-fdpos contains the length of operand1.
    Regards
    Krishna

  • Regarding wild card search in oralce

    I am facing one problem,
    I am using wild card search based on LIKE condition, that search is got used for searching purpose through a user interface.
    the query is like below
    SELECT /*+driving_site(a)*/ A.ID,A.CO_ID,B.NAME,A.CITY,A.state FROM mv1 a,mv2 b WHERE a.id=b.id and nvl(b.name,'x') like '<variable>%' and nvl(a.city,'x') like'<variable>%'  and a.state like'%' ;
    where user can input any one or may two or three parameters for search.
    The problem is in response time because mv1 and mv2(materialized view) contains crores of records(around 3.5 crore )
    I am able to search it with city and state but when I am trying by name I am not not getting response for that query.
    Each where clause is indexed propely even functional index i put there and analyzed also , by explain plan i am able to reduce the cost but im not able to get proper response. I welcome all your suggestions as this is reallly a crucial for me to get that search faster....
    Thanks in Advance
    Edited by: user13104802 on Jul 31, 2010 6:31 AM
    Edited by: user13104802 on Jul 31, 2010 6:31 AM
    Edited by: user13104802 on Jul 31, 2010 6:33 AM

    I welcome all your suggestions as this is reallly a crucial for me to get that search faster....You might want to explore Oracle Text (Index).
    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:415419367128
    http://www.oracle-base.com/articles/9i/FullTextIndexingUsingOracleText9i.php
    What is your database version? (the result of: select * from v$version; )
    That'll determine what other pointers we can give you.

  • Wild card search using %

    I have a question on wild card searches. I am currently doing a like behind the scenes to look for a string inside a string...
    However, if the user wants to put in a wild card like 'AP%Report%'... I would like to return all the ones that begin with AP and have Report in them- is that possible using APEX? I currently do not get any records as the % is considered literally. As our users are used to Oracle, we will have users who will key in a % during the search and we need this to work!
    Can anyone please help me with this?
    Thanks!
    Ramya

    Thanks for your quick response, Tony!
    Its a standard report not interactive... version is 'Application Express 4.0.2.00.07'
    Below is the complete query,
    select * from (
    select report_id
    , (SELECT report_type_name FROM xxnf.xxnf_apex_rr_report_types t WHERE t.report_type_id = xxnfarr.report_type_id) report_type
    , Category
    , report_name
    , report_desc
    , image Sample
    , last_used
    , link
    , sample_url
    , decode(sample_url, NULL, 'http://common.newfield.com/images/misc/blank.gif','http://common.newfield.com/images/misc/Sample.gif') sample_icon
    , (select resp_group_name FROM xxnf.xxnf_apex_rr_resp_groups t WHERE t.resp_group_id = xxnfarr.resp_group_id) contact
    from
    xxnf.XXNF_APEX_RR_REPORTS xxnfarr)
    where (
    instr(upper("REPORT_TYPE"),upper(nvl(:P11_REPORT_SEARCH,"REPORT_TYPE"))) > 0 or
    instr(upper("REPORT_NAME"),upper(nvl(:P11_REPORT_SEARCH,"REPORT_NAME"))) > 0 or
    instr(upper("REPORT_DESC"),upper(nvl(:P11_REPORT_SEARCH,"REPORT_DESC"))) > 0
    or
    instr(upper("CATEGORY"),upper(nvl(:P11_REPORT_SEARCH,"CATEGORY"))) > 0
    Hope I answered all your questions.. On why I am doing this instead of a LIKE.. I could not get it working with a LIKE and had to pull this code from one of the sample applications... Hope that makes sense!
    Ramya

  • Wild card search and multiselection in dashboard prompt????

    Hi all:
    Actually, I want to make dashboard prompt that filters the customer code, user can select more than one code at a time. But there is one more requiremnet that is, If user wants to find customer code in report than it just write the code or part of code ("like wild card search"). I want these two works in one dashboard prompt. If there any possiblity to do like this. Please help me to create this type of dashboard prompt. Thanks
    Ali

    Hi Ajith,
    István is correct, wild card '*' is readily available for any Item name, BP name or other searchable fields.
    Thanks,
    Gordon

  • Wild card search enabling in ABAP QUERIES

    Hi All
    How is it possible to enable <b>wild card search</b> for the <b>selection-fields</b> of <b>ABAP Queries</b>, any help in this regard will be credited
    Thanks
    Sudhir.

    Are you asking about wild card search in SELECT statements?
    The following is the help on wild card search in SELECT statements
    ... WHERE CITY LIKE '%town%'.
    This condition is true if the column CITY contains a string containing the pattern ‘town’.
    ... WHERE NAME NOT LIKE '_n%'.
    This condition is true if the column NAME contains a value whose second character is not ‘n’.
    ... WHERE FUNCNAME LIKE 'EDIT#_%' ESCAPE '#'.
    This condition is true if the contents of the column FUNCNAME begin with EDIT_.

  • EIC: Employee search - wild card search with personnel number

    Hi,
    The employee search functionality in EIC employee-search screen allows to search an employee through wild card search. We had set up this and everything was working fine, but suddenly the functionality to search an employee by giving part of personnel number as wild card search is not working, surprisingly other search criteria are listing employee list. For example, if i need to search an employee with personnel no 30000111, then i can give 30* in search criteria and employees starting with 30XXXXXX would be listed. This is the functionality not working at the moment.
    Can anybody please help - what could be the probable cause or where should i look to fix this? Any documentation in this regard would really be helpful.
    Thanks in advance.
    Sujit

    hi,
    Probably u can set a debug point in the bsp application and ask your abaper to debug the same.
    check if any patch application has been done after you saw the functionality working fine.
    Regards
    Sameer

  • Wild card search option

    Is the Wild card search option availble in flex.

    "lalithninan" <[email protected]> wrote in
    message
    news:g6ubfe$sdd$[email protected]..
    > Is the Wild card search option availble in flex.
    Look at regular expressions

  • Wild card searches

    I have created a form that searches a table based on radials drop downs and text boxes, works ok. However the text box is used where there are too many options to be used by other methods.
    Is there any way to automatically place a hidden % wild card at the front and end of the text box? I'm trying to permit users to be able to enter a part of a name in order to search for records.
    Kinda like
    record is The Ramones
    User can type in Ramon and it will still return all records that has Ramon within its title

    Scott,
    I have a related question on wild card searches. I am currently doing a like behind the scenes as you have suggested.
    However, if the user wants to put in a wild card like 'Sc%t%'... I would like to return Scott - is that possible using APEX? I currently do not get any records as the % is considered literally.
    Can anyone please help me with this?
    Thanks!
    Ramya

  • Pl/sql function body returning SQL query - Print function

    Hello all,
    I have pl/sql function body returning SQL query for my reports for my new project that I am developing. We dont have any BI tool or anything for APEX so we use Oracle reports to get the same reports to be printed in PDF format. I had been using SQL function for Reports all these days and grabbing the data using SQL query was easy in Oracle reports. But this time we had atleast 8 fields in search criteria and hence I thouhgt PL/sql function body returning SQL query could be something easy to handle that scenario. We have 11 such reports in our project. Now when we tried to use the same PL/sql function to oracle reports , I was told by one of our Oracle reports expert, that we have to write it into functions and use it in SQL query to get the Reports in Oracle reports. Is there any Easy way to convert the same Pl/SQL function or get a PDF format of the same report in APEX without going thru the much pains of rewriting the whole SQL Query.
    thank you
    Devisri

    Hi,
    give this a go.
    I can't test it as I don't have the tables in my schema.
    create or replace package MK_TEST_PF is
    -- Author  : MK
    -- Created : 21/06/2010 16:30:19
    -- Purpose : FOR LUCY_DISCOVER
    -- Public type declarations
    /*     -- just guess the table row types.....
         -- otherwise it won't compile
         type test_rec is record
              (INV REP.inv%type
              ,cNUMBER REP.cNUMBER%type
              ,OPENDATE REP.OPENDATE%type
              ,TARGETDATE REP.ESTCOMPLETE%type
              ,DATECLOSED REP.COMPLETED%type
              ,STATUS REP.STATUS%type
              ,cCODE REP.cCODE%type
              ,line varchar2(4000)
              ,SIGc varchar2(4000)
              ,CLASS REP.CLASS%type
              ,SUMM REP.SUMM%type
              ,AREA REP.AREA%type
         type test_rec is record
              (INV varchar2(4000)
              ,cNUMBER varchar2(4000)
              ,OPENDATE varchar2(4000)
              ,TARGETDATE varchar2(4000)
              ,DATECLOSED varchar2(4000)
              ,STATUS varchar2(4000)
              ,cCODE varchar2(4000)
              ,line varchar2(4000)
              ,SIGc varchar2(4000)
              ,CLASS varchar2(4000)
              ,SUMM varchar2(4000)
              ,AREA varchar2(4000)
         type test_tab is table of test_rec;
    -- Public constant declarations
    -- Public variable declarations
    -- Public function and procedure declarations
    end MK_TEST_PF;
    create or replace package body MK_TEST_PF is
    -- Private type declarations
    -- Private constant declarations
    -- Private variable declarations
    -- Function and procedure implementations
         function get_query_f
              (p_inv VARCHAR2 := UPPER(v('P44_INV'))
              ,p_reg VARCHAR2 := UPPER(v('P44_CLASS'))
              ,p_proarea VARCHAR2 := UPPER(v('P44_PROGRAM_AREA'))
              ,p_disp VARCHAR2 := UPPER(v('P44_DISPOSITION'))
              ,p_coding VARCHAR2 := UPPER(v('P44_CODING'))
              ,p_status VARCHAR2 := UPPER(v('P44_STATUS'))
              ,p_SIG VARCHAR2 := UPPER(v('P44_SIG_c'))
              ,p_inc_sum VARCHAR2 := UPPER(v('P44_INCLUDE_SUMM_FIELD'))
              ,p_word VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_timeframe VARCHAR2 := UPPER(v('P44_TIME_FRAME'))
              ,p_rec VARCHAR2 := UPPER(v('P44_RECORD_KEEPING'))
              ,p_WORD_IN_SUMM VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_ON_AFTER VARCHAR2 := UPPER(v('P44_ON_AFTER'))
              ,p_ON_BEFORE VARCHAR2 := UPPER(v('P44_ON_BEFORE'))
              return varchar2
         is
              v_sql VARCHAR2(5000);
         --     v_inv VARCHAR2(100);
         --     v_reg VARCHAR2(100);
         --     v_proarea VARCHAR2(100);
         --     v_status VARCHAR2(100);
         --     v_SIG VARCHAR2(100);
         --     v_disp VARCHAR2(100);
         --     v_coding VARCHAR2(100);
         --     v_inc_sum VARCHAR2(4);
         --     v_word VARCHAR2(4000);
              v_wildcard VARCHAR2(2000);
         --     v_timeframe VARCHAR2(100);
         --     v_rec VARCHAR2(5);
              v_record VARCHAR2(5);
              v_open VARCHAR2(100);
              v_closed VARCHAR2(100);
              v_PEND VARCHAR2(100);
              v_refSIG VARCHAR2(100);
              v_refreg VARCHAR2(100);
              v_refother VARCHAR2(100);
              v_y varchar2(100);
         BEGIN
              --v_inv := UPPER(v('P44_INV')) ;
              v_record := 'R%';
              v_wildcard := '%';
              v_open := 'OPEN';
              v_closed := 'CLOSED';
              v_PEND := 'PEND';
              v_refSIG := 'REF - SIG';
              v_refreg := 'REF - CLASS';
              v_refother := 'REF - OTHER';
              v_y := 'Y';
              v_sql := 'SELECT REP.INV as INV, REP.cNUMBER as cNUMBER, REP.OPENDATE as OPENDATE,
              REP.ESTCOMPLETE as TARGETDATE, REP.COMPLETED as DATECLOSED, REP.STATUS as STATUS,
              REP.cCODE as cCODE, apex_item.checkbox(1,REP.line,null,'''||v_y||''') line , apex_item.checkbox(1,REP.SIG,null,'''||v_y||''') SIGc ,
              REP.CLASS as CLASS, REP.SUMM as SUMM, REP.AREA as AREA from REP where 1=1';
              IF p_rec is not null then
                   IF p_rec = 'E' then
                        v_sql := v_sql|| ' and upper(REP.cnumber) not like '''||v_record||'''';
                   ELSIF p_rec = 'D' then
                        v_sql := v_sql|| ' and upper(REP.cnumber) like '''||v_record||'''';
                   ELSIF p_rec = 'I' then
                        v_sql := v_sql|| ' and REP.cnumber = REP.cnumber ';
                   end if ;
              end if ;
              IF upper(p_status) not like '%NULL%' then
                   IF upper(p_status) like '%OPEN%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_open||'''';
                   ELSIF upper(p_status) like '%CLOSED%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_closed||'''';
                   ELSIF upper(v_PEND) like '%PEND%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_PEND||'''';
                   ELSIF upper(v_refSIG) like '%REF - SIG%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_refSIG||'''';
                   ELSIF upper(v_refreg) like '%REF - CLASS%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_refreg||'''';
                   ELSIF upper(v_refother) like '%REF - OTHER%' then
                   v_sql := v_sql||' AND upper(REP.status) like '''||v_refother||'''';
                   END IF ;
              END IF ;
              IF p_inv = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.INV),'''||p_inv||''') > 0';
              END IF ;
              IF p_reg = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.CLASS),'''||p_reg||''') > 0';
              END IF ;
              IF p_proarea = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.AREA),'''||p_proarea||''') > 0';
              END IF ;
              IF p_disp = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.disposition),'''||p_disp||''') > 0';
              END IF ;
              IF p_coding = 'NULL' THEN
                   v_sql := v_sql||' AND instr(upper(REP.ccode),'''||p_coding||''') > 0';
              END IF ;
              IF p_SIG = ' ' THEN
                   v_sql := v_sql||' AND instr(upper(REP.SIG),'''||p_SIG||''') > 0';
              END IF ;
              IF p_word is not null then
                   v_sql := v_sql|| ' and
                   instr(upper(REP.SUMM),
                   upper(nvl('''||p_WORD_IN_SUMM||''',REP.SUMM))) > 0';
              end if ;
              If p_timeframe is not null then
                   if upper(p_timeframe) = 'OPEN' then
                   v_sql := v_sql|| ' and to_date(REP.opendate) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
                   elsif upper(p_timeframe) = 'CLOSED' then
                   v_sql := v_sql|| ' and to_date(REP.completed) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
                   elsif upper(p_timeframe) = 'EST' then
                   v_sql := v_sql|| ' and to_date(REP.estcomplete) between to_date ('''||p_ON_AFTER||''') and to_date('''||p_ON_BEFORE||''')';
                   end if;
              end if;
              v_sql := v_sql ||' order by REP.INV ';
              return v_sql;
         end get_query_f;
         function test_pf
              (p_inv VARCHAR2 := UPPER(v('P44_INV'))
              ,p_reg VARCHAR2 := UPPER(v('P44_CLASS'))
              ,p_proarea VARCHAR2 := UPPER(v('P44_PROGRAM_AREA'))
              ,p_disp VARCHAR2 := UPPER(v('P44_DISPOSITION'))
              ,p_coding VARCHAR2 := UPPER(v('P44_CODING'))
              ,p_status VARCHAR2 := UPPER(v('P44_STATUS'))
              ,p_SIG VARCHAR2 := UPPER(v('P44_SIG_c'))
              ,p_inc_sum VARCHAR2 := UPPER(v('P44_INCLUDE_SUMM_FIELD'))
              ,p_word VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_timeframe VARCHAR2 := UPPER(v('P44_TIME_FRAME'))
              ,p_rec VARCHAR2 := UPPER(v('P44_RECORD_KEEPING'))
              ,p_WORD_IN_SUMM VARCHAR2 := UPPER(v('P44_WORD_IN_SUMM'))
              ,p_ON_AFTER VARCHAR2 := UPPER(v('P44_ON_AFTER'))
              ,p_ON_BEFORE VARCHAR2 := UPPER(v('P44_ON_BEFORE'))
              RETURN test_tab PIPELINED
         is
              type test_c is ref cursor;
              v_row test_tab;
              v_sql varchar2(4000);
              v_cursor test_c;
         begin
              v_sql := get_query_f
                   (p_inv
                   ,p_reg
                   ,p_proarea
                   ,p_disp
                   ,p_coding
                   ,p_status
                   ,p_SIG
                   ,p_inc_sum
                   ,p_word
                   ,p_timeframe
                   ,p_rec
                   ,p_WORD_IN_SUMM
                   ,p_ON_AFTER
                   ,p_ON_BEFORE
              open v_cursor for v_sql;
              fetch v_cursor bulk collect into v_row;
              close v_cursor;
              for i in 1 .. v_row.count loop
                   pipe row (v_row(i));
              end loop;
              return;
         end test_pf;
    end MK_TEST_PF;
    /Regards
    Michael

  • SQL Query (PL/SQL Function Body returning SQL query) doesn't return any row

    I have a region with the following type:
    SQL Query (PL/SQL Function Body returning SQL query).
    In a search screen the users can enter different numbers, separated by an ENTER.
    I want to check these numbers by replacing the ENTER, which is CHR(13) || CHR(10) I believe, with commas. And then I can use it like this: POD IN (<<text>>).
    It's something like this:
    If (:P30_POD Is Not Null) Then
    v_where := v_where || v_condition || 'POD IN (''''''''||REPLACE(''' || :P30_POD || ''', CHR(13) || CHR(10), '','')||'''''''''')';
    v_condition := ' AND ';
    End If;
    But the query doesn't return any rows.
    I tried to reproduce it in Toad:
    select * from asx_worklistitem
    where
    POD IN (''''||REPLACE('541449200000171813'||CHR(13) || CHR(10)||'541449206006341366', CHR(13) || CHR(10), ''',''')||'''')
    ==> This is the query that does't return any rows
    select (''''||REPLACE('541449200000171813'||CHR(13) || CHR(10)||'541449206006341366', CHR(13) || CHR(10), ''',''')||'''')
    from dual;
    ==> This returns '541449200000171813','541449206006341366'
    select * from asx_worklistitem
    where pod in ('541449200000171813','541449206006341366');
    ==> and when I copy/paste this in the above query, it does return my rows.
    So why does my first query doesn't work?
    Doe anyone have any idea?
    Kind regards,
    Geert
    Message was edited by:
    Zorry

    Thanks for the help.
    I made it work, but via the following code:
    If (:P30_POD Is Not Null) Then
    v_pods := REPLACE(:P30_POD, CHR(13) || CHR(10));
    v_where := v_where || v_condition || 'POD IN (';
    v_counter := 1;
    WHILE (v_counter < LENGTH(v_pods)) LOOP
    v_pod := SUBSTR(v_pods, v_counter, 18);
    IF (v_counter <> 1) THEN
    v_where := v_where || ',';
    END IF;
    v_where := v_where || '''' || v_pod || '''';
    v_counter := v_counter + 18;
    END LOOP;
    v_where := v_where || ')';
    v_condition := ' AND ';
    End If;But now I want to make an update of all the records that correspond to this search criteria. I can give in a status via a dropdownlist and that I want to update all the records that correspond to one of these POD's with that status.
    For a region you can build an SQL query via PL/SQL, but for a process you only have a PL/SQL block. Is the only way to update all these records by making a loop and make an update for every POD that is specified.
    Because I think this will have a lot of overhead.
    I would like to make something like a multi row update in an updateable report, but I want to specify the status from somewhere else. Is this possible?

  • Using Package to produce pl/sql function body returning sql query Report

    I have existing code that we want to use in building reports in APEX. We are needing to modify it slightly to handle some new requirements, but would like to use them in reports based upon SQL query (pl/sql function body returning sql query) functionality.
    Any suggestions as how to call these in an APEX report region?
    Thank you,
    Tony Miller
    UTMB/EHN

    Hi Tony-
    I am also v new to Apex and you may have answered a question I was in search of. I, however, now have a couple more. First a bit of background-- Like in your situation, my college has a lot of existing code (400 +) that we need to get into Apex. The majority of this canned code contains one/both: 1) many lines, sometimes containing multiple select statements 2) imbedded create table & view statements (temp user owned). Up until reading your post, I was unable to figure out an easy way of getting this existing code into the product. Thanks. Now the questions, do you know how I would go about dealing with the create tables/views. I've read some posts on this forum which suggest temporary tables being unstable in this environment. Also, do you know if there's a size limitation when passing sql code via a function?
    As you may/may not be able to tell, I'm a bit lost right now... so any info you can provide would be appreciated. Thanks.
    Don

  • PLSQL function body returning an sql report returns ORA-01403 No Data Found

    I am on APEX 3.1.2.00.02 and Oracle 10g.
    I am developing a report with SQL Query (PL/SQL function body returning SQL query) type. But on running the report I am getting
    report error:
    ORA-01403: no data found
    Region Source
    declare
      qry varchar2(32767);
    begin
      --Procedure call
      my_pkg.get_query(qry);
      htp.p(qry);
      return /*select 1 from dual */ qry;
    end;
    Procedure
    PROCEDURE get_query (V_QRY OUT VARCHAR2)
    IS
      qry varchar2(32767);
    begin
      qry := ' select name
         , max(decode(to_char(service_date,''Mon-YY''), ''Jan-09'', value, null)) as "Jan-09"
         , max(decode(to_char(service_date,''Mon-YY''), ''Jan-09'', value, null)) as "Feb-09"
         from MY_TABLE
         group by name ';
      V_QRY := qry;
    end;
    The query will be enhanced later to add more months and year based on user parameters once I am successfull in running report on this.
    I wish to use Query Specific Column names. I have seen this suggestion from Scott in a number of threads to use /*select 1 from dual */ with query but not working in my case.
    Can someone please suggest what can I do to make it working?
    Regards,
    Amir

    Firstly, have you unit tested the procedure (namely, within the SQL Workshop, SQL*Plus, SQL Developer,etc, etc.) to see if it produces the right output in the first place?
    If you have, and the query string generated is valid, try assigning the output to a page item (thus allowing you to view it in the session browser) or even pass the procedure output into the debug window (with the use of the wwv_flow.debug function). This might reveal some state or session change which is causing it not to return.You might find this easier to achieve if you change from a 'procedure and out parameter' combination to a 'function returning string' approach.
    Alternatively, try re-creating the report in a new region - occasionally I've come across weird bugs with report regions which resolved themselves in this manner.

  • PL/SQL function body returning SQL - report error:ORA-01403: no data found

    Hi,
    I am working on Application Express 4.0.2.00.06, and 11G database.
    I have a problem with classic report area of type - PL/SQL function body returning SQL query. Query works if I define region area as - Use Generic Column Names (parse query at runtime only), and does not when I define it - Use Query-Specific Column Names and Validate Query.
    I am getting error:
    report error:ORA-01403: no data found
    This is my query that is returned from function, and displayed with htp.p, and it works ok and returns data in SQL Developer and SQL Workshop (in Apex).
    <code>
    /* select 1 from dual */ SELECT SIFPRO, NAZIV, VODITELJ, DATPZA,SUM(DECODE(TJEDAN,'2010/46',BRDJEL,null)) as "2010/46" ,SUM(DECODE(TJEDAN,'2010/49',BRDJEL,null)) as "2010/49" ,SUM(DECODE(TJEDAN,'2010/50',BRDJEL,null)) as "2010/50" ,SUM(DECODE(TJEDAN,'2010/51',BRDJEL,null)) as "2010/51" ,SUM(DECODE(TJEDAN,'2010/52',BRDJEL,null)) as "2010/52" ,SUM(DECODE(TJEDAN,'2011/01',BRDJEL,null)) as "2011/01" ,SUM(DECODE(TJEDAN,'2011/02',BRDJEL,null)) as "2011/02" ,SUM(DECODE(TJEDAN,'2011/03',BRDJEL,null)) as "2011/03" ,SUM(DECODE(TJEDAN,'2011/04',BRDJEL,null)) as "2011/04" ,SUM(DECODE(TJEDAN,'2011/05',BRDJEL,null)) as "2011/05" ,SUM(DECODE(TJEDAN,'2011/06',BRDJEL,null)) as "2011/06" ,SUM(DECODE(TJEDAN,'2011/07',BRDJEL,null)) as "2011/07" ,SUM(DECODE(TJEDAN,'2011/08',BRDJEL,null)) as "2011/08" ,SUM(DECODE(TJEDAN,'2011/09',BRDJEL,null)) as "2011/09" ,SUM(DECODE(TJEDAN,'2011/10',BRDJEL,null)) as "2011/10" FROM (SELECT * FROM PMV_PLAN_TVRTKA) GROUP BY SIFPRO, NAZIV, VODITELJ, DATPZA ORDER BY SIFPRO, NAZIV, VODITELJ, DATPZA
    </code>
    As you can see, I even tried with workaround that I found on the previous post on the forum, and that is to put /* select 1 from dual */ to start query.
    Any help would be appriciated.

    /* select 1 from dual */ SELECT SIFPRO, NAZIV, VODITELJ, DATPZA,SUM(DECODE(TJEDAN,'2010/46',BRDJEL,null)) as "2010/46" ,SUM(DECODE(TJEDAN,'2010/49',BRDJEL,null)) as "2010/49" ,SUM(DECODE(TJEDAN,'2010/50',BRDJEL,null)) as "2010/50" ,SUM(DECODE(TJEDAN,'2010/51',BRDJEL,null)) as "2010/51" ,SUM(DECODE(TJEDAN,'2010/52',BRDJEL,null)) as "2010/52" ,SUM(DECODE(TJEDAN,'2011/01',BRDJEL,null)) as "2011/01" ,SUM(DECODE(TJEDAN,'2011/02',BRDJEL,null)) as "2011/02" ,SUM(DECODE(TJEDAN,'2011/03',BRDJEL,null)) as "2011/03" ,SUM(DECODE(TJEDAN,'2011/04',BRDJEL,null)) as "2011/04" ,SUM(DECODE(TJEDAN,'2011/05',BRDJEL,null)) as "2011/05" ,SUM(DECODE(TJEDAN,'2011/06',BRDJEL,null)) as "2011/06" ,SUM(DECODE(TJEDAN,'2011/07',BRDJEL,null)) as "2011/07" ,SUM(DECODE(TJEDAN,'2011/08',BRDJEL,null)) as "2011/08" ,SUM(DECODE(TJEDAN,'2011/09',BRDJEL,null)) as "2011/09" ,SUM(DECODE(TJEDAN,'2011/10',BRDJEL,null)) as "2011/10" FROM (SELECT * FROM PMV_PLAN_TVRTKA) GROUP BY SIFPRO, NAZIV, VODITELJ, DATPZA ORDER BY SIFPRO, NAZIV, VODITELJ, DATPZA

Maybe you are looking for

  • How should I best import HD Videos from the new iPad to my mac without loosing video quality?

    The new HD video on the new iPad is awesome, but it can eat up a lot of memory in no time. I would like to know what is the most recommended way to export my ipad movies to iLife on my mac without loosing image quality, so i can free up space on my i

  • Update Date in OITM table

    Hi Experts I would like to run a query on OITM ti show me all the items which have been updated on todays date. I need to run it from SQL Server Management Studio i have tried the WHEN updatedate = getdate() and although the query runs succesfully I

  • Planning for iMac i7

    I'm planning for my move from a G4 PowerMac running Tiger to a 27" iMac and need help with some questions: Does Time Machine do the same job as Carbon Copy Cloner which I now use? Is it reliable? Should I partition the 1TB HD? Can't get used to that

  • Can't create panel shortcuts in InD CS6?

    Hi all, I recently installed InDesign 6 on my laptop, which is running Windows 8. I'm currently working on a file, and when I go to the F11 panel to create a new style it won't let me create a shortcut for the style. I've tried ctrl+ and num+ and all

  • How to find ODS creation date?

    Hi All, I'm struggling to look for the creation date of a particular ODS in our BW system. Can anyone advise? Thanks.