Wildcards in Variables

Can wildards be put in variables? I have used * and % in the equation below and i cannot get the result i am after.
Here is the formula
=If <Location Name>= "B03*" Then "B03"
basically i am trying to say anything that begins with B03 classify it as B03
I am using BO XI R2 / DI 11.5 / MSSQL2K

If the string you want to match on always appears at the start of the string then you can also use the following syntax
= If (Left(<Variable>,3)="BO3") Then "BO3" Else "Other"
Regards,
Mike

Similar Messages

  • File System Task - using a wildcard in variable

    Hi,When using the "delete file" operation in the file system task I get an error stating that I have an incorrect path when using the wildcard symbol.  Is there a way around this or do I have to spell out the whole name for each file in the
    directiory.  I cannot not use the "delete directory contents" operation because I have two sub directiories in my directory.  I'm trying to use the following when I get the error
    \\devbox\df\*.csv  when I spell out whole name of the file it works.  Any suggestions?
    LISA86

    this cant be done like this. Only possible if you put file system task in for each loop container and perform deletion one at at time.
    http://technet.microsoft.com/en-us/library/ms140185.aspx
    The File System task operates on a single file or directory. Therefore, this task does not support the use of wildcard characters to perform the same operation on multiple files. To have the File System task repeat an operation on multiple files or directories,
    put the File System task in a Foreach Loop container, as described in the following steps:
    Configure the Foreach Loop container   On the Collection page of the Foreach Loop Editor, set the enumerator to
    Foreach File Enumerator and enter the wildcard expression as the enumerator configuration for
    Files. On the Variable Mappings page of the Foreach Loop Editor, map a variable that you want to use to pass the file names one at a time to the File System task.
    Add and configure a File System task   Add a File System task to the Foreach Loop container. On the
    General page of the File System Task Editor, set the SourceVariable or
    DestinationVariable property to the variable that you defined in the Foreach Loop container.
    Thanks, hsbal

  • Wildcard empty variable query generator

    Hi all,
    I am using the typical [%1] variables in the query generator.  However, my latest query needs to have many different variable parameters and I would like to leave some of them blank.
    For example, the parameters are:
    Warehouse Code [%0]
    Item Group [%1]
    Unit (UDF) [%2]
    Row (UDF) [%3]
    Column (UDF) [%4]
    Problem is... I want to be able to leave some of the parameters blank and I don't want the system to filter by that parameter at all.
    SO if I just want to put warehouse code in, then all the other parameters should be *.  Or if i want to use item group and row, then all the others will be *.  Right now I have to enter exactly what i want from all parameters, so it doesn't work very well.  I figured this wouldn't be so difficult.
    Any suggestions?
    M

    Thanks guys, my final code was kind of a mish mash.  Works where if you don't enter any variables you will see the entire list of serialized items unfiltered, if you want to sort by location (unit, column, row, warehouse) then you can enter them as needed.
    SELECT
    T0.[IntrSerial],
    T1.[ItemCode],
    T1.[ItemName],
    T2.[ItmsGrpNam] as 'Item Group Name',
    T1.[ItmsGrpCod] as 'Item Group Code',
    T1.[U_Unit],
    T1.[U_Row],
    T1.[U_Col],
    T3.[WhsName],
    T0.[WhsCode]
    FROM OSRI T0 
    INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
    INNER JOIN OITB T2 ON T1.ItmsGrpCod = T2.ItmsGrpCod
    INNER JOIN OWHS T3 ON T0.WhsCode = T3.WhsCode
    WHERE
    ((T3.[WhsName] ='[%0]') OR ('[%0]'=''))
    AND
    ((T2.[ItmsGrpNam] ='[%1]') OR ('[%1]'=''))
    AND
    ((T1.[U_Unit] ='[%2]') OR ('[%2]' IS NULL) OR ('[%2]'=''))
    AND
    ((T1.[U_Row] ='[%3]') OR ('[%3]' IS NULL) OR ('[%3]'=''))
    AND
    ((T1.[U_Col] ='[%4]') OR ('[%4]' IS NULL) OR ('[%4]'=''))
    ORDER BY
    T1.[ItmsGrpCod],
    T1.[ItemCode]
    The where clauses allow you to leave the variable blank if you want, which is very handy!  I know I will use this code again.

  • Generic wildcard with variable

    hi,
    can some explain following code.what is the difference between these 3 variables.
    List<? extends Animal> li1= new ArrayList<Animal>();
    List<? super Animal> li2= new ArrayList<Animal>();
    List<?> li3= new ArrayList<Animal>();

    <?> allows all classes
    <? extends Foo> allows Foo and its subclasses
    <? super Foo> allows Foo and its superclasses.
    See http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf for more details.

  • Shell to remove files of two days ago or later

    Hello experts and gurus,
    can someone tell me where can I find a documentation or web page that shows an easy and simple way to remove old files by date (for example, remove files older than 2 days: for example, if today is monday, I need to remove files from saturday or later). I researched but didn't find it. I am not shell script expert, but I'm studying linux.
    Many thanks,

    There was actually no need to limit the search results to regular files and then remove directories and their contents recursively. The find command has a few action commands built-in, which does not need to pass results to an external program for processing. Please see the following:
    Terminal - Example
    # su - dude
    $ touch testFile1 testfile2 TESTfile3
    $ find ./ -type f -iname 'testfile*' -ls -delete
    261742    0 -rw-rw-r--   1 dude     dude            0 Nov 28 08:41 ./testfile2
    261747    0 -rw-rw-r--   1 dude     dude            0 Nov 28 08:41 ./TESTfile3
    261689    0 -rw-rw-r--   1 dude     dude            0 Nov 28 08:41 ./testFile1
    $ find ./ -type f -name "testfile*" -ls -delete
    $
    Also note the effect of single and double quoting the find name argument and command line globbing, which many Linux/Unix system administrators with a MS Windows background may not be aware off. The shell resolves wildcards and variables rather than passing the argument to the find command unless it is single quoted:
    Terminal - Example
    $ touch 'test$File1' 'test$file2' 'TEST$file3'
    $ mkdir test
    $ find ./ -type f -iname 'test$file*' -ls
    261689    0 -rw-rw-r--   1 dude     dude            0 Nov 28 08:53 ./test$File1
    261747    0 -rw-rw-r--   1 dude     dude            0 Nov 28 08:53 ./TEST$file3
    261742    0 -rw-rw-r--   1 dude     dude            0 Nov 28 08:53 ./test$file2
    $ find ./ -type f -iname test$file* -ls
    find: paths must precede expression: test$File1
    $ strace find ./ -type f -iname test$file* -ls
    execve("/bin/find", ["find", "./", "-type", "f", "-iname", "test", "test$File1", "test$file2", "-ls"]
    $ strace find ./ -type f -iname 'test$file*' -ls
    execve("/bin/find", ["find", "./", "-type", "f", "-iname", "test$file*", "-ls"]
    $ strace find ./ -type f -iname "test$file*" -ls
    execve("/bin/find", ["find", "./", "-type", "f", "-iname", "test*", "-ls"]

  • How to include wildcard in FTP adapter header variable?

    I have two partner links that use FTP adapters. The first one puts a file on the FTP server. It specifies a dynamic outbound file name based upon an input variable and the timestamp in the format "test_BATCHID_yyyyMMddHHmmss.csv" (e.g. test_1011_20050925153059.csv). This part works as expected.
    The second partner link is supposed to pick up a file on the same FTP server. This inbound filename will be based upon the outbound filename and another timestamp in a format such as "originalfilename.yyyyMMddHHmmss.txt" (e.g. test_1011_20050925153059.csv.20050926091541.txt). I have created a Transform action with a mapping to convert the outbound filename and assign it to the inbound header variable. It concatenates the outbound filename and ".*.txt" within the mapping. The inbound header shows up as test_1011_20050925153059.csv.*.txt in the audit, but the process hangs at the receive activity and the file never gets retrieved. Perhaps the asterisk is being interpreted literally?
    Does anyone know how to specify a wildcard character in an xpath expression in a way that it will be interpreted as a true wildcard? Or is there another way to tell the inbound adapter to look for a dynamic filename using wildcards?

    BPEL patch 1 supports performing a synchronous read using a BPEL invoke activity. The following forum post shows how to configure a read adapter manually.
    Re: Help! Three questions about FileAdapater.
    The subsequent patches of JDeveloper allow such an apdater to be configured automatically.
    ps: This adapter can be used to read a single file only i.e. you cannot use a wild character.

  • Oracle BI Publisher - Passing multiple wildcard search to a bind variable

    Hi,
    Please help me in resolving the below mentioned issue:
    I have developed a report in oracle BI Publisher with a SQL query.
    While scheduling the report to run I used to pass mutilple parameters like CGAMSVC08,RLCSVC51
    If the pass the parameter with wildcard search like C% it works.
    When I pass two or more parameter values with wildcard search like C%,R% its not working.
    Could you please let me know how should I give the bind variable in the SQL query. Currently I'm paramater like the one shown below for passing multiple paramaters:
    Where (',' || :PRMRETRID || ',' like '%,'||RL.RETROFIT_ID|| ',%')
    Edited by: user1101445 on May 23, 2012 2:02 AM

    HI Tyler.
    Well, here's the latest.
    I found this little gem in the BIEE 10.1.3.3.3 Release Notes Documentation...
    This issue applies to Versions 10.1.3.3, 10.1.3.3.1, 10.1.3.3.2, and 10.1.3.3.3.
    Reports that use the BI Publisher data template as the data model may fail with the
    following error: "Data not defined."
    This error will occur if you defined a parameter in your data template but you do not
    pass a value to it via the user interface. If you do not specify this parameter in the "Parameters" section of the report definition that you created using the BI Publisher Edit Report interface, then you will receive the error.
    To work around this issue, either define the parameter in the Edit Report interface or remove the parameter from the data template.
    That bit is now working.
    Having set this up and using your guide it works if my SOAP parameters declaration passes a single value like this...
    <parameterNameValues>
    <item>
    <name>P_INVOICE_ID</name>
    <multiValuesAllowed>true</multiValuesAllowed>
    <values>
    <item>16641</item>
    </values>
    </item>
    </parameterNameValues>
    But if I try and pass two or more like this...
    <parameterNameValues>
    <item>
    <name>P_INVOICE_ID</name>
    <multiValuesAllowed>true</multiValuesAllowed>
    <values>
    <item>16641,18421</item>
    </values>
    </item>
    </parameterNameValues>
    BIP states "java.sql.SQLException: ORA-01722: invalid number"
    My SQL where clause is..
    <sqlStatement name="Q1">
    <![CDATA[select * from vw_invoice_summary
                   where invoice_summary_id IN (:P_INVOICE_ID)]]>
    </sqlStatement>
    And the BIP error records the parameter value as P_INVOICE_ID 16641,18421 (which are legit invoice IDs)
    In summary, works if I pass one invoice ID, fails if I pass two or more.
    Any ideas? Or do you reckon this is now a post for the BIP forum?
    Kind regards.
    Simon

  • Comm Channel Variable Substitution - Use of wildcards to reference payload

    Hi!
    I am building a solution to write out tagged / XML IDOCs to a file adapter. I am using variable substitution to build the file name to include the message type, sending partner etc... in the target directory and filename.
    Is there a way to wildcard nodes in the variable substitution? For example:
    <i>Currently</i>
    payload:WMMBID01,1,IDOC,1,EDI_DC40,1,RCVPRN,1
    <i>Desired</i>
    payload:*,1,IDOC,1,EDI_DC40,1,RCVPRN,1
    where * is any wildcard.
    Reason is that we have multiple IDOC types and I want to avoid having to create multiple communication channels.
    Help appreciate and rewarded. Many thanks, Duncan.

    Hi Duncan !
    You can create the desired target filename and target directory by using dynamic configuration via java UDF in mapping. This allows you to create a target filename and/or directory based on a string..then you could use only one comm channel.
    to access info:
    // access dynamic configuration
          DynamicConfiguration conf = (DynamicConfiguration) param.get(
              StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","<b>FileName</b>");
          // read value
          String Filename = conf.get(KEY_FILENAME);
    // to write value:
    conf.put(KEY_FILENAME, "MyNewFileName");
    Regards,
    Matias

  • Using wildcards in URL variables (very simple question, i know)

    Hi all!
    Pulling my hair out over this... How do I use wildcards in URL variables? I have this code in compositionReady (which is working):
    var myurl = "http://www.mydomain.com/sub1/sub2/pagename";
    var currenturl = window.location
    if(myurl == currenturl) {
        sym.getSymbol("symbolname").play();
    It simply makes the symbol "symbolname" play when the current URL matches the variable 'myurl'. However, I want the symbol to play on ALL subpages to http://www.mydomain.com/sub1/sub2/ and therefore it seems logical to put in a wildcard like:
    http://www.mydomain.com/sub1/sub2/* or something similar, but I just can't seem to make it work??
    Any help will be greatly appreciated!
    Best,
    Thomas

    What about this ?
    var mysubdomain = "http://www.mydomain.com/sub1/sub2/";
    var currenturl = window.location.toString();
    if(currenturl.indexOf(mysubdomain) === 0) {
        sym.getSymbol("symbolname").play();
    -Dharmendra

  • Wildcard in SELECT statement defined as a variable

    Hi,
    The following query works in a PL/SQL procedure (it's defined in a variable because the WHERE clause will eventually be built at run time):
    l_select_statement VARCHAR2(4000) :=
    'SELECT XMLELEMENT (
    FROM WEB_VPREPARATIONS W WHERE CODE LIKE :code';
    I execute it via a cursor, like this:
    OPEN l_prod_cv FOR l_select_statement USING in_code;
    I would like to add the '%' wildcard on either side of ':code', but nothing that I've tried works (e.g., LIKE ''%:code%'' using two single quotes on either side). Any help would be greatly appreciated. Thanks,
    Chris.

    That was it! Thank you so much.
    I apologize to odie 63, but the "Correct" button disappeared once I had marked metzquar's...
    I prefer not to pass the wildcard via the variable, and keep it inside the query, just in case the query ever changes.
    Thanks to all who helped; response time was in the milliseconds!
    Chris.

  • [Solved] Wildcard possible in variable for a loop?

    Perhaps it just me being lazy but I'm writing a script I need to put in a loop that will have a good number of variables in it.  I'd like to be able to make one variable with a wildcard to simplify things.  For example, I'd like to do:
    tst1=hello
    tst2=hi
    tst3=howdy
    for var in $tst*; do
    echo "$var"
    done
    Is there a way to do this?
    Last edited by Gen2ly (2009-10-09 21:35:26)

    tst=(hello hi howdy)
    for var in ${tst[@]}; do
    echo "$var"
    done
    Or you could write:
    tst[0]='hello'
    tst[1]='hi'
    tst[2]='howdy'
    for var in ${tst[@]}; do
    echo "$var"
    done
    Last edited by scragar (2009-10-09 17:26:30)

  • Variables with wildcard

    hi,
    can some explain following code.what is the difference between these 3 variables.
    List<? extends Animal> li1= new ArrayList<Animal>();
    List<? super Animal> li2= new ArrayList<Animal>();
    List<?> li3= new ArrayList<Animal>();
    Edited by: dvrajitha on Oct 10, 2007 3:28 AM

    Consider this Object hierarchy:
    Object > Lifeform > Animal > Canine > Lupine
    And this simple case:
    List<Animal> li0 = new ArrayList<Animal>();
    li0 can only be assigned a List of Animal
    li0 cannot be assigned a List of Object, Lifeform, Canine, or Lupine.
    li1 can be assigned a List of Animal, or its subclasses Canine, or Lupine
    li1 cannot be assigned a List of Object or Lifeform.
    li2 can be assigned a List of Animal or its superclasses, Lifeform and Object
    li2 cannot be assigned a List of Canine or Lupine.
    li3 can be assigned a list of anything.
    '? extendsT' sets an upper bound of T; values will either be T or some more specific class
    '?super T' sets a lower bound of T; values will either be T or some more general class
    Edited by: devon_c_miller on Oct 10, 2007 9:40 AM

  • Using a variable in a Powershell search and replace string

    Hi
    a couple of days ago I posted a question about doing a search and replace with wildcards
    Search and repalce with Widcards
    I got a swift and very helpful answer but now I need to build on it.
    In a text file I wanted to replace all the text between two defined words.  the script I got was this
    $text = 'Some Server this bit of text varies Language stuff'
    $text -replace '(.*Server) .+? (Language.*)','$1 it will always say this $2'
    It works great but now I want to replace "it will always say this" with a variable and I can't figure out the correct grammar to make this happen.
    Can anyone help??
    Thanks
    Alex

    Here's one way:
    $replace = 'it will aways say this'if ( $text -match '(.*Server) .+? (Language.*)' )
    { "{0} $Replace {1}" -f $matches[1,2] }
    else { $text }
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Is it possible to use wildcards to match cell contents in an if statement?

    I need to return a ID along with some other information on a page by page basis, so that the information comes out linked by position.  I use a couple of loops and if statements to navigate through the document.  I am able to use exact matches of cell contents which is fine when the contents doesn't vary.  But the IDs, though they have a similar pattern, are all different. In a menu driven search, I am able to find what I need with '150^9^9^9^9^9-^9^9^9' But when I try putting this (or any number of [0-9], *, ? combinations) it fails.  Is it possible to use wildcards?  The symbol used for the match (==) makes me suspect that it is not possible and that only literal, exact matches will work.  But I wanted to check with the experts before giving up.
    Thanks
    pcbaz

    Thanks for the input.  You're right, a GREP search is much more efficient.  But what I'm trying to do and the circumstances here don't allow me, I think,  to go that route. I am trying to generate a list of values coming from several textframes on a single page and have them come out so that I can tell which values belong together.
    I'm using an inherited document with masters that were created 'manually';  the index numbering for textframes and tables is random. I navigate through the pages, looping through textframe indices asking ' does this textframe exist?' If so, I ask if it is a table -- if no, it is a simple textframe and I ask about the ID, if yes, I ask if the contents of cell (0,0) (invariant position and contents) are equal to the table I want..  I am sending the ID and other pieces of information from the table to one row of a new table on a new page.  So the ID and other information from a single page are linked by being in the same row.
    I know this a little 'off-normal' -- I'm using the search to navigate through the document and find things by location the way you do with a spreadsheet.  I have devised a work-around that helps me get around the fact that the ID is not invariant.  I create a list of the (exact) IDs from another document, equating them to a variable ('a').  I then loop through the list of IDs and ask if the contents of the textframe is equal to 'a'..This works o.k, unless there happens to be an extra space, a different kind of hyphen, etc. It would be so much easier if I could use the wildcards that work in a menu-driven text or GREP search in script just to ask about the contents of the textframe.
    Thanks again
    pcbaz (Peter BIerly)
    P.S. we have since rewritten the masters so this problem will not exist in the future -- we now know exactly which textframe and/or table indices to refer to to get any particular bits of information and don't need to ask questions about the contents.

  • SLOW report performance with bind variable

    Environment: 11.1.0.7.2, Apex 4.01.
    I've got a simplified report page where the report runs slowly compared to running the same query in sqldeveloper. The report region is based on a pl/sql function returning a query. If I use a bind variable in the query inside apex it takes 13 seconds to run, and if I hard code a string it takes only a few hundredths of a second. The query returns one row from a table which has 1.6 million rows. Statistics are up-to-date and the columns in the joins and where clause are indexed.
    I've run traces using p_trace=YES from Apex for both the bind variable and hard coded strings. They are below.
    The sqldeveloper explain plan is identical to the bind variable plan from the trace, yet the query runs in 0.0x seconds in sqldeveloper.
    What is it about bind variable syntax in Apex that is causing the bad execution plan? Apex Bug? 11g bug? Ideas?
    tkprof output from Apex trace with bind variable is below...
    select p.master_id link, p.first_name||' '||p.middle_name||' '||p.last_name||' '||p.suffix personname,
    p.gender||' '||p.date_of_birth g_dob, p.master_id||'*****'||substr(p.ssn,-4) ssn, p.status status
    from persons p
    where
       p.person_id in (select ps.person_id from person_systems ps where ps.source_key  like  LTRIM(RTRIM(:P71_SEARCH_SOURCE1)))
    order by 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.01          0          1         27           0
    Fetch        2     13.15      13.22      67694      72865          0           1
    total        4     13.15      13.23      67694      72866         27           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 62  (ODPS_PRIVACYVAULT)   (recursive depth: 1)
    Rows     Row Source Operation
          1  SORT ORDER BY (cr=72869 pr=67694 pw=0 time=0 us cost=29615 size=14255040 card=178188)
          1   FILTER  (cr=72869 pr=67694 pw=0 time=0 us)
          1    HASH JOIN RIGHT SEMI (cr=72865 pr=67694 pw=0 time=0 us cost=26308 size=14255040 card=178188)
          1     INDEX FAST FULL SCAN IDX$$_0A300001 (cr=18545 pr=13379 pw=0 time=0 us cost=4993 size=2937776 card=183611)(object id 68485)
    1696485     TABLE ACCESS FULL PERSONS (cr=54320 pr=54315 pw=0 time=21965 us cost=14958 size=108575040 card=1696485)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          1   SORT (ORDER BY)
          1    FILTER
          1     HASH JOIN (RIGHT SEMI)
          1      INDEX   MODE: ANALYZED (FAST FULL SCAN) OF
                     'IDX$$_0A300001' (INDEX)
    1696485      TABLE ACCESS   MODE: ANALYZED (FULL) OF 'PERSONS' (TABLE)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      db file scattered read                       1276        0.00          0.16
      db file sequential read                       812        0.00          0.02
      direct path read                             1552        0.00          0.61
    ********************************************************************************Here's the tkprof output with a hard coded string:
    select p.master_id link, p.first_name||' '||p.middle_name||' '||p.last_name||' '||p.suffix personname,
    p.gender||' '||p.date_of_birth g_dob, p.master_id||'*****'||substr(p.ssn,-4) ssn, p.status status
    from persons p
    where
       p.person_id in (select ps.person_id from person_systems ps where ps.source_key  like  LTRIM(RTRIM('0b')))
    order by 1
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.02       0.04          0          0          0           0
    Execute      1      0.00       0.00          0          0         13           0
    Fetch        2      0.00       0.00          0          8          0           1
    total        4      0.02       0.04          0          8         13           1
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 62  (ODPS_PRIVACYVAULT)   (recursive depth: 1)
    Rows     Row Source Operation
          1  SORT ORDER BY (cr=10 pr=0 pw=0 time=0 us cost=9 size=80 card=1)
          1   FILTER  (cr=10 pr=0 pw=0 time=0 us)
          1    NESTED LOOPS  (cr=8 pr=0 pw=0 time=0 us)
          1     NESTED LOOPS  (cr=7 pr=0 pw=0 time=0 us cost=8 size=80 card=1)
          1      SORT UNIQUE (cr=4 pr=0 pw=0 time=0 us cost=5 size=16 card=1)
          1       TABLE ACCESS BY INDEX ROWID PERSON_SYSTEMS (cr=4 pr=0 pw=0 time=0 us cost=5 size=16 card=1)
          1        INDEX RANGE SCAN IDX_PERSON_SYSTEMS_SOURCE_KEY (cr=3 pr=0 pw=0 time=0 us cost=3 size=0 card=1)(object id 68561)
          1      INDEX UNIQUE SCAN PK_PERSONS (cr=3 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 68506)
          1     TABLE ACCESS BY INDEX ROWID PERSONS (cr=1 pr=0 pw=0 time=0 us cost=2 size=64 card=1)
    Rows     Execution Plan
          0  SELECT STATEMENT   MODE: ALL_ROWS
          1   SORT (ORDER BY)
          1    FILTER
          1     NESTED LOOPS
          1      NESTED LOOPS
          1       SORT (UNIQUE)
          1        TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                       'PERSON_SYSTEMS' (TABLE)
          1         INDEX   MODE: ANALYZED (RANGE SCAN) OF
                        'IDX_PERSON_SYSTEMS_SOURCE_KEY' (INDEX)
          1       INDEX   MODE: ANALYZED (UNIQUE SCAN) OF 'PK_PERSONS'
                      (INDEX (UNIQUE))
          1      TABLE ACCESS   MODE: ANALYZED (BY INDEX ROWID) OF
                     'PERSONS' (TABLE)

    Patrick, interesting insight. Thank you.
    The optimizer must be peeking at my bind variables with it's eyes closed. I'm the only one testing and I've never passed %anything as a bind value. :)
    Here's what I've learned since my last post:
    I don't think that sqldeveloper is actually using the explain plan it says it is. When I run explain plan in sqldeveloper (with a bind variable) it shows me the exact same plan as Apex with a bind variable. However, when I run autotrace in sqldeveloper, it takes a path that matches the hard coded values, and returns results in half a second. That autotrace run is consistent with actually running the query outside of autotrace. So, I think either sqldeveloper isn't really using bind variables, OR it is using them in some other way that Apex does not, or maybe optimizer peeking works in sqldeveloper?
    Using optimizer hints to tweak the plan helps. I've tried both /*+ FIRST_ROWS */ and /*+ index(ps pk_persons) */ and both drop the query to about a second. However, I'm loath to use hints because of the very dynamic nature of the query (and Tom Kyte doesn't like them either). The hints may end up hurting other variations on the query.
    I also tested the query by wrapping it in a select count(1) from ([long query]) and testing the performance in sqldeveloper and in Apex. The performance in that case is identical with both bind variables and hard coded variables for both Apex and SqlDeveloper. That to me was very interesting and I went so far as to set up two bind variable report regions on the same page. One region wrapped the long query with select count(1) from (...) and the other didn't. The wrapped query ran in 0.01 seconds, the unwrapped took 15ish seconds with no other optimizations. Very strange.
    To get performance up to acceptable levels I have changed my function returning query to:
    1) Set the equality operator to "=" for values without wildcards and "like" for user input with wildcards. This makes a HUGE difference IF no wildcard is used.
    2) Insert a /*+ FIRST_ROWS */ hint when users chose the column that requires the sub-query. This obviously changes the optimizer's plan and improves query speed from 15 seconds to 1.5 seconds even with wildcards.
    I will NOT be hard coding any user supplied values in the query string. As you can probably tell by the query, this is an application where sql injection would be very bad.
    Jeff, regarding your question about "like '%' || :P71_SEARCH_SOURCE1 || '%'". I've found that putting wildcards around values, particularly at the beginning will negate any indexing on the column in question and slows performance even more.
    I'm still left wondering if there isn't something in Apex that is breaking the optimizer "peeking" that Patrick describes. Perhaps something in the way it switches contexts from apex_public_user to the workspace schema?

Maybe you are looking for

  • Installation of grid control on windows xp

    can any body provide me compelete guide installing 10g grid R1 on xp,linux and management agents on winows and linux operating systems. Thanks in Advance

  • NW04 Java add-in installation problem

    Hi Friends, I am installing Unicode WAS 640 ABAP + Java system for XI3.0 on Windows/Oracle. I have installed ABAP system successfully. After that I was installing Java add-in on ABAP system. At the step 24 of 27 : Start SAP J2EE Engine, I was getting

  • Ringtones wont work in text tones section but works in ringtones section??

    im having a problem here.. im using an iphone 4 with IOS 5.0.1, and as we all know...we can customise all of our tones into ringtones and text tones as well.. but have you guys out there encountered an issue which your customised tone works well in y

  • Urgent /Change In CO01

    Hello, My question is same ....... Plz.. do something its very urgent.. Can anybody tell me that how can i change in CO01 Standard T. Code..... I do all options.....like first, create screen variant for it....its working but we can't saw it reflect w

  • AirPrint creates multiple copies when printing just one...

    It's driving me mad. I have a HP1217nfw, AirPrint works, but when I try to print one copy, it prints out multiple copies, leaving me scrabbling for the Cancel button and doing everything to cancel the multiple prints it churns out regardless. This le