A useful example of changing the encoding (COLLATION) on an already created database. In this example, the Russian encoding is set: Cyrillic_General_CI_AS USE master; GO -- Switching the DB to single-user mode ALTER DATABASE [database_name] SET…
The correct way to delete a temporary table: IF OBJECT_ID('tempdb.dbo.#tmp', 'U') IS NOT NULL DROP TABLE #tmp;
Simple example of generating MD5 on Oracle PL/SQL. declare cln_md5raw raw(2000); out_raw raw(16); begin cln_md5raw := utl_raw.cast_to_raw('Our text for hashing'); dbms_obfuscation_toolkit.md5(input=>cln_md5raw,checksum=>out_raw); -- Output
All the below steps were performed on a Windows server. To create a backup, open the command prompt cmd.exe In the command prompt, run the RMAN utility Next, for a database backup without Archive Logs:
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('table_name') 2. Change the default date format in the session. ...
В Oracle присутствует возможность объединять выборки. Для объединения используются операторы: UNION (с вариацией UNION ALL ), INTERSECT и MINUS . Рассмотрим работу всех этих операторов. 1. UNION и UNION ALL UNION — объединяет наборы данных,…
MERGE — Function intended for merging the result of some query into a receiving table, it is not necessary for the field composition to match. Applied when it is necessary to supplement some table with new data, updating existing data in the table simultaneously. Implementation:
To write a script to select all user tables with fields and comments, we need system tables: user_tables --Selecting all user tables and their parameters select * from user_tables user_tab_comments -…
In the previous publication, some methods of manipulating XML in Oracle were considered, now let's consider how to retrieve data directly in XML. This is, in my opinion, the most interesting part. In practice, it turned out that for Oracle in most cases it does not matter whether to return a set of records or a formed ready XML of this set of records - in terms of execution time these actions are subjectively almost equivalent. But if you have a need to form some XML structure in the application based on data received from the Oracle database, it will almost certainly be a resource-intensive event, much easier to transfer this functionality to the database, although at first glance it seems that this is not what the database engine should do.
In this publication, I will provide the main ways of working with XML in Oracle, which I use myself. Here, examples of such operators and functions as: XMLType, XMLElement, xmlattributes, XMLAGG, XMLSequence, insertchildxml, xmlconcat will be considered.