"str contains" Function SIDDHI - wso2

i have a queshion.
Can I make a query and use the "str:contains" function with two events.
For example replace:
from DSBStream[(str:contains(correlation_phr_incident_detail, '0.0.0.0')==FALSE)]
select *
insert into DSBFiltered;
BY
from DSBStream#window.length(0) join Trazablack as t
on (str:contains(correlation_phr_incident_detail, t.atribute)==FALSE)
select t.sensorValue as sensorValue
insert current events into trazawhite;
this is possible?

This is not possible since Trazablack is a RDBMS event table. As a work around you can divide the query in to two parts where first query will get atribute from table by joining and second query will check srt:contains.

Related

Fetch Returns only 1 Row - Interactive Grid - Oracle Apex

I have an interactive grid which has a dynamic action to fetch returns from another table
begin
for c in (select
REW_SIZE,
IN_STOCK,
DESCRIPTION,
FINANCIAL_YEAR_ID
into
:REW_SIZE,
:IN_STOCK,
:DESCRIPTION,
:FINANCIAL_YEAR_ID
from
T_SORDER_PROFOMA_REWINDING
where so_id = :so_id)
loop
:REW_SIZE := c.REW_SIZE;
:IN_STOCK :=c.IN_STOCK;
:DESCRIPTION:=c.DESCRIPTION;
:FINANCIAL_YEAR_ID:=c.FINANCIAL_YEAR_ID;
end loop;
end;
When I had simple select into query, it gave "exact fetch returns more than requested number of rows" thn I applied the above code but it returns only 2nd row. I have 2 rows in the table for this ID.
For what I understand, you want to get some extra data columns. Your best shot is to create a view to join these table and deliver the columns you need. If you need editing, you will have to create an instead of trigger on the view as well, to do a correct dml on one or both tables.
create view which joins both tables
create instead of trigger (if you need editing)
query of the Interactive Grid should be on the view
This solution adds the extra data columns to the source of the IG, which is better and easier in my opinion.

Append 2 queries result in repeating of data from first query

I am new to PowerBI and trying to append 2 queries into new query. But it is repeating data from the first query set and not creating an Append(I think i am correct if it is same as UNION in SQL). Here are the snapshots:
Query1
Query2
Resulting Append
Let me know what is wrong in this
Regards
In your data set it is doing a Union on the data as you mentioned. Append in Power Query will NOT remove duplicates (like a UNION ALL in SQL), you will have to use a 'Group By' step or 'Remove Duplicates' step after the append to remove the duplicates
Hope that helps
Go to Edit Queries and select your Query1 then go to Home > Append Queries as New. Chose your two tables (Query1 and Query2) and hit OK.
This should exactly append the two queries, without repeating any duplicates.

Oracle Apex Middle Table Insert

I have the following tables:- evaluations, evaluation_options and options. I am trying to create an evaluation and evaluation_option on one page.
To create the evaluation_option I will need evaluation_id after an evaluation is created. I am getting the option_id from a List of Value.
At this point, I am not sure how to get this done as I am new to PL-SQL & SQL.
For this, I did a dynamic query to create both tables. I don't think this is the best way of getting the job done, I am open up to resolve this in the right way.
This is my code:-
DECLARE
row_id evaluations.id%TYPE;
BEGIN
INSERT INTO EVALUATIONS (class_student_rotations_id, strengths,
suggestions) VALUES (:P12_CLASS_STUDENT_ROTATIONS_ID, :P12_STRENGTHS,
:P12_SUGGESTIONS);
SELECT id into row_id FROM EVALUATIONS WHERE ROWID=(select max(rowid)
from EVALUATIONS);
INSERT ALL
INTO evaluation_options (option_id, evaluation_id) VALUES
(:P12_APPLICATION_OF_BASICS, row_id)
SELECT * FROM DUAL;
END;

How to add a custom index by specific column value?

I have a table with with 2 columns:id(of a movie) and actor_name. For each id, there can be multiple actor names.
I want to add a new column with an index specific for each actor.
My table look like this:
Id.......actor_name
5........Al pacino
6........Tim Roth
7........Antonio Banderas
8........Al pacino
And I want it to look like this:
Id.......actor_name..............actor_number
5........Al pacino.................. 1
6........Tim Roth....................2
7........Antonio Banderas......3
8........Al pacino...................1
I'm doing this in power BI. I have a table with each actor and a specific index, but I can't make the connection between them because I don't have unique values in the the actor_name column.
Thank you in advance!
I would resolve this in the Query Editor/ Power Query. First I would build a query (lets call it Actor Index) by Reference to your "table with each actor and a specific index". I would either use Remove Rows / Remove Duplicates or Group By to ensure there are unique values for each actor_name.
Then over in your "My Table" query, I would add Merge and Expand steps to join to the new Actor Index and return the Index.

How to phrase sql query when selecting second table based on information on first table

I have two tables I would like to call, but I am not sure if it is possible to combine them into one query or I have to some how call 2 different queries.
Basically I have 2 tables:
1) item_table: name/id etc. + category ID
2) category_table: categoryID, categoryName, categoryParentID.
The parent categories are also inside the same table with their own name.
I would like to call on my details from item_table, as well as getting the name of the category, as well as the NAME of the parent category.
I know how to get the item_table data, plus the categoryName through an INNER JOIN. But can I use the same query to get the categoryParent's name?
If not, what would be the mist efficient way to do it? The rest of the code is in C++.
SELECT item_table.item_name, c1.name AS CatName, c2.name AS ParentCatName
FROM item_table join category_table c1 on item_table.categoryID=c1.categoryID
LEFT OUTER JOIN category_table c2 ON c2.categoryID = c1.categoryParentID
SQL Fiddle: here