I am trying to work with percentiles in Teiid, but I get the following error
Query execution failed
Reason:
SQL Error [30068] [50000]: TEIID30068 Remote org.teiid.api.exception.query.QueryResolverException: TEIID30068 The function 'ntile(ALL 100)' is an unknown form. Check that the function name and number of arguments is correct.
The query I am using is:
SELECT id, zip5,
ntile(100) OVER(ORDER BY geopgraphy) as percentile
FROM svi2105_us_zip5.svi2015_us_zip5;
Any ideas how to use this or any other similar functions?
Not currently as of Teiid 11.0, but can log JIRA [1] for NTILE support.
[1] https://issues.jboss.org/projects/TEIID/issues
Related
I am having a problem with update mapping in query based view object. When I use NULLIF function in where clause the application gives the builder error(An unexpected severe error has occurred in JDeveloper, The program may be unstable, which could result in data loss).
Example of my code:
select table1.column1,table1.column2,table2.column3
from table1 left join table2
on table1.column1 = table2.column1
where
table1.column1 = nullif(table1.column1,?)
When you are creating your business components - which flavor of SQL/JDBC are you using? Make sure it is the generic one and not the Oracle specific.
Am using Oracle 12.1 c when i run specific query ( i cant show for security reason , and because its un related); i get exception
ORA-00604: error occurred at recursive SQL
level 1 ORA-12899: value too large for column "SOME_SCHEMA"."PLAN_TABLE"."OBJECT_NAME"
(actual: 38, maximum: 30)
I cant make it work , i will try revert last changes i did because it was working before.
BTW i was doing Explain and doing index optimizations
Any idea why!
P.S i will keep trying
How i solved this:
When i was reverting and reviewing my last changes i was doing alters for adding indexes, and each time i try to run the query again to make sure it is working.
So when i reached a specific alter i noticed the name of the index is too long,
so even if the index was created successfully, but the explain plan for select
was failing not the select it self.
The solution:
I renamed the index to be shorter ( 30 maximum ) it worked
Change table/column/index names size in oracle 11g or 12c
Why are Oracle table/column/index names limited to 30 characters?
Using EXPLAIN PLAN Oracle websites docs
I am running a db2 query that unions two very large tables. I started the query 10 hours ago, and it doesn't seem to finish yet.
However, when I check the status of the process by using top, it shows the status is 'S'. Does this mean that my query stopped running? But I couldn't find any error message.
How can I check what is happening to the query?
In DB2 for LUW 11.1 there is a text-based dsmtop utility that allows you to monitor the DB2 instance, down to individual executing statements, in real time. It's pre-11.1 equivalent is called db2top.
There is also a Web-based application, IBM Data Server Manager, which has a free edition with basic monitoring features.
Finally, you can query one of the supplied SQL monitor interfaces, for example, the SYSIBMADM.MON_CURRENT_SQL view:
SELECT session_auth_id,
application_handle,
elapsed_time_sec,
activity_state,
rows_read,
SUBSTR(stmt_text,1,200)
FROM sysibmadm.mon_current_sql
ORDER BY elapsed_time_sec DESC
FETCH FIRST 5 ROWS ONLY
You can try this command as well
db2 "SELECT agent_id,
Substr(appl_name, 1, 20) AS APPLNAME,
elapsed_time_min,
Substr(authid, 1, 10) AS AUTH_ID,
agent_id,
appl_status,
Substr(stmt_text, 1, 30) AS STATEMENT
FROM sysibmadm.long_running_sql
WHERE elapsed_time_min > 0
ORDER BY elapsed_time_min desc
FETCH first 5 ROWS only"
I have been using Postgres (version 9.2 and 9.3) with this function: https://wiki.postgresql.org/wiki/Aggregate_Mode for a while. Now recently after upgrading to version 9.4 I run into the following error when using the function:
PG::WrongObjectType: ERROR: WITHIN GROUP is required for ordered-set aggregate mode
LINE 1: SELECT mode(logins_count) AS mode_value FROM "registrations" WHERE "registrations"."cr...
The error occurs when doing:
SELECT mode(logins_count) AS mode_value FROM registrations
WHERE registrations.created_at > '20141105';
I do not understand the error message and I do not get what I have to change?
Postgres 9.4 introduced a new subclass of aggregate functions. Per documentation:
There is a subclass of aggregate functions called ordered-set
aggregates for which an order_by_clause is required, usually because
the aggregate's computation is only sensible in terms of a specific
ordering of its input rows.
One of the new built-in ordered-set aggregate functions is mode()
which happens to collide with the name of your custom aggregate function. (The Postgres Wiki page you are referring to has not been updated since 2013.)
Solution
Use a different name for your custom aggregate function to avoid the collision.
Or better yet: use the new built-in function instead. Read the updated Postgres Wiki for details.
In my criteria API query the following query where I query for three columns of my table works.
cq.multiselect(root.get("point").get("id"), root.get("player").get("userid"), root.get("amount"));
but when I want the sum of the column amount using the following query it gives a sql error. The query is
cq.multiselect(root.get("point").get("id"), root.get("player").get("userid"), cb.sum(root.get("amount")) );
The error that I am getting is.
{"id":"6","result":null,"error":"\r\nInternal Exception: com.sap.dbtech.jdbc.exceptions.jdbc40.SQLSyntaxErrorException: [-8017] (at 8): Column must be group column:ID\r\nError Code: -8017\r\n
Please help me with this, as I have been stuck on this for hours now. Thanks
The message is telling you that you need a group by clause in your query. Every column in the select clause (except the ones which are the result of an aggregate function) must be in the group by clause:
criteriaQuery.groupBy(root.get("point").get("id"),
root.get("player").get("userid"))