Last active
May 29, 2018 21:56
-
-
Save veysiertekin/9756823 to your computer and use it in GitHub Desktop.
PL/SQL mini tricks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select UTL_ENCODE.BASE64_DECODE(utl_raw.cast_to_raw('<base64_string>')) from dual; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
(select rtrim(xmlagg(xmlelement(el, nvl(t.column1, t.column2 || ' ' || t.column3) || ',')) | |
.extract('//text()'), | |
',') | |
from table_name t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select (dateLast-dateFirst) * decode( upper('SS'/* one of the operands */), 'SS', 24*60*60, 'MI', 24*60, 'HH', 24, NULL ) from dual; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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