Oracle - Features and Utilities
Useful little things and queries that may be useful with their description.
1. Get a list of all fields of the table that interests us.
select column_name
from user_tab_columns
where upper(table_name) = upper(\'название_таблицы\')
2. Change the default date format in the session.
alter session set NLS_DATE_FORMAT = \'dd.mm.yyyy hh24:mi:ss\';
— The set format will be in effect until the session is closed.
3. Create a partitioned table.
(each month in a new partition, with a large amount of data, it significantly speeds up queries)
(the topic is very extensive, with many possibilities, but here is only a brief example)
create table
table_data_part (
dt DATE
)
PARTITION BY RANGE (dt)
INTERVAL(NUMTOYMINTERVAL(1, \'MONTH\'))
(
PARTITION initial VALUES LESS THAN (TO_DATE(\'1-7-2007\', \'DD-MM-YYYY\'))
);
For this table, data for each month, starting from July 1, 2017, will be stored in a separate partition. At the same time, they will be created automatically.
4. Leave only symbols in the string.
select regexp_replace(\'Входная строка 12\',\'[^[[:alpha:]]]*\') from dual;
Результат:
"Входнаястрока"
5. Leave only digits in the string.
select regexp_replace(\'Входная строка 12\',\'[^[[:digit:]]]*\') from dual;
Результат:
"12"
Comments (0)
No comments yet.