Kql equivalent functions - azure-application-insights

I'm trying to manipulate the contents of fields returned from application Insights logging and was wondering if there are KQL equivalents for the Oracle substr and instr functions?

The equivalent of Oracle substr function in KQL is substring().
The equivalent of Oracle instr function in KQL is indexof().

Related

Minus function in Optic Query

I have requirement to do minus in one of the use case but in MarkLogic I am not able to use minus function. Is there any alternate way to do this?
select table1.value1 from table1 where table1.date = '2020-11-27'
minus
select table1.value1 from table1 where table1.date = '2020-11-26'
The "MINUS" operator is a SPARQL operator. Similar functionality is supported in MarkLogic's Optic API using the op:except() operator. You can also use the "MINUS" operator in SPARQL and op:from-sparql() in the Optic API, and the "EXCEPT" operator in SQL and op:from-sql() in the Optic API.
The minus/subtraction operator in XQuery is "-", like in most languages. The rest of your code looks a bit like SQL to me (though I last used SQL about 30 years ago) and it will all need changing.
I don't now what "Optic Query" is, I'm afraid.

EXTRACT function SQLite support?

In sqlite if I input such a query:
SELECT EXTRACT(YEAR FROM '2018-07-22')
I got a error. I'd like to confirm that if Sqlite support such function?
SQLite does not support EXTRACT() function.
Instead there is strftime():
SELECT strftime('%Y', '2018-07-22')

Get index of first character apperence without extension functions?

Is it possible to find index of an character in SQLite without using extension functions?
I need to substring texts like below from the beginning until ( character in a SELECT statement.
TT 15 (Something...)
TT 5 (blabla...)
I cannot use instr in our version of SQLite (i think it is 3.6) and it's not possible to update SQLite either.
If it were possible to do something like instr() without actually calling instr(), the authors of SQLite would not have felt the need to add instr().
If you cannot update SQLite or create an extension function, you have to read the entire string from the database and search it in your own code.

Can I call a PL/SQL function created in Oracle Application Express into Jaspersoft Ireport?

Im creating reports using Jasper ireport. I created a PL/SQL function in Oracle Application Express to translate number in corresonding text .
eg. 125 to One Hunderd and Twenty Five.
Now i need to call this function into Jasper ireport by passing parameter imto this function. Is it possible?
I found ways to call procedure into ireport but I couldnt find ways to call a function into ireport. Can anyone help?
Let's say your function is named fnNumToStr.
As we know from the basics, PL/SQL functions can be called from SQL queries if they accept and return values as SQL datatypes. In your example the function accepts number and returns VARCHAR2 so it's fine.
Write a query like:
SELECT fnNumToStr(numCol)
FROM tableName
Something like this should do. If you are passing parameter to this function then
SELECT fnNumToStr($P{paramName})
FROM tableName
should do.

Common table expression functionality in SQLite

I need to apply two successive aggregate functions to a dataset (the sum of a series of averages), something that is easily and routinely done with common table expressions in SQL Server or another DBMS that supports CTEs. Unfortunately, I am currently stuck with SQLite which does not support CTEs. Is there an alternative or workaround for achieving the same result in SQLite without performing two queries and rolling up the results in code?
To add a few more details, I don't think it could be easily done with views because the first set of aggregate values need to be retrieved based on a WHERE clause with several parameters. E.g.,
SELECT avg(elapsedTime)
FROM statisticsTable
WHERE connectionId in ([lots of values]) AND
updateTime > [startTime] AND
updateTime < [endTime]
GROUP BY connectionId
And then I need the sum of those averages.
Now that we are in THE FUTURE, let me note here that SQLite now does support Common Table Expressions, as of version 3.8.3 of 2014-02-03.
http://www.sqlite.org/lang_with.html
Would this work?
SELECT SUM(t.time) as sum_of_series_of_averages
FROM
(
SELECT avg(elapsedTime) as time
FROM statisticsTable
WHERE connectionId in ([lots of values]) AND
updateTime > [startTime] AND
updateTime < [endTime]
GROUP BY connectionId
) as t
By converting your averages into an inline view, you can SUM() the averages.
Is this what you are looking for?
As you've mentioned, SQLite doesn't support CTEs, window functions, or any of the like.
You can, however, write your own user functions that you can call inside SQLite by registering them to the database with the SQLite API using sqlite_create_function(). You register them with the database, and then you can use them in your own application code. You can make an aggregate function that would perform the sum of a series of averages based on the individual column values. For each value, a step-type callback function is called that allows you to perform some calculation on the data, and a pointer for holding state data is also available.
In your SQL, then, you could register a custom function called sum_of_series_of_averages and have:
SELECT sum_of_series_of_averages(columnA,columnB)
FROM table
WHERE ...
For some good examples on how those work, you should check out the SQLite source code, and also check out this tutorial (search for Defining SQLite User Functions).

Resources