Skip to content

Instantly share code, notes, and snippets.

@veysiertekin
Last active May 29, 2018 21:56
Show Gist options
  • Save veysiertekin/9756823 to your computer and use it in GitHub Desktop.
Save veysiertekin/9756823 to your computer and use it in GitHub Desktop.
PL/SQL mini tricks
select UTL_ENCODE.BASE64_DECODE(utl_raw.cast_to_raw('<base64_string>')) from dual;
select
(select rtrim(xmlagg(xmlelement(el, nvl(t.column1, t.column2 || ' ' || t.column3) || ','))
.extract('//text()'),
',')
from table_name t
select (dateLast-dateFirst) * decode( upper('SS'/* one of the operands */), 'SS', 24*60*60, 'MI', 24*60, 'HH', 24, NULL ) from dual;
select * from
(select 5 c from dual
UNION
select 6 c from dual)
where c in (
select regexp_substr('2,5,3','[^,]+', 1, level) from dual
connect by regexp_substr('2,5,3', '[^,]+', 1, level) is not null
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment