Skip to content

Instantly share code, notes, and snippets.

@rafrancoso
Created March 6, 2019 19:14
Show Gist options
  • Save rafrancoso/9a9a4f654f928b454b52ead952f2bc48 to your computer and use it in GitHub Desktop.
Save rafrancoso/9a9a4f654f928b454b52ead952f2bc48 to your computer and use it in GitHub Desktop.
Calcular a data da páscoa, Paixão de Cristo e Carnaval
/*Busca via WS a data da Páscoa de cada ano e calcula o carnaval, Paixão de Cristo e Corpus Christi entre 2019 e 2029*/
SELECT ANO
,PASCOA
,PASCOA - 47 AS CARNAVAL
,PASCOA - 2 AS PAIXAO_DE_CRISTO
,PASCOA + 60 AS CORPUS_CHRISTI
FROM (SELECT 2000 + LEVEL AS ANO
,CAST(TO_TIMESTAMP_TZ(EXTRACTVALUE(HTTPURITYPE('www.holidaywebservice.com/Holidays/GBSCT/Dates/GBSCTHolidayDates.asmx/GetEaster?year=' || TO_CHAR(2000 + LEVEL))
.GETXML(),
'/dateTime',
'xmlns="http://www.27seconds.com/Holidays/GBSCT/Dates/"'),
'YYYY-MM-DD"T"HH24:MI:SS.FF7TZH:TZM') AS DATE) AS PASCOA
FROM DUAL
CONNECT BY LEVEL BETWEEN 1 AND 29)
WHERE ANO >= 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment