Skip to content

Instantly share code, notes, and snippets.

View martindsouza's full-sized avatar

Martin Giffy D'Souza martindsouza

View GitHub Profile
@martindsouza
martindsouza / get-dynamic-date-range.sql
Last active March 8, 2022 03:45
get dynamic date range
-- Pure SQL way to get dynamic date range instead of pipelined function
-- as shown here: https://twitter.com/cczarski/status/1500830480358330370
with
data as (
select
level insert_order,
decode(level,
1, 'Since Yesterday',
2, 'Last Week',
3, 'Last Month',
-- Feedback based on https://www.insum.ca/feuertip-7-how-not-to-handle-dml-errors/
create or replace procedure full_of_dml (
p_order in number,
p_lines in lines_t
)
is
l_scope logger_logs.scope%type := 'full_of_dml';
l_params logger.tab_param;
begin
-- Test
-- Another test
alias testmartin=select 1
from dual
/
alias fk=select f.constraint_name, f.r_owner || '.' || f.r_constraint_name reference_constraint
, t.table_name
@martindsouza
martindsouza / test.sql
Last active December 28, 2020 23:50
Test sql
-- prompt hello from github
select sysdate
from dual
;