How to convert some Oracle to MYSQL Queries
Hello,
i want to convert Oracle Queries to MYSQL Queries, but i have problems with some of them.
The Queries are like this:
1) MERGE INTO tab1 d1
USING tab d2
ON (d1.id = d2.id)
WHEN MATCHED THEN
UPDATE SET d1.zufriedenheit = 'Merge Update'
WHEN NOT MATCHED THEN
INSERT (d1.id, d1.typ, d1.active, d1.zufriedenheit)
VALUES (d2.id, d2.typ, d2.dpr_scd_active,'Merge Insert');
2) SELECT
REGEXP_REPLACE(tab1, '(.)', '\1 ') "REGEXP_REPLACE",
REGEXP_SUBSTR(tab1,'([[:alnum:]]+\.?){3,4}/?') "REGEXP_SUBSTR", tab2
FROM tab2
WHERE REGEXP_LIKE (tab2, '([8])\1', 'i');
3) SELECT *
FROM
(select tab1, tab2, avg(tab3),
DENSE_RANK() OVER ( PARTITION BY tab1 ORDER BY(tab3)) as Rang
FROM
.
.
.
where Rang < 11
..;
4) SELECT * FROM (
......)
WHERE rownum <= 100;
(I have found a alternative for rownum, but with the constraint rownum <= 100 it doesn´t work.)
5) SELECT tab1, tab2,
SUM(tab2) OVER (PARTITION BY tab1) as res1,
tab3,
SUM(tab3) OVER (PARTITION BY tab1) as res2,
tab4,
SUM(tab4) OVER (PARTITION BY tab1) as res3,
from (
.
.
.
Maybe you can help me with some of them.