Questions tagged [dynamic-queries]

120 questions
260
votes
27 answers

Is there a query language for JSON?

Is there a (roughly) SQL or XQuery-like language for querying JSON? I'm thinking of very small datasets that map nicely to JSON where it would be nice to easily answer queries such as "what are all the values of X where Y > 3" or to do the usual SUM…
allclaws
  • 5,575
  • 8
  • 30
  • 27
17
votes
2 answers

Spring Data MongoDB Repository - JPA Specifications like

Is there something like JPA Specifications for Spring Data MongoDB Repositories? If not, how can I make dynamic queries with repositories? A classic scenario could be a search form with optional fields that the user will fill.
12
votes
2 answers

My SQL Dynamic query execute and get ouput into a variable in stored procedure

I generate a dynamic query in My sql Stored procedure. I wanna get the result of this query into a out parameter. How to do this ? CREATE PROCEDURE 'searchInvoice' ( OUT numOfRecords INT ) BEGIN DECLARE query1 TEXT; DECLARE query2 TEXT; …
Sency
  • 2,818
  • 8
  • 42
  • 59
5
votes
2 answers

LINQ - dynamic orderby clause does not work

I have code like this: //build query var shops = (from p in dataContext.shops let distance = dataContext.GetDistance(p.lat, p.lon, nearlat,nearlon) join c in dataContext.shops_category on p.id equals c.poi_id …
itdeveloper
  • 339
  • 2
  • 3
  • 14
3
votes
2 answers

Run MySQL queries on different databases

We have a system where we have for each division a database , currently we have 20+ divisions. So when we have to update / delete / alter / new table we have to go threw all of those database and run the queries . Sometime people don't follow…
Tarek
  • 3,810
  • 3
  • 36
  • 62
3
votes
1 answer

Optimal way to index a large flat table in view of dynamic querying

I have a relatively wide table (50 columns). Of those, the first 5 represent the scope of a certain subset of data and the last 45 represent properties (mapped at deployment time, so static). The users have the possibility (through a query builder)…
Andrea
  • 884
  • 1
  • 10
  • 23
3
votes
1 answer

Why is this package leaking open cursors?

In our application, we call various stored procedures that return reference cursors in the following fashion: SELECT foo_package.sp_Bar('arg1', 'arg2', 'arg3', 'arg4') FROM dual; What the wrap_xml function does is to convert the cursor result to an…
Stephan B
  • 837
  • 1
  • 16
  • 41
2
votes
1 answer

Setting the FROM clause via parameter in MyBatis

I haven't been able to see anything in the documentation which speaks to my question, and upon deploying it, my app does not quite work right (more on that in a sec). I am trying to do something like