Validating comma-delimited list for numeric entries

Hi!
I need to validate a comma-delimited list to make sure all the list items are numeric.  I could do a cfloop to loop through the list, then an IsValid() to check each entry, but that seems cumbersome, so I was wondering if there was a better way.
Thanks!

BreakawayPaul wrote:
I had the idea to just do a replace() to get rid of all the commas and treat the value as one big number.  It seems to work.
True. That is a creative test. But what if the list begins with 0 or contains negative or decimal numbers?
If you must include those such eventualities, then you could extend the test to something like
<cftry>
<cfset myList="0,1,2,x">
<cfset maxNo=arrayMax(listToArray(myList))>
<!--- The rest of the business code goes here --->
<cfcatch type="expression">
<cfoutput>#cfcatch.Detail#</cfoutput>
</cfcatch>
</cftry>

Similar Messages

  • REGEXP_SUBSTR for comma delimited list with null values

    Hi,
    I have a column which stores a comma delimited list of values. Some of these values in the list may be null. I'm having some issues trying to extract the values using the REGEXP_SUBSTR function when null values are present. Here are two things that I've tried:
    SELECT
       REGEXP_SUBSTR (val, '[^,]*', 1, 1) pos1
      ,REGEXP_SUBSTR (val, '[^,]*', 1, 2) pos2
      ,REGEXP_SUBSTR (val, '[^,]*', 1, 3) pos3
      ,REGEXP_SUBSTR (val, '[^,]*', 1, 4) pos4
      ,REGEXP_SUBSTR (val, '[^,]*', 1, 5) pos5
    FROM (SELECT 'AAA,BBB,,DDD,,FFF' val FROM dual);
    POS P POS P P
    AAA   BBB
    SELECT
       REGEXP_SUBSTR (val, '[^,]+', 1, 1) pos1
      ,REGEXP_SUBSTR (val, '[^,]+', 1, 2) pos2
      ,REGEXP_SUBSTR (val, '[^,]+', 1, 3) pos3
      ,REGEXP_SUBSTR (val, '[^,]+', 1, 4) pos4
      ,REGEXP_SUBSTR (val, '[^,]+', 1, 5) pos5
    FROM (SELECT 'AAA,BBB,,DDD,,FFF' val FROM dual);
    POS POS POS POS P
    AAA BBB DDD FFFAs you can see neither of the calls works correctly. Does anyone know how to modify the regular expression pattern to handle null values? I've tried various other patterns but was unable to get anyone to work for all cases.
    Thanks,
    Martin
    http://www.ClariFit.com
    http://www.TalkApex.com

    Hi, Martin,
    This does what you want:
    SELECT
       RTRIM (REGEXP_SUBSTR (val, '[^,]*,', 1, 1), ',') pos1
      ,RTRIM (REGEXP_SUBSTR (val, '[^,]*,', 1, 2), ',') pos2
      ,RTRIM (REGEXP_SUBSTR (val, '[^,]*,', 1, 3), ',') pos3
      ,RTRIM (REGEXP_SUBSTR (val, '[^,]*,', 1, 4), ',') pos4
      ,RTRIM (REGEXP_SUBSTR (val || ','
                          , '[^,]*,', 1, 5), ',') pos5
    FROM (SELECT 'AAA,BBB,,DDD,,FFF' val FROM dual);The query above works in Oracle 10 or 11, but in Oracle 11, you can also do it with just REGEXP_SUBSTR, without using RTRIM:
    SELECT
       REGEXP_SUBSTR (val, '([^,]*),|$', 1, 1, NULL, 1) pos1
      ,REGEXP_SUBSTR (val, '([^,]*),|$', 1, 2, NULL, 1) pos2
      ,REGEXP_SUBSTR (val, '([^,]*),|$', 1, 3, NULL, 1) pos3
      ,REGEXP_SUBSTR (val, '([^,]*),|$', 1, 4, NULL, 1) pos4
      ,REGEXP_SUBSTR (val, '([^,]*),|$', 1, 5, NULL, 1) pos5
    FROM (SELECT 'AAA,BBB,,DDD,,FFF' val FROM dual);The problem with your first query was that it was looking for sub-strings of 0 or more non-commas. There was such as sub-string. consisting of 3 characters, starting at position 1, so it returned 'AAA', as expected. Then there was another sub-string, of 0 characters, starting at position 4, so it returned NULL. Then there was a sub-string of 3 characters starting at position 5, so it returned 'BBB'.
    The problem with your 2nd query was that it was looking for 1 or more non-commas. 'DDD' is the 3rd such sub-string.
    Edited by: Frank Kulash on Feb 16, 2012 11:36 AM
    Added Oracle 11 example

  • Query a comma delimited list

    Suppliers is a field containing a comma delimited list of
    Supplier ID's.
    When a supplier logs in they should be able to view all the
    auctions that they have been registered for
    i.e if their supplierID is in the suppliers field.
    have tried this and get an error:
    <CFQUERY NAME="GetAuctions"
    DATASOURCE="#Application.Datasource#">
    SELECT * FROM Auctions
    WHERE '#Session.SupplierID#' IN 'Auctions.Suppliers'
    </CFQUERY>
    have tried this and recordcount is 0 when it should be 3:
    <CFQUERY NAME="GetAuctions"
    DATASOURCE="#Application.Datasource#">
    SELECT * FROM Auctions
    WHERE '#Session.SupplierID#' LIKE 'Auctions.Suppliers'
    </CFQUERY>

    You should avoid having a list value in a field and normalise
    your table. But if you want to stick with your style(which is not
    advisable), maybe you can do this. I believe your supplier id is a
    string so the code below may cause slowness in your system:
    <CFQUERY NAME="GetAuctions1"
    DATASOURCE="#Application.Datasource#">
    SELECT Suppliers FROM Auctions
    </CFQUERY>
    <cfoutput query="GetAuctions1">
    <CFQUERY NAME="GetAuctions2"
    DATASOURCE="#Application.Datasource#">
    SELECT * FROM Auctions
    WHERE '#Session.SupplierID#' IN(<cfqueryparam
    values="#Suppliers#" cfsqltype="CF_SQL_VARCHAR" list="Yes">)
    </CFQUERY>
    </cfoutput>
    But if your supplier id is a numeric value. then you can do
    this:
    <CFQUERY NAME="GetAuctions"
    DATASOURCE="#Application.Datasource#">
    SELECT A1.* FROM Auctions A1
    WHERE #Session.SupplierID# IN(SELECT A2.Suppliers FROM
    Auctions A2 WHERE A2.your_primary_key_for_table_Auctions =
    A1.your_primary_key_for_table_Auctions)
    </CFQUERY>

  • Too many commas in my comma delimited list

    I'm trying to merge several pdf files into one by using the cfpdf tag (action="merge").  In the source attribute, you can enter a comma delimited list of file paths to merge the pdf files together.  I'm thinking that Adobe could have picked a better delimiter though because it breaks if there is a comma any one of the file names.  I've tried using replace() to replace the commas in my filenames with chr(44) before passing it to the cfpdf tag, but it still breaks.  Any ideas on how to accommodate this?  I'm trying to prevent having to copy hundreds of files to a temp directory, then use the directory attribute instead, then delete the temp directory.  That just seems like such a waste of resources...
    Thanks!

    cfpdfparam is a WIN!  Thanks for the heads up, i had no idea that you could use the tag like that.
    <cfpdf 
    action = "merge"
    destination = "C:\Inetpub\mydir\secure\test\output_merge.pdf"
    overwrite = "yes">
    <cfpdfparam source = "C:\Inetpub\mydir\secure\test\0003. A-001 - Restaurant, Floor Plan.pdf">
    <cfpdfparam source = "#expandPath('/secure/test/0001. G-001 - General.pdf')#">
    <cfpdfparam source = "#expandPath('/secure/test/0002. G-101 - General Information.pdf')#"></cfpdf>
    Works Great, Thanks!

  • Is it possible to convert a table of values into a comma-delimited-list?

    Hi,
    I'd like to turn the following dataset:
    Parent | Child
    Charles | William
    Charles | Harry
    Anne | Peter
    Anne | Zara
    Andrew | Beatrice
    Andrew | Eugenie
    into this:
    Parent | Children
    Charles | Diana,Camilla
    Anne | Peter,Zara
    Andrew | Beatrice,Eugenie
    In other words, I'd like to take a list of values pertaining to some key and produce them as a comma-delimited-list.
    I know its is possible in T-SQL although the method is a bit of a nasty hack. Is it possible in PL-SQL?
    Thaks in advance
    Jamie

    Hi,
    With model clause (10g)
    with t  as(
    select 'Charles' parent, 'William' child from dual union
    select 'Charles', 'Harry' from dual union
    select 'Anne', 'Peter' from dual union
    select 'Anne', 'Zara' from dual union
    select 'Andrew', 'Beatrice' from dual union
    select 'Andrew', 'Eugenie' from dual
    select parent,substr(res,2) res
    from t
    model
    return updated rows
    partition by ( parent)
    dimension by ( row_number()over(partition by parent order by child) rn)
    measures(child, cast( null as varchar2(4000)) as res)
    rules
    iterate(100000)
    until(presentv(res[iteration_number+2],1,0)=0)
    ( res[0]=res[0]||','||child[iteration_number+1]);
    PARENT  RES                                              
    Anne    Peter,Zara                                       
    Andrew  Beatrice,Eugenie                                 
    Charles Harry,William                                    
    3 rows selected.

  • Regular Expression to Search Comma Delimited File for any of 3 Values

    Hi,
    I'd like to parse a table column that contains a comma delimited string for any of 3 values, 1200, 1400, 1600 just to see if they're present using Regexp_instr. If someone has an expression available please pass it along.
    Thanks,
    Victor

    Or you could do it like this too...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as id, '1000,2000,3000' as txt from dual union all
      2             select 2, '1200,1300,1400' from dual union all
      3             select 3, '1000,1300,1600' from dual)
      4  -- end of test data
      5  select *
      6  from t
      7* where regexp_like(txt,'(^|,)(1200|1400|1600)(,|$)')
    SQL> /
            ID TXT
             2 1200,1300,1400
             3 1000,1300,1600

  • Use PL/SQL Table values as a comma delimited list in a in (...) clause

    Hi,
    One my procedure's parameters is a PL/SQL table of id's (NUMBER) that the GUI sends it, based on the user's selections.
    Now, I want to use the table's values in my select's where clause to return only the correct records.
    However,
    select ......
    from ....
    where id in (i_array_ids)
    doesn't work of course, and my attempts of transfering the ids to a comma delimited list of numbers (as opposed to a lenghty varchar2 string) that could work between the ( ) have all failed.
    Thanks

    And here's an example I gave with some more up-to-date syntax than in that old AskTom thread:
    Re: DYNAMIC WHERE CLAUSE in PROCEDURE

  • Adding spaces in comma-delimited lists

    I'm pulling from a database comma-delimited db that appears
    like so:
    Carpet,Hardwood,Tile
    How can I add spaces after the comma (if there's commas at
    all)?

    #Replace(yourstringorvar, ",", ", ", "ALL")#
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com

  • Comma separated list for in ()

    I am trying get a comma separated list of numbers (123,345,332,645) from a text field and pass it to a select statement that has in condition. The code looks something like
    select a,b,c from tab1
    where a in (:P1_SEARCH)
    This works when I put only one value in the field. if I put two values like 345,453 it doesn't.
    Can someone please explain this behaviour?
    Thank you,
    Kirtan Desai

    Kirtan,
    Lots of info here: Re: Search on a typed in list of values .
    Scott

  • Comma delimited lists

    The data is as below:
    create table mylist
    id number,
    list varchar2(50)
    begin
    insert into mylist (id,list) values (111,'1,2');
    insert into mylist (id,list) values (222,'2,3');
    insert into mylist (id) values (333);
    commit;
    end;
    create table mylistvalues
    value number
    begin
    insert into mylistvalues (value) values (1);
    insert into mylistvalues (value) values (2);
    insert into mylistvalues (value) values (3);
    insert into mylistvalues (value) values (4);
    commit;
    end;
    I have to populate all ids in mylist table where list has one valid value in mylistvalues table.
    The output should be 111 and 222, because 1,2,3 are in mylistvalues table.
    Thanks.

    SELECT  DISTINCT id
      FROM  mylist,
            mylistvalues
      where regexp_like(',' || list || ',',',' || value || ',')
            ID
           222
           111
    SQL> SY.

  • Selecting from a comm delimited list

    Often we run queries like
    SELECT * FROM TABLENAME WHERE FIELDA NOT IN ('A','B','C');
    But what if your question goes in the opposite direction, what syntax would work?
    In other words. suppose I want to know which values in the list are not in the table. How could I find that out without having to create a temp table?
    I'm thinking that something like the following might work:
    SELECT FIELDA FROM ('A','B','C') A
    WHERE NOT EXISTS (SELECT 1 FROM TABLENAME B
    WHERE B.FIELDA = A.FIELDA)

    If you have a list of 30,000 items that you want to consider, then you'll likely want to have those items in a table. Here I'll create a fake table of orders, then create a shipment for most of those orders. Then I'll ask which orders of order type "PACKAGE BODY" have not been shipped.
    SQL> create table orders as
      2  select object_id AS order_id,
      3         object_type as order_type,
      4         owner as customer
      5    from all_objects;
    Table created.
    SQL>
    SQL> create table shipments as
      2  select *
      3    from orders
      4   where mod(order_id,47) > 0;
    Table created.
    SQL>
    SQL> select order_id
      2    from orders
      3   where order_type = 'PACKAGE BODY'
      4  minus
      5  select order_id
      6    from shipments
      7   where order_type = 'PACKAGE BODY';
      ORDER_ID
          3290
          3619
          3948
          4888
          5499
          5546
         25098
         25192
         29422
         32618
    10 rows selected.
    SQL>

  • Make a string into a comma delimited list

    I imagine someone out there has done this before, I am
    struggling with the right code to get it done. Please see code, any
    suggestions welcome and much appreciate in advance - thanks

    Try the code below. At the end of the loop, remove the extra
    comma at the end of the string.

  • Delimited list output

    I'd like to get a comma-delimited list of user email addresses from a table. I want to do it in a single select since I'm going to embed it into anther select. In SQL Server the following works:
    create table users (user_id varchar(10), email varchar(100))
    declare @email varchar(2000)
    SELECT @email = @email + email + '; ' FROM users
    How can I do this in Oracle (8i)?

    It sounds like you need Tom Kyte's str2tbl function as well as his stragg function. In the following example, I just left out the additional tables and join conditions, but it should work the same with them.
    scott@ORA92> -- test table and test data:
    scott@ORA92> create table hts_assay -- ha
      2    (assay_name varchar2(5),
      3       assay_id   varchar2(10),
      4       assay_type     varchar2(100))
      5  /
    Table created.
    scott@ORA92> insert all
      2  into hts_assay values ('name1', 'id1', 'type1a')
      3  into hts_assay values ('name1', 'id1', 'type1b')
      4  into hts_assay values ('name1', 'id1', 'type1c')
      5  into hts_assay values ('name2', 'id2', 'type2a')
      6  into hts_assay values ('name2', 'id2', 'type2b')
      7  into hts_assay values ('name3', 'id3', 'type3')
      8  into hts_assay values ('name4', 'id4', 'type4')
      9  select * from dual
    10  /
    7 rows created.
    scott@ORA92> commit
      2  /
    Commit complete.
    scott@ORA92> --
    scott@ORA92> -- code from Tom Kyte for stragg function:
    scott@ORA92> create or replace type string_agg_type as object
      2  (
      3       total varchar2(4000),
      4 
      5       static function
      6            ODCIAggregateInitialize(sctx IN OUT string_agg_type )
      7            return number,
      8 
      9       member function
    10            ODCIAggregateIterate(self IN OUT string_agg_type ,
    11                        value IN varchar2 )
    12            return number,
    13 
    14       member function
    15            ODCIAggregateTerminate(self IN string_agg_type,
    16                          returnValue OUT  varchar2,
    17                          flags IN number)
    18            return number,
    19 
    20       member function
    21            ODCIAggregateMerge(self IN OUT string_agg_type,
    22                      ctx2 IN string_agg_type)
    23            return number
    24  );
    25  /
    Type created.
    scott@ORA92> create or replace type body string_agg_type
      2  is
      3 
      4  static function ODCIAggregateInitialize(sctx IN OUT string_agg_type)
      5  return number
      6  is
      7  begin
      8        sctx := string_agg_type( null );
      9        return ODCIConst.Success;
    10  end;
    11 
    12  member function ODCIAggregateIterate(self IN OUT string_agg_type,
    13                             value IN varchar2 )
    14  return number
    15  is
    16  begin
    17        self.total := self.total
    18        || ','
    19        || value;
    20        return ODCIConst.Success;
    21  end;
    22 
    23  member function ODCIAggregateTerminate(self IN string_agg_type,
    24                               returnValue OUT varchar2,
    25                               flags IN number)
    26  return number
    27  is
    28  begin
    29        returnValue := ltrim(self.total,',');
    30        return ODCIConst.Success;
    31  end;
    32 
    33  member function ODCIAggregateMerge(self IN OUT string_agg_type,
    34                           ctx2 IN string_agg_type)
    35  return number
    36  is
    37  begin
    38        self.total := self.total || ctx2.total;
    39        return ODCIConst.Success;
    40  end;
    41 
    42 
    43  end;
    44  /
    Type body created.
    scott@ORA92> CREATE or replace
      2  FUNCTION stragg(input varchar2 )
      3  RETURN varchar2
      4  PARALLEL_ENABLE AGGREGATE USING string_agg_type;
      5  /
    Function created.
    scott@ORA92> -- code from Tom Kyte for str2tbl function:
    scott@ORA92> create or replace type myTableType as table of varchar2(100);
      2  /
    Type created.
    scott@ORA92> create or replace function str2tbl( p_str in varchar2 )
      2  return myTableType
      3  as
      4        l_str      long default p_str || ',';
      5        l_n         number;
      6        l_data    myTableType := myTabletype();
      7  begin
      8        loop
      9            l_n := instr( l_str, ',' );
    10            exit when (nvl(l_n,0) = 0);
    11            l_data.extend;
    12            l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
    13            l_str := substr( l_str, l_n+1 );
    14        end loop;
    15        return l_data;
    16  end;
    17  /
    Function created.
    scott@ORA92> --
    scott@ORA92> -- usage of stragg and str2tbl functions within a procedure
    scott@ORA92> -- that has a ref cursor as an out parameter
    scott@ORA92> CREATE OR REPLACE PROCEDURE your_procedure
      2    (xcur_spcur  OUT sys_refcursor,
      3       p_assaylist IN     VARCHAR2)
      4  AS
      5  BEGIN
      6    OPEN xcur_spcur FOR
      7    SELECT ha.assay_name, STRAGG (ha.assay_type) AS AssayResultTypes
      8    FROM   hts_assay ha
      9    WHERE  ha.assay_id IN
    10             (SELECT *
    11              FROM   TABLE (CAST (str2tbl (p_assaylist) AS mytableType)))
    12    GROUP  BY ha.assay_name;
    13  END your_procedure;
    14  /
    Procedure created.
    scott@ORA92> SHOW ERRORS
    No errors.
    scott@ORA92> VARIABLE g_ref REFCURSOR
    scott@ORA92> VARIABLE g_assaylist VARCHAR2(60)
    scott@ORA92> EXEC :g_assaylist := 'id1,id2,id3'
    PL/SQL procedure successfully completed.
    scott@ORA92> EXECUTE your_procedure (:g_ref, :g_assaylist)
    PL/SQL procedure successfully completed.
    scott@ORA92> PRINT g_ref
    ASSAY ASSAYRESULTTYPES
    name1 type1a,type1b,type1c
    name2 type2a,type2b
    name3 type3

  • For all entries

    I was under the impression that, while getting data from database table 'for all entries' always imporves performance. Since we are not getting whole database table data. I was doing a select statement and I have used for all entries. I have only 20,000 records in the internal table. While selecting data from database table, it took more than one hour and timed out.
    Latter, I hard coded some values and query worked and it just took few minutes.
    So, do we need to avoid for all entries? What the best practice?
    For more details Please check the code:
    Source package has only 20,000 records and while getting data it timed out. So I commented for all entries and hardcoded the values. This time it took only few minutes. Can any one suggest the best practice for handling such things?
        IF SOURCE_PACKAGE[] IS NOT INITIAL.
          SELECT
            CALMONTH
            CALYEAR
            COMPANY
            /BIC/XPROF_CTR
            PCOMPANY
            /BIC/ZPRODASGN
            /BIC/ZSLSRPTCD
            CURKEY_TC
            UNIT
            GL_ACCOUNT
            MATERIAL
            FUNC_AREA
            COSTCENTER
            WBS_ELEMT
            CURKEY_LC
            /BIC/ZTEMPKEY
            QUANTITY
            /BIC/ZAMT_REP
            /BIC/ZSALETYP
          FROM
          /BIC/AZGMROA1400
          INTO TABLE IT_SOURCE_TMP
         FOR ALL ENTRIES IN SOURCE_PACKAGE
          WHERE
                CALMONTH       BETWEEN CMONTH1 AND CMONTH2 AND
                CALYEAR        = CURR_YEAR AND
               COMPANY        = SOURCE_PACKAGE-COMPANY AND
               /BIC/XPROF_CTR = SOURCE_PACKAGE-/BIC/XPROF_CTR AND
               PCOMPANY       = SOURCE_PACKAGE-PCOMPANY AND
               /BIC/ZPRODASGN = SOURCE_PACKAGE-/BIC/ZPRODASGN AND
               /BIC/ZSLSRPTCD = SOURCE_PACKAGE-/BIC/ZSLSRPTCD AND
               CURKEY_TC      = SOURCE_PACKAGE-CURKEY_TC AND
               UNIT           = SOURCE_PACKAGE-UNIT AND
               GL_ACCOUNT     = SOURCE_PACKAGE-GL_ACCOUNT AND
                MATERIAL       = SOURCE_PACKAGE-MATERIAL AND
                /BIC/ZSALETYP  in ('TS', 'CG', 'IS', 'IC',
                                   'TO', 'FG', 'OD', 'SS',
                                   'RD', 'I3', 'D1', 'D2',
                                   'D3', 'MS', 'PF', 'RA') .
               FUNC_AREA      = SOURCE_PACKAGE-FUNC_AREA AND
               COSTCENTER     = SOURCE_PACKAGE-COSTCENTER AND
               WBS_ELEMT      = SOURCE_PACKAGE-WBS_ELEMT AND
               CURKEY_LC      = SOURCE_PACKAGE-CURKEY_LC and
               /BIC/ZACCOUNT       = SOURCE_PACKAGE-/BIC/ZACCOUNT .
        ENDIF.

    Hi,
    if you have a statement like
    SELECT ... FOR ALL ENTRIES IN FAE_itab WHERE f = FAE_itab-f.
    SAP sends it to the database depending how the parameter rsdb/prefer_union_all is set:
    rsdb/prefer_union_all = 0 =>
    SELECT ... WHERE f = FAE_itab[1]-f
              OR    f = FAE_itab[2]-f
              OR    f = FAE_itab[N]-f
    You have some small influence of the number of generated statements in the case of  OR'ed  taht an IN list should be used  by
    rsdb/prefer_in_itab_opt parameter:
    SELECT ... WHERE f IN (itab[1]-f, itab[2]-f, ..., itab[N]-f)
    rsdb/prefer_union_all = 1 =>
    SELECT ... WHERE f = FAE_itab[1]-f
    UNION ALL SELECT ... WHERE f = FAE_itab[2]-f
    UNION ALL SELECT ... WHERE f = FAE_itab[N]-f
    see: Note 48230 - Parameters for the SELECT ... FOR ALL ENTRIES statement
    As you can see that the last setting generates several statements and combine them with a UNION ALL,
    the first setting generates a statement with OR's (or uses IN list) for the entries in FAE_itab.
    I give you a little example here (my parameters are set in a way that the OR's are translated to IN lists; i traced the execution in  ST05)
    Select myid into table t_tabcount from mydbtable
      for all entries in t_table    " 484 entries
        where myid = t_table-myid
        and myid = 72.
    ST05 trace:
    |Transaction SEU_INT|Work process no 0|Proc.type  DIA|Client  200|User     |
    |Duration |Obj. name |Op.    |Recs.|RC    |Statement                                                                                |
    |      640|mydbtable |PREPARE|     |     0|SELECT WHERE "myid" IN ( :A0 , :A1 , :A2 , :A3 , :A4 ) AND "myid" = :A5                                                                                |
    |        2|mydbtable |OPEN   |     |     0|SELECT WHERE "myid" IN ( 1 , 2 , 3 , 4 , 5 ) AND "myid" = 72                                                                                |
    |    2.536|mydbtable |FETCH  |    0|  1403|                                                                                |
    |        3|mydbtable |REOPEN |     |     0|SELECT WHERE "myid" IN ( 6 , 7 , 8 , 9 , 10 ) AND "myid" = 72                                                                                |
    |      118|mydbtable |FETCH  |    0|  1403|                                                                                |
    |        2|mydbtable |REOPEN |     |     0|SELECT WHERE "myid" IN ( 11 , 12 , 13 , 14 , 15 ) AND "myid" = 72                                                                                |
    |        3|mydbtable |REOPEN |     |     0|SELECT WHERE "myid" IN ( 475 , 476 , 477 , 478 , 479 ) AND "myid" = 72                                                                                |
    |       94|mydbtable |FETCH  |    0|  1403|                                                                                |
    |        2|mydbtable |REOPEN |     |     0|SELECT WHERE "myid" IN ( 480 , 481 , 482 , 483 , 484 ) AND "myid" = 72                                                                                |
    You see the IN list contained 5 entries each  , wich made up about 97 statements for all 484 entries.
    From database point of view these settings kill performance when you have a lot of entries and/or
    a lot of columns in your FAE_itab.
    Said that, FAE i.e. can never be a replacement for joining big tables (think of having a table with thousands of records in a FAE table like you had)
    If you say now that you completly threw away the FAE table of 20.000 entries it is no wonder
    that it performs better. 20.000 records is not a small number if you create a lot of UNION's or OR's / IN lists  that way!
    Your original statement is a good example for the abuse of a FAE. In the SAP Notes this is the core problem with FAE besides empty FAE tables.
    It's safe to use a FAE_itab table if the expected entries count is small (i.e. << 100).
    What you have to decide is if it's more advantagous to
    retrieve the FAE_tabs data once and executing other statements with the SAME FAE table in the same program to reuse it
    or having additional roundtrips to the database if you don't use FAE tables at all
    Bye
    yk

  • Comma delimited string relating to subreports

    I previously opened a discussion called comma delimited string for a report header. The response I received then worked well for 'Year' but not for two other areas I am trying to use it for.
    Original Code
    Details:
    whileprintingrecords;
    stringvar Year:= Year+ {@Year} + ", ";
    Report Footer:
    whileprintingrecords;
    stringvar Year;
    Left(Year, len(Year)-2);
    I needed to modify the code to eliminate duplication in Year and this worked fine. See the code below. I also needed this code for two other areas, Author and School. Without the extra line of code with the 'instr' function the code would always show and error for ' Left(author, len(author)-2);'.  It came up with and error saying that the result was less than 0 or not and integer and went into debug mode. I added the instr function line and it worked for most but not all. This is my problem. Either the ' Left(author, len(author)-2);' line or 'If instr(author, {@Author } ) = 0 then' makes data disappear. It will show a comma delimited string for 'Author' on most rows but not from some. The same would be true for' School'. I am not sure what is going on. The code below is what I am currently using in the subreports.
    Details:
    whileprintingrecords;
    stringvar author;
    If instr(author, {@Author}) = 0 then
        author:= author + {@Author } + ", ";
    Report Footer:
    whileprintingrecords;
    stringvar author;
    If instr(author, {@Author } ) = 0 then
        author:= author + {@Author }  + ", ";
    Else
        Left(author, len(author)-2);

    Hi Abhilash,
    The code for the @Author is:
    If ({Command.chrStatus} = "External")then
        {Command.chrSurname} & ", " & {Command.chrFirstname}
    Else
        {Command.chrSurname(1)} & ", " & {Command.chrFirstname(1)}
    The goal of this code was to pull all the authors into one comma delimited string.
    eg Smith, Brian; Jones, Barry; Lee, Henry
    The same desire was with the Schools and the code was the same. I just don't know why this is returning the blanks.
    You mentioned in the last post that this would be better done in an SQL command. Should I open up another discussion because I think this would be the way to go. I just don't know how I can do the same comma delimited code in SQL.
    Thanks

Maybe you are looking for

  • Message capturing while submitting a report in background

    Hi All, I am submitting a report in background using job_open and job_close fucntion modules. I want to capture all messages coming while running the report. I am able to capture messages coming in the output but not able to capture the messages comi

  • Compatible camera list

    I am looking to buy a camera to use on some personal projects and build a demo reel. I've tried to locate a list of cameras compatible with FCP 5.0.4 but have so far been unable to do so. Can someone give me the url for this? Or let me know if these

  • Has anyone encountered this problem using auto sync?

    I am importing Canon 7D video files (1920X1080 at 30fps) and double system audio (.WAV files from a Nagra LB recorder).  I can drag any of the video clips into the project timeline to confirm it's size and framerate. When I use the Synchronize Clip c

  • How can I get a CAC card reader to work on a new iPad with a lightning connector?

    I need to know if it is possible to use a CAC card reader for military use on a new iPad with a lightning connector. I saw the lightning to USB connector but wasn't sure it the iPad will support it.

  • Error loading map chart file - APEX Cloud

    I'm getting error message when running a page with a map chart: Error Loading file: "http://apex.oracle.com/i/flashchart/anychart_6/swf/maps/europe/israel.amap" Other maps from Asia, like Yemen, work fine.