Where clause one query not being pushed down

I am having a problem where I cannot get a certain "optional" parameter to be pushed down to a query. The parameter gets applied in memory after the result set is returned but not pushed down to the DB. The function is as follows:
declare function getFoo($key as xs:string, $optinalInput as xs:string*) as element(b:bar)*
for $foo in f:getFoo()
where $key = $foo/key
where not(exists($optinalInput)) or $foo/optional = $optinalInput<- does not get pushed down to the query
return $foo
If I make optinalInput an xs:string instead of xs:string * and the optional parameter will get pushed to the query. The problem is for this optional parameter I could get anywhere from 0-50 in the sequence. Seems like when the parameter is a sequence it doesn't get applied to the query. Is there any way around this?

Mike,
I understand the difference between * and ? and I was one of the people working on the "string-length not getting pushed" problem so I am very familiar with it. I tried you solution that you mentioned below and it still did not push the where clause to the query. I know I could achieve this with an ad-hoc query but I wanted to do a pure xquery implementation of this component because of the benefits it could have when interacting with other components in our ODSI project...such as SQL joining and potentially pushing additional where clause down from components that call this component. The only way I did get this to kind of work is to do this:
return
for $o in $optinalInput
for $foo in f:getFoo()
where $key = $foo/key
where $o = $foo/optional
return
$foo
for $count in 1
where not(exists($optinalInput))
for $foo in f:getFoo()
where $key = $foo/key
return
$foo
By putting the optional parameter into a FOR statement above the table call it guarantees that at least one will exists and that's why the optional parameter gets pushed properly to the DB with a parameterized query. The problem with this is that even though a parameterized query gets pushed it will call the SQL statement multiple times!...not good.
Another solution that was suggested to me would be to create the number of sequences for each item in the sequence and treat each item as it's own. For example if you know that the schema limits the sequence from 0..50 then you could make 50 items and 50 where clauses....probably not an optimal solution either but it would achieve properly pushing the where clause tot he DB.
For now I am satisfied with this optional parameter not being pushed to the DB because the performance was still good but it would be nice if there was a maintainable pure xquery solution to this problem.
Thanks for the help it's always appreciated!
Mike

