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 | |
ts.tablespace_name as "Tablespace", | |
round(sum(df.bytes) / (1024*1024), 2) as "Total (MB)", | |
round(sum(df.bytes) / (1024*1024) - sum(fs.bytes) / (1024*1024), 2) as "Usado (MB)", | |
round(sum(fs.bytes) / (1024*1024), 2) as "Livre (MB)", | |
round(sum(fs.bytes) / sum(df.bytes) * 100, 4) as "Livre (%)", | |
100 - round(sum(fs.bytes) / sum(df.bytes) * 100, 4) as "Usado (%)" | |
from | |
dba_tablespaces ts | |
inner join dba_data_files df |
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
create or replace | |
type sysuser as object ( | |
user_client_name varchar(100), | |
user_version varchar(50), | |
user_name varchar(100), | |
user_password varchar(100), | |
user_db_host varchar(15) | |
); | |
/ |
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
begin | |
for cur_rec in | |
( | |
select | |
object_name, | |
object_type | |
from | |
user_objects | |
where | |
status <> 'VALID' |
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
Show hidden characters
{ | |
"cmd": ["sqlplus", "dummy/dummy@local", "@$file"], | |
"selector": "source.sql", | |
"encoding": "cp1252" | |
} |
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
declare | |
cursor c_sql_stmt is | |
select | |
cl.table_name, | |
cl.column_name, | |
'UPDATE '||cl.table_name||' set '||cl.column_name||' = :1 where regexp_like('||cl.column_name||', :2, ''i'')' as cmd | |
from | |
user_tab_columns cl | |
inner join user_tables tb | |
on tb.table_name = cl.table_name |
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 | |
tb.table_name, count(*) as num_cons | |
from | |
user_tables tb | |
inner join user_constraints ct | |
on ct.table_name = tb.table_name | |
inner join user_cons_columns cc | |
on cc.constraint_name = ct.constraint_name | |
and cc.table_name = ct.table_name | |
where |
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
# a * x**2 + b * x + c = 0, a != 0 | |
# (-b +- sqrt(d) ) / 2 * a | |
# d = b**2 - 4 * a * c | |
from math import sqrt | |
#print 3 ** 2 | |
#print sqrt(9) | |
def get_d(a, b, c): | |
return ( b ** 2 ) - ( 4 * a * c ) |
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
# -*- coding: cp1252 -*- | |
import os | |
import time | |
import re | |
import cx_Oracle | |
class Exec: | |
debug = True | |
@staticmethod |
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 | |
jb.* | |
FROM | |
jobs jb | |
INNER JOIN jobs_skills jbs | |
ON jbs.job_id = jb.id | |
INNER JOIN skills skj | |
ON skj.id = jbs.skill_id | |
LEFT JOIN ( |
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
/** | |
* This sh*t is a dummy query to help a jenius fréndo | |
* | |
* The problem: get a dataset with the Job vs Candidate - Skill analysis, and answer: which candidate better fits the given job skills? | |
* | |
* Consider: | |
* - A Job is composed by many Skills | |
* - And so is the Candidate... | |
* | |
* Use your imagination, cuz this is just a dummy script, I wont create any schema... >:D |