# Regarding Stored Query **Category:** [Platform](https://discourse.openehr.org/c/platform-implem/7) **Created:** 2022-07-15 09:40 UTC **Views:** 676 **Replies:** 10 **URL:** https://discourse.openehr.org/t/regarding-stored-query/2846 --- ## Post #1 by @Sravanthi_Kovi I stored one AQL Query in OpenEHR with paramters. When I provide the values for those parameters to the stored query, I was facing the following issue "Could not perform SQL query:org.postgresql.util.PSQLException: ERROR: operator does not exist: text < integer\n Hint: No operator matches the given name and argument types. You might need to add explicit type casts.\n Position: 1105, Request Body : { "query_parameters": { "ehr_id": "ehrid value", "deficit": "integer" } } Any help would would be helpful. Thanks. --- ## Post #2 by @thomas.beale Hi Sravanthi (and others), can you please include details of the product you are connecting to (for example EhrBase), and any other details of your application, environment etc? That will help experts respond more efficiently. --- ## Post #3 by @Sravanthi_Kovi HI, I am connecting to EhrBase --- ## Post #4 by @birger.haarbrandt Hi @Sravanthi_Kovi, my colleague is happy to check this! Would you mind opening an issue on GitHub and providing the template used, an example composition and the stored query? We will try to reproduce and fix: https://github.com/ehrbase/ehrbase/issues --- ## Post #5 by @Sravanthi_Kovi Sure will do that. Thanks --- ## Post #6 by @pablo Can you share the query? --- ## Post #7 by @Sravanthi_Kovi Sure. This is the query I stored in OpenEHR. Stored Query : { "q": "SELECT e/ehr_id/value, c/context/start_time/value as startTime, c/uid/value as cid, c/name FROM EHR e[ehr_id/value=$ehr_id] CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.encounter.v1] WHERE c/content[openEHR-EHR-OBSERVATION.pulse_deficit.v0]/data[at0001]/events[at0002]/data[at0003]/items[at0004]<$deficit" } Thanks --- ## Post #8 by @pablo [quote="Sravanthi_Kovi, post:7, topic:2846"] /data[at0001]/events[at0002]/data[at0003]/items[at0004] [/quote] This path is not for a native type /data[at0001]/events[at0002]/data[at0003]/items[at0004] It should be something like /data[at0001]/events[at0002]/data[at0003]/items[at0004]/value/some_dv_attribute some_dv_attribute depends on the datatype at /data[at0001]/events[at0002]/data[at0003]/items[at0004]/value Though the server shouldn't fail but respond with some code like "unsupported operation" instead of throwing an internal exception. --- ## Post #9 by @Sravanthi_Kovi Yeah, that worked, I figured out the issue. I gave the parent aql path. After changing to specific data point value path it worked. Thanks --- ## Post #10 by @birger.haarbrandt We should still improve the error message, though! Thanks for the feedback! --- ## Post #11 by @pablo Glad to help :) --- **Canonical:** https://discourse.openehr.org/t/regarding-stored-query/2846 **Original content:** https://discourse.openehr.org/t/regarding-stored-query/2846