Similar Messages

  • Query cannot be pushed down - error

    Hi,
    I am using WSAD5 and Oracle10g and trying to generate RMIC
    for a CMP entity bean. Using EJB QL I created a method:
    findProductsByAge(int age) defined with:
    select object(o) from Product o where o.productAge = ?1
    The corresponding column AGE in the database is NUMBER(3).
    On the Product bean the field productAge is Integer.
    When I try to generate deploy code I get the error:
    Query cannot be pushed down
    I also defined a query findProductsByType(String type) with:
    select object(o) from Product o where o.productType = ?1
    and this one is working fine.
    Can anyone help?
    Thanks,
    Igor

    Dear All,
    I have written a EJB QL for a CMP as
    On trying to generate RMIC code for the same, I am
    getting the following error message -
    Error generating findByBasePrice(double) query
    for bean ContainerManaged(Abstract schema
    name=ProductTableSchema). Error=query cannot be
    pushed down
    The name of CMP bean is ContainerManaged. And,
    the name of method is findByBasePrice(double).
    The query is -
    SELECT DISTINCT OBJECT(p) FROM ProductTableSchema
    p WHERE p.basePrice = ?1
    The XML tag for the aforementioned query is -
    <query>
    <description></description>
    <query-method>
    <method-name>findByBasePrice</method-name>
    <method-params>
    <method-param>double</method-param>
    </method-params>
    </query-method>
    <ejb-ql>SELECT DISTINCT OBJECT(p) FROM
    ProductTableSchema p WHERE p.basePrice = ?1</ejb-ql>
    </query>Where am I going wrong?
    Thanks in advance.
    Regards,
    Ashish A.Ashish, have you solved the problem? I am having the same problem but I use int instead of double as a parameter to the method. In the
    database the corresponding column is of NUMBER(3) data type.

  • Is there a way to reset my 4 digit pin? my old one is not being accepted.

    Is there a way to reset my 4 digit pin? my old one is not being accepted.

    The only way to remove a passcode is to restore the device.
    Read:
    Forgot Passcode or Unable to Restore
    (Note that I am a representative of the organization of the above link, which is not endorsed by Apple).

  • HT4623 I update my iPad mini retina with iOS 7.1 resulting in not being to down load NOR OPEN  PPT, WORD files using iWork, page, can anyone pls help?

    I update my iPad mini retina with iOS 7.1 resulting in not being to down load NOR OPEN  PPT, WORD files using iWork, page, can anyone pls help?

    You want to just use Dropbox until the dust settles.  To use it from iWork for iOS (assuming you have the Dropbox app installed on your device), open the document in Keynote (for example), tap the share icon (box with upward pointing arrow), choose Open in Another App, choose Keynote as your format, then choose Open in Dropbox and you will get an option to save it to your Dropbox account.  To open it from Dropbox in iWork for iOS, open the document in the Dropbox app, tap the share icon, tap Open in Keynote (for example).  It's a bit clunky, but works. 

  • E-mail not being pushed

    I see this topic has been addressed with other phones, but since converting to the cloud my e-mail is either not being pushed or is severly delayed. I am using mobile me, with iphone 4 and i cloud. Was having no issues prior to using "the cloud". Any ideas ? thanks in advance

    Push mail does'nt work since 2012/05/24 7.00 PM HAEC in France for me. I've 3 accounts and I'm an original MobileMe user.
    I tried all the solutions on this bord. Nothing happen.
    I called Apple support, for us iCloud is functional.
    Push mail on iCloud is only functional if you're a new member not an older MobileMe.
    You can test this by creating a new iCloud account, push mail is functional.
    The problem comes from Apple.
    Apple must solve this problem quickly.

  • Emails not being pushed to Mac Book Pro

    Emails are not being pushed to my Macbook Pro despite coming to my other i devices.  If I close and reopen mail it seems to encourage some but not all to arrive.  Any suggestions for a fix please?
    Thanks
    Duncan

    Hi duncal,
    If you are having issues receiving emails in Mail on your MacBook Pro, you may find the troubleshooting steps outlined in the following article helpful:
    OS X Mail: Troubleshooting sending and receiving email messages - Apple Support
    Regards,
    - Brenden

  • JSP, DataWebBean: How to dynamically set the where clause of query and display record

    Hi,
    I am reposting this question as per suggestions made by Mr. Dwight.
    I have used ViewCurrentRecord web bean to display records from EMP table. I have to use the Dept_Id_FK from the current
    record of the EMP table to display corresponding records of Dept table. I have a view object called DeptView in my Business
    Components which selects all the records from the Dept table.
    How do I get the value of Dept_Id_FK and use it to display the required records of the Dept table?
    I tried to declare a variable and get the value of Dept_Id_FK but it did not work. My code is as follows:
    <%! String m_DeptId = null; %>
    <jsp:useBean id="RowViewer" class="oracle.jbo.html.databeans.ViewCurrentRecord" scope="request">
    <%
    RowViewer.initialize(pageContext, "EMPApp_EMP_EMPAppModule.EMPView1");
    RowViewer.setReleaseApplicationResources(false);
    RowViewer.getRowSet().next();
    m_DeptId = (String)RowViewer.getRowSet().getCurrentRow().getAttribute("DeptIdFk");
    %>
    </jsp:useBean>
    Thanks.
    null

    First of all, Thank you very much for making use of the new topic format. It is very much appreciated.
    As for your question, I think there are several different ways to accomplish what I think you want to do.
    1. Create a view object that includes both Emp and Dept entities and join them there. In this case, your query would look something like this:
    Select e.empno,e.name,...,d.dname,d.loc from emp e, dept d
    where e.deptno = d.deptno
    You should be able to create a JSP off of this view object that contains both the employee and department information. In this case, BC4J takes care of the foreign key to primary key coordination.
    2. In order to set a dynamic where clause for a view, you need to do the following in your usebean tag:
    rsn.initialize(application,session, request,response,out,"DeptView");
    rsn.getRowSet().getViewObject().setWhereClause("deptno=" &#0124; &#0124; m_DeptId);
    rsn.getRowSet().getViewObject().executeQuery();
    rsn.getRowSet().first();
    You will need to do this in a separate usebean tag from the EmpView, since the usebean can only initialize one view object.
    In other words, you would have your ViewCurrentRecord bean tag for the EmpView, then a separate one for the DeptView where you use the above code to set the where clause to display just the information for the department you want.
    Another option, but one I'm not sure would work as well, is to create a master-detail JSP to do this for you. Usually a master-detail is a one-to-many (one department to many employees). Your request appears to be the reverse, but might still be doable using the same mechanism.
    You set up relationships between views in your BC4J project using View Links. If you used the BC4J project wizard and created default views, some of these links may have been created for you. They are created when BC4J detects a foreign key to primary key relationship in the database.
    You can create your own View Links using the View Link wizard. Select your BC4J project node and choose Create View Link... from the context menu. You will be asked to select a source view (Emp), and a target view (Dept), then select the attribute in each view that related the two of them (deptno).
    Next, you need to reflect this new relationship setting in your application module. Select your app module and choose Edit from the context menu. On the data model page, select the EmpView node in the Selected list. Now select the DeptView node in the available list and shuttle it over. You should see DeptView1 via yourlink appear indented under the EmpView node. Save and rebuild your BC4J project to reflect the changes.
    In your JSP project, you can now have the wizard create a master-detail form for you based on DeptView1.
    Let me know if the above answers your question, or if I have misunderstood what it is you wanted to do.
    null

  • Where case when query not running at all in 11.2.0.3

    Hi,
    I have a query that was running fine till the time we were in 11.1.0.7. Last month, we had a migration to 11.2.0.3, and the query has stopped running since then. It runs indefinitely, and finally I have to kill it. However, until 11.1.0.7, I had absolutely no problems with it. Not sure what changed in 11.2.0.3 that causes it to never give me a result. The query is as below:
    SELECT T1.NAME,T2.AGE,T2.level, T2.AMT,
    FROM table1 T1, table2 T2
    WHERE (CASE WHEN
    (T1.name = 'Peter' AND SUBSTR(T1.desc,1,15)=SUBSTR(T2.description,1,15))
    THEN 1
    ELSE 0
    END)=1;
    Please advise!
    Thanks in advance.

    Hi,
    CrazyAnie wrote:
    Hi,
    I have a query that was running fine till the time we were in 11.1.0.7. Last month, we had a migration to 11.2.0.3, and the query has stopped running since then. It runs indefinitely, and finally I have to kill it. However, until 11.1.0.7, I had absolutely no problems with it. Not sure what changed in 11.2.0.3 that causes it to never give me a result. The query is as below:
    SELECT T1.NAME,T2.AGE,T2.level, T2.AMT,
    FROM table1 T1, table2 T2
    WHERE (CASE WHEN
    (T1.name = 'Peter' AND SUBSTR(T1.desc,1,15)=SUBSTR(T2.description,1,15))
    THEN 1
    ELSE 0
    END)=1;
    Please advise!I'm surprised it runs in any version. You have a comma right before the keyword FROM. If you were not getting a compile-time error, that was a bug in 11.1.0.7 that they fixed by 11.2.0.3.
    It's still strange that the query runs for a long time. I would expect it to give you an error when you tried to compile it. Is there any chance that what you posted is not what you're actually running?
    Also, LEVEL, NAME and DESC are not good column names. How Oracle reacts to using keywords like that as column names can vary from version to version. If a word is in v$reserved_words.keyword, then it's best to avoid using it as a column (or table, or variable, or schema) name.
    Edited by: Frank Kulash on Nov 21, 2012 1:33 PM
    By the way, that WHERE clause is a lot more complicated than it needs to be. Why not use
    WHERE      t1.name = 'Peter'
    AND      SUBSTR ( t1."DESC"     -- If you must use DESC, double-quote it
                , 1
                , 15
                ) = SUBSTR ( t2.description
                               , 1
                     , 15
                     )? Always think carefully before using CASE in a WHERE (or HAVING, or START WITH, or CONNECT BY) clause.

  • Emails not being pushed following update 5.1

    I realise that there are several threads about this, but nothing seems to be getting done, so figured the more people that complain about this issue the better!!
    Have tried deleting and reinstalling the cloud on my iPhone 4s, but this has failed to work, emails are still not getting pushed to my phone.
    One of the problmes also that I have noticed is that my password is not being stored on my phone properly.
    I have entered it so many times now, only for it to be verified and then my phone decides not to keep the last 2 digits of my password, which means that iCloud on my phone will not work.
    Also have an ipad, which will not be updated until this issue is sorted out.

    Hello there, Gumblejack.
    The following Knowledge Base article offers up some great steps for troubleshooting your issue:
    iPod not recognized in My Computer and in iTunes for Windows
    http://support.apple.com/kb/ts1369
    Thanks for reaching out to Apple Support Communities.
    Cheers,
    Pedro.

  • Div's being pushed down in Safari

    Hi guys,
    I've built a website for a client. For some unknown reason the footer content gets pushed down on the friends page in Safari and IE - all of the other pages are fine though.
    Here's a link to the site
    Can anyone see why this could be happening - in FF everything is fine though.
    Thank you!
    SM

    On Win 7, Safari, IE9 and Firefox, all looks the same. I am not seeing anything different.
    Jim

  • Content being pushed down the page

    I have a two column site that I am working on and the content on the right side is being pushed way down the page when it is published.  Has anyone had this happen?  you can see what I am talking about at Home
    Thanks for any assistance!

    It is lined up now because I was messing with it last night.  I have scripts and custom HTML Widgets that go down the left column that I removed when I add them back it pushes the content on the right below when published.  I will put a screen shot in this post tonight when I have a chance.
    Thanks for the help!

  • ICloud mail not being pushed to iOS devices

    Hello there,
    I've been having an issue with receiving new iCloud mail messages on my iPhone and iPad. They are not being automatically pushed to my iOS devices. They arrive normally to my MacBook and iCloud.com.
    I've tried the steps on the offical support page and it recommends deleting the iCloud account and then readding it.
    My question is:
    If I do this, will all my photos automatically redownload to the 'My Photo Stream' album in Photos?
    Thanks.

    No, only photos from the last 30 days will be redownloaded; older photos are no longer in iCloud and will be lost.  If you want to save your photo stream photos save them to your camera roll first (open your my photo stream album, tap Select, tap the photos, tap the share icon -- box with upward pointing arrow, then tap Save to Camera Roll).

  • Mail not being pushed to iphone until I click on mail

    it's only recently started doing this, but emails aren't automatically being pushed to my iPhone unless I click on the mail icon.
    I've checked to see that emails are to be pushed in the settings.
    and I don't know if this is related, but I'm also receiving the error message "message could not be sent to the trash" much more frequently...those two issues seem to coincide
    any ideas, O experts?
    Patrick

    Is the account an Exchange account, a MobileMe account, or a Yahoo account that was created on the iPhone with the Yahoo account preset? If not, the account does not support Push access for received messages. Fetch only - automatically or manually.
    If an account that supports Push access for received messages, who is the email account provider for the account? More than likely the problem lies there.
    If the account does not support Push access for received messages - Fetch only, automatically or manually, try deleting and recreating the account on your iPhone.

  • SOME Contacts Not Being Pushed From iPhone to MobileMe

    Some of my contacts aren't being pushed from my iPhone to MobileMe. Some aren;t being pushed from MobileMe to my iPhone. I have 51 contacts on my iPhone and 35 on my MobileMe. If i create a new contact on MobileMe it might be pushed or might not. Same goes with iPhone.
    Anyone got any ideas or having the same problem? Im just using the internet based contacts because I'm on Vista

    One thing to try.
    Export the photo, from iphoto, that will not sync to the iphone.
    Make sure the file name has an extension. (something like .jpg or .bmp)
    Import the photo back into iphoto.
    Now try syncing the photo to the iphone.
    Hope this helps.

  • Email not being pushed after 5.1 iOS

    I noticed today for whatever reason, my emails are not automatically being pushed to my phone, unless I stay on the mail app. Iphone 4 with iOs 5.1 Exchange Email, Hotmail, and iCloud all exhibit the same behavoir. If mail is mimized it won't send, but if I go in and kill the mail app, then it pops up with notifications and emails just fine.

    Been battling this since the update myself - finally found the problem. It's not a bug.
    Settings -> Mail, Contacts, Calendars -> Fetch New Data -> Advanced -> iCloud -> Change to "Push".
    I have always received my emails automatically from iCloud, or they were always "Pushed" to me. For some reason, after updating to iOS 5.1, this setting was changed. It took me a while, but I finally found the problem. All emails are coming automatically now.
    Hope this helps!

Maybe you are looking for

  • How to extract a particulat element details which has more references ???

    Hi All, I'm having many schema files (.xsd). Each schema files may include one or two external schema files. Example, <xs:include schemaLocation="wait-advanced.xsd"/> 1) Assume that there are 50 elements in each schema file. 2) Assume many complex ty

  • Currency Key Reference field in WebDynpro Table Column

    Hi Experts, I am using a WebDynpro table (not ALV) showing multiple currency fields in a single row - each one potentially referencing a different currency key e.g. Japanese Yen and USD in a single row. My currency context attributes are already defi

  • My iphone 5 has a lock on the rotation

    my iphone 4s has a lock on the rotation. how can i take it off

  • DVD image question

    Hey this might be a question that should be posted within some other category but I wasnt sure if a pertucar ilife application has the capability. I have a mini dvd that has 2 sides and i would like to combine it into one single layer dvd. The total

  • Ld: 0711-224 WARNING: Duplicate symbol: p_xargc

    Hi, im having this WARNING Duplicate and i dont know how to resolve it. Iam in AIX 6 Sorry for my bad english. ---- Precompilando proc iname=./Concatenador.pc oname=./Concatenador.c Pro*C/C++: Release 11.2.0.1.0 - Production on Mon Mar 19 12:43:07 20