SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
with my_date as (select trunc(to_date('30.12.2024', 'dd.mm.yyyy')) md from dual), matr AS (SELECT * FROM (SELECT LEVEL w FROM dual CONNECT BY LEVEL <= 6) r CROSS JOIN (SELECT 1 d1, 2 d2, 3 d3, 4 d4, 5 d5, 6 d6, 7 d7 FROM dual) s) SELECT * FROM matr m /*SELECT d.val, d.dt, trunc((d.dt - trunc(trunc(d.dt, 'MM'), 'IW')) / 7) + 1 w, d.dt - TRUNC(d.dt, 'IW') + 1 d FROM (SELECT LEVEL val, TRUNC(d.md, 'MM') + LEVEL - 1 dt FROM my_date d CONNECT BY LEVEl <= LAST_DAY(d.md) - TRUNC(d.md, 'MM') + 1) d*/;

Stuck with a problem? Got Error? Ask ChatGPT!

Copy Clear