WITH
--один запрос
SINGLE_QUERY AS
( SELECT '0001' AS GROUP_ID, 'Moscow' AS V1, 1300 AS V2 FROM DUAL
UNION ALL
SELECT '0001' AS GROUP_ID, 'London' AS V1, 900 AS V2 FROM DUAL
UNION ALL
SELECT '0001' AS GROUP_ID, 'New York' AS V1, 1600 AS V2 FROM DUAL
UNION ALL
SELECT '0001' AS GROUP_ID, 'Berlin' AS V1, 1000 AS V2 FROM DUAL
),
--список групп
GROUPS AS
( SELECT TO_CHAR(LEVEL,'0009') GROUP_ID FROM DUAL CONNECT BY LEVEL<=99
)
--для проверки
--select group_id, v1, v2 from single_query;
--select group_id from groups;
--результат
SELECT GROUPS.GROUP_ID,
SINGLE_QUERY.V1,
SINGLE_QUERY.V2
FROM SINGLE_QUERY,
GROUPS
ORDER BY 1;
with inp as (
select 1 id from dual union all
select 2 from dual union all
select 3 from dual union all
select 4 from dual union all
select 5 from dual union all
select 6 from dual)
SELECT
id
FROM
inp
ORDER BY
abs( (
SELECT
AVG(id)
FROM
inp
) - id),
id;
import numpy as np
shape = (4,4)
np.core.defchararray.add('x_',(((np.arange(shape[0])+1)*10).reshape(-1,1)+1 + np.arange(shape[1])).astype(np.str))
array([['x_11', 'x_12', 'x_13', 'x_14'],
['x_21', 'x_22', 'x_23', 'x_24'],
['x_31', 'x_32', 'x_33', 'x_34'],
['x_41', 'x_42', 'x_43', 'x_44']],
dtype='<U13')
Если есть доступ под sys, то, например, вот так:
select a.ksppinm name,
b.ksppstvl value,
b.ksppstdf deflt,
decode
(a.ksppity, 1,
‘boolean’, 2,
‘string’, 3,
‘number’, 4,
‘file’, a.ksppity) type,
a.ksppdesc description
from
sys.x$ksppi a,
sys.x$ksppcv b
where
a.indx = b.indx
and
a.ksppinm like ‘\_%’ escape ‘\’
order by
name
show parameter complex_view_merging
import datetime
import json
in_data = {}
in_data['2018']={'11': ['3', '4', '5', '10', '11', '17', '18', '24', '25'],
'10': ['6', '7', '13', '14', '20', '21', '27', '28'],
'12': ['1', '2', '8', '9', '15', '16', '22', '23', '29', '30', '31*'],
'1': ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '13', '14', '20', '21', '27', '28'],
'3': ['3', '4', '7*', '8', '10', '11', '17', '18', '24', '25', '31'],
'2': ['3', '4', '10', '11', '17', '18', '22*', '23', '24', '25'],
'5': ['1', '5', '6', '8*', '9', '12', '13', '19', '20', '26', '27'],
'4': ['1', '7', '8', '14', '15', '21', '22', '28', '29', '30*'],
'7': ['1', '7', '8', '14', '15', '21', '22', '28', '29'],
'6': ['2', '3', '9', '10', '11*', '12', '16', '17', '23', '24', '30'],
'9': ['1', '2', '8', '9', '15', '16', '22', '23', '29', '30'],
'8': ['4', '5', '11', '12', '18', '19', '25', '26']}
print(json.dumps(dict([[year,
dict([[month,
dict([[day,
{'isWorking':2}] for day in in_data[year][month]])
] for month in in_data[year]]
)] for x in in_data]
), indent=4, sort_keys=4
))
{
"2018": {
"1": {
"1": {
"isWorking": 2
},
"10": {
"isWorking": 2
},
"13": {
"isWorking": 2
},
"14": {
"isWorking": 2
},
"2": {
"isWorking": 2
},
"20": {
"isWorking": 2
},
"21": {
"isWorking": 2
},
"27": {
"isWorking": 2
},
"28": {
"isWorking": 2
},
"3": {
"isWorking": 2
},
"4": {
"isWorking": 2
},
"5": {
"isWorking": 2
},
"6": {
"isWorking": 2
},
"7": {
"isWorking": 2
},
"8": {
"isWorking": 2
},
"9": {
"isWorking": 2
}
},
"10": {
"13": {
"isWorking": 2
},
"14": {
"isWorking": 2
},
"20": {
"isWorking": 2
},
"21": {
"isWorking": 2
},
"27": {
"isWorking": 2
},
"28": {
"isWorking": 2
},
"6": {
"isWorking": 2
},
"7": {
"isWorking": 2
}
},
"11": {
"10": {
"isWorking": 2
},
"11": {
"isWorking": 2
},
"17": {
"isWorking": 2
},
"18": {
"isWorking": 2
},
"24": {
"isWorking": 2
},
"25": {
"isWorking": 2
},
"3": {
"isWorking": 2
},
"4": {
"isWorking": 2
},
"5": {
"isWorking": 2
}
},
"12": {
"1": {
"isWorking": 2
},
"15": {
"isWorking": 2
},
"16": {
"isWorking": 2
},
"2": {
"isWorking": 2
},
"22": {
"isWorking": 2
},
"23": {
"isWorking": 2
},
"29": {
"isWorking": 2
},
"30": {
"isWorking": 2
},
"31*": {
"isWorking": 2
},
"8": {
"isWorking": 2
},
"9": {
"isWorking": 2
}
},
"2": {
"10": {
"isWorking": 2
},
"11": {
"isWorking": 2
},
"17": {
"isWorking": 2
},
"18": {
"isWorking": 2
},
"22*": {
"isWorking": 2
},
"23": {
"isWorking": 2
},
"24": {
"isWorking": 2
},
"25": {
"isWorking": 2
},
"3": {
"isWorking": 2
},
"4": {
"isWorking": 2
}
},
"3": {
"10": {
"isWorking": 2
},
"11": {
"isWorking": 2
},
"17": {
"isWorking": 2
},
"18": {
"isWorking": 2
},
"24": {
"isWorking": 2
},
"25": {
"isWorking": 2
},
"3": {
"isWorking": 2
},
"31": {
"isWorking": 2
},
"4": {
"isWorking": 2
},
"7*": {
"isWorking": 2
},
"8": {
"isWorking": 2
}
},
"4": {
"1": {
"isWorking": 2
},
"14": {
"isWorking": 2
},
"15": {
"isWorking": 2
},
"21": {
"isWorking": 2
},
"22": {
"isWorking": 2
},
"28": {
"isWorking": 2
},
"29": {
"isWorking": 2
},
"30*": {
"isWorking": 2
},
"7": {
"isWorking": 2
},
"8": {
"isWorking": 2
}
},
"5": {
"1": {
"isWorking": 2
},
"12": {
"isWorking": 2
},
"13": {
"isWorking": 2
},
"19": {
"isWorking": 2
},
"20": {
"isWorking": 2
},
"26": {
"isWorking": 2
},
"27": {
"isWorking": 2
},
"5": {
"isWorking": 2
},
"6": {
"isWorking": 2
},
"8*": {
"isWorking": 2
},
"9": {
"isWorking": 2
}
},
"6": {
"10": {
"isWorking": 2
},
"11*": {
"isWorking": 2
},
"12": {
"isWorking": 2
},
"16": {
"isWorking": 2
},
"17": {
"isWorking": 2
},
"2": {
"isWorking": 2
},
"23": {
"isWorking": 2
},
"24": {
"isWorking": 2
},
"3": {
"isWorking": 2
},
"30": {
"isWorking": 2
},
"9": {
"isWorking": 2
}
},
"7": {
"1": {
"isWorking": 2
},
"14": {
"isWorking": 2
},
"15": {
"isWorking": 2
},
"21": {
"isWorking": 2
},
"22": {
"isWorking": 2
},
"28": {
"isWorking": 2
},
"29": {
"isWorking": 2
},
"7": {
"isWorking": 2
},
"8": {
"isWorking": 2
}
},
"8": {
"11": {
"isWorking": 2
},
"12": {
"isWorking": 2
},
"18": {
"isWorking": 2
},
"19": {
"isWorking": 2
},
"25": {
"isWorking": 2
},
"26": {
"isWorking": 2
},
"4": {
"isWorking": 2
},
"5": {
"isWorking": 2
}
},
"9": {
"1": {
"isWorking": 2
},
"15": {
"isWorking": 2
},
"16": {
"isWorking": 2
},
"2": {
"isWorking": 2
},
"22": {
"isWorking": 2
},
"23": {
"isWorking": 2
},
"29": {
"isWorking": 2
},
"30": {
"isWorking": 2
},
"8": {
"isWorking": 2
},
"9": {
"isWorking": 2
}
}
}
}