DB2 version 10 percentile_CONT missing - db2

I am trying to calculate percentile 25th,50th and 75th with in Db2. However, i could not find the aggregate function PERCENTILE_CONT there. I get SQL error package not found. Is there any other way to do this.

IBM added PERCENTILE_CONT and PERCENTILE_DISC to Db2 for Z/OS starting from Version 12.
For Db2 for Linux/Unix/Windows, IBM added these functions at V11.1.
For earlier versions (you mention V10) you will need to implement your own version of those functions, perhaps as external functions in whatever programming language supported by Db2-for-Z in which you have skills.

Related

How to get geospatial POINT using SparkSQL

I'm converting a process from postgreSQL over to DataBrick ApacheSpark,
The postgresql process uses the following sql function to get the point on a map from a X and Y value. ST_Transform(ST_SetSrid(ST_MakePoint(x, y),4326),3857)
Does anyone know how I can achieve this same logic in SparkSQL o databricks?
To achieve this you need to use some library, like, Apache Sedona, GeoMesa, or something else. Sedona, for example, has the ST_TRANSFORM function, maybe it has the rest as well.
The only thing that you need to take care, is that if you're using pure SQL, then on Databricks you will need:
install Sedona libraries using the init script, so libraries should be there before Spark starts
set Spark configuration parameters, as described in the following pull request
Update June 2022nd: people at Databricks developed the Mosaic library that is heavily optimized for geospatial analysis on Databricks, and it's compatible with standard ST_ functions.

Is it possible to create a user defined aggregate function for DB2 without the privilege to upload compiled files..?

Before I embark on a quest which ultimately proves hopeless, I'd like to ask those with greater experience...
Is it possible to create a user defined aggregate function for DB2 without privileges to upload compiled files..? This is for DB2 for AS400 on iSeries v7r3m0.
My first thought was to create the UDAF as a normal SQL function via my SQL client DBeaver 5.2.5. I've created regular UDFs this way before, however I'm not sure if an aggregate function can be written this way. I have yet to find any examples online, and this one IBM document isn't for my version.
If this cannot be done in SQL, then the next option is JAVA. My skills there are basic yet sufficient to explore the possibility, but it'd be my first time doing so on DB2. What may be the major roadblock there is in my understanding that JAVA functions for DB2 require uploading compiled files to the server, but I do not have privileges to do this. Unless I'm incorrect on this point..?
My next thought was whether JAVA functions can be written and compiled on the server..? For instance, can I write JAVA code in a script window of my SQL client, so when I run the script, the JAVA is compiled by the server, and then stored on the server..? Or perhaps is there's a JAVA development client like IBM Data Studio which connects to the server just the same..?
Or...something..? Any suggestions would be greatly appreciated.
I'll explain the UDAF I wish to create. It would be similar to any built-in UDAF like SUM(), but it would be character-based, and its name would be GetCommonWords. The input would be a table column of type CHAR(n). The output would also be CHAR(n), with a string of words that are common to the beginning of all records.
Consider the following phrases for the column "FOOD":
peanut butter
peanut butter and jelly
peanut butter cup
peanut butter jelly time
The usage would be GetCommonWords(Food), and the result would be the words common to all: peanut butter.
Db2 for i does not have a CREATE FUNCTION (aggregate) statement even in the current 7.4 release.
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_74/db2/rbafzcreatef.htm
You should know that Db2 for i, Db2 for z and Db2 (for LUW) are essentially separate products, and although there is certain amount of common syntax and features, you do need to look at manual pages (and web articles etc) for your particular platform (and ideally version level)

REGEXP_EXTRACT unknown function on Tableau 10.0.1

I'm using REGEXP_EXTRACT function on Tableau trying to extract numbers from a string. My line of code:
INT(REGEXP_EXTRACT([Name], '([0-9]+)'))
My colleague can use it and I can't. Getting an unknown function error. We are both using the same version of Tableau, 10.0.1 and mine for some reason is unknown. Do I need to install some drivers or so to get it working? By the way, none of the regex_ functions work on my machine.
As you are using Amazon Redshift you cannot use the Tableau built in regex-functions. This is because the regex functions are not currently supported in tabelau for redshift. find out more here
In order to get around this you can:
1) Create a tableau data extract from your redshift data source and schedule this to update as required,
2) access them via the raw sql functions (see here)

How can I differentiate odoo databases according to odoo version?

In my system I have all those databases which falls under openerp version 7, 8 and 9. I want to differentiate them and take only those databases which falls under odoo version 8. I have checked in postgres files as well as in .openerp-server file. But I didn't get any thing which can help me. How to differentiate the databases?
AFAIK there is no obvious place in the database to look for that.
It would be possible to write a script that would inspect the data model looking for known differences between versions to detect the corresponding one.
But no such tool exists at the moment.
Personally, I solve this by always including the version number in the database name, such as dev-v8 or dev-v9.
Here is an answer..
You can execute following query :
SELECT * FROM ir_module_module WHERE name='base' AND latest_version like '9.%'

First Version of db2 to include bigInt data type

What is the first version of db2 to include the BigInt data type?
I thought it was version 8, but I'm looking for an official IBM source. I wasn't having much luck with google.
BIGINT was introduced with DB2 Universal Database Version 5.2, in September, 1998.
Here is a link to IBM's official announcement letter.
I assume you're asking about non-mainframe DB2. It goes back to at least version 6.
I think version 5 was the first non-mainframe one so I'm not sure how far back you need to go?