메뉴 건너뛰기

Korea Oracle User Group

새소식

Oracle Database 23c Free Developer Release - 10 features you should know

 

URL : https://blogs.oracle.com/coretec/post/oracle-database-23c-free-developer-sql

 

오라클에서 23c 프리 개발자 릴리즈를 발표하고 관련 내용을 많이 올려주네요.

괜찮은 내용이 있어서 가져 왔습니다.

새로운 버전에 대해 새로운 학습을 해 보는 것도 재미있을 거 같습니다.

 

아래는 원문입니다.


Oracle Database 23c Free Developer Release - 10 features you should know

Ulrike Schwinn
Distinguished Data Management Expert
Witold Swierzy
Data Management Expert
Stephane Duprat
Technical License Eng Specialist

We just announced Oracle 23c FREE - Developer release. First information are be found in the blog posting Introducing Oracle Database 23c Free – Developer Release from product manager Gerald Venzl.  In addition there is a forum page for questions you may have and much more.  All important links are added at the end of this posting.  
What is this release all about? Oracle Database 23c Free – Developer Release is the first release of the next-generation Oracle Database, allowing developers a head-start on building applications with 23c features that simplify development of modern data-driven apps. However please keep in mind the entire feature set of Oracle Database 23c is planned to be generally available within the next 12 months.

How can you use it? If you are interested in downloading the software, trying the Docker repo or downloading the VirtualBox VM image, you can visit the following pages:

The following development software is usually not included with Oracle Database 23c Free - except for the VirtualBox Appliance. You can download them separately and use them with Oracle Database 23c Free:

  • Oracle APEX
  • Oracle Developer Tools for Visual Studio
  • Oracle REST Data Services (ORDS)
  • Oracle SQL Developer

However in the  case of Oracle Database 23c Free - Developer Release VirtualBox Appliance you will get a virtual guest appliance that provides pre-configured Oracle software such as Oracle Linux 8.7, Oracle Database 23.2 Free - Developer Release for Linux x86-64, Oracle REST Data Services 23.1, Oracle SQLcl 23.1, Oracle APEX 22.2.

The Installation Guide is also available where you can find notes on installation and on limitations for this release. In short be aware of the following:  

  • The maximum amount of user data in Oracle Database Free cannot exceed 12 GB.
  • The maximum amount of RAM for Oracle Database Free cannot exceed 2 GB.
  • Oracle Database Free limits itself automatically to two cores for processing. 
  • Oracle Database Free restricts itself to only one installation per logical environment.

If you want to get an overall overview and a short description of all the new features provided by Oracle Database Free, check out the New Features guide. In the Database Licensing Information User Manual you will find a list of permitted features and options in chapter 1.3 Permitted Features, Options, and Management Packs by Oracle Database Offering.

My colleagues Witold, Stephane and I have started to investigate the 23c features and tested some SQL features first after a quick and easy installation of Oracle Database Free using RPM packages. 
In this posting you find a short presentation of the following 9 SQL features. More features will be presented in upcoming postings.

The order of the feature list doesn't reflect any ranking of importance. 

Aliases in GROUP BY clause 

Oracle Database 23c, among of a lot of other features, introduces the ability to use aliases in GROUP BY clause of a SELECT statement. This feature simplifies writing queries with complex expressions as well as ensures better compatibility with some other relational databases, like Teradata, MySQL and PostgreSQL so for example:

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SELECT to_char(hiredate,'YYYY') "Year", count(*)
FROM emp
GROUP BY to_char(hiredate,'YYYY');

In Oracle 23c database can be written in a bit simpler way:

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SELECT to_char(hiredate,'YYYY') "Year", count(*)
FROM emp
GROUP BY "Year";
Year   COUNT(*)
---- ----------
1981         10
1987          2
1980          1
1982          1

FROM clause - now optional

Another interesting feature introduced in Oracle Database 23c is optionality of FROM clause in SELECT statements. Up to this version this clause was obligatory. However there are some databases in the market, like MS SQL Server, MySQL and PostgreSQL, where this clause is optional. Since then, as in previous case, this feature ensures better compatibility with such databases. So, for example, the following statement executed in any earlier, than 23c, version of Oracle Database:

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> SELECT sysdate;

returns the following error:

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
select sysdate
*
ERROR at line 1:
ORA-00923: FROM keyword not found where expected

While it is executed succesfully in Oracle Database 23c:

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> SELECT sysdate;

SYSDATE
---------
04-APR-23

Boolean for SQL

Oracle database 23c introduces the new BOOLEAN datatype. This leverages the use of true boolean columns/variables, instead of simulating them whith a numeric value. The ability to write boolean predicates simplifies the syntax of SQL statements.

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
create table TEST_BOOLEAN
( name VARCHAR2(100),
  IS_SLEEPING BOOLEAN);
Table created.​
Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> alter table TEST_BOOLEAN modify (IS_SLEEPING boolean NOT NULL);
Table altered.
Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> alter table TEST_BOOLEAN modify (IS_SLEEPING default FALSE);
Table altered.
Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> insert into TEST_BOOLEAN (name) values ('Mick');
​1 row created.​
Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> insert into TEST_BOOLEAN (name, is_sleeping) values ('Keith','NO');
​1 row created.
Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> insert into TEST_BOOLEAN (name, is_sleeping) values ('Ron',1);
1 row created.
Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> select name from test_boolean where not is_sleeping;
NAME
--------------------------------------------------------------------------------
Mick
Keith

SQL> set linesize window
SQL> select * from test_boolean;

NAME                                                                                                 IS_SLEEPING
---------------------------------------------------------------------------------------------------- -----------
Mick                                                                                                 FALSE
Keith                                                                                                FALSE
Ron                                                                                                  TRUE
Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> select dump(is_sleeping) from test_boolean where name = 'Ron';​
Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
DUMP(IS_SLEEPING)
--------------------------------------------------------------------------------
Typ=252 Len=1: 1
 

IF [NOT] EXISTS DDL clause

​Starting with Oracle Database 23c, the new "IF [NOT] EXISTS" DDL clause allows to decide how DDL errors will be handled. This simplifies the DDL scripting, as potential errors due to objects existence or inexistence can be hidden to the scripting.
In the case the table DEPT exists:

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> desc dept
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 DEPTNO                                    NOT NULL NUMBER(2)
 DNAME                                              VARCHAR2(14)
 LOC                                                VARCHAR2(13)
Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> create table if not exists scott.dept (deptno number, dname varchar2(10), deptno varchar2(15));
Table created.

Now let's drop the helper table dept1 ...

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> create table dept1 as select * from dept;
Table created.

SQL> drop table if exists dept1;
Table dropped.

New table value constructor

Starting from Oracle database 23c, table values constructor has been extended. It can now be used in INSERT statements, to create several rows in a single command.It can also be used in SELECT statements, and in the view factorization syntax. In this last case, it simplifies the syntax of the statements, and avoid using the DUAL table.

The following statement looks like a kind of table function on the fly ...

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> SELECT * FROM (VALUES (50,'HR'), (60,'DEV'), (70,'AI')) virt_dept (deptno, dname);
 
    DEPTNO DNA
---------- ---
        50 HR
        60 DEV
        70 AI

Multivalue INSERTs

Another interesting feature ensuring better coexistence and compatitility with other frequently used database management systems is multivalue INSERT statement.
In previous versions of Oracle database, to insert, for example 3 rows it was needed to execute three separate insert statements, for example:

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
insert into DEPT values (50,'HR','LOS ANGELES');
insert into DEPT values (60,'IT','SAN FRANCISCO');
insert into DEPT values (70,'MANUFACTURING','DETROIT');

Oracle database 23c, smilarly to other databases, like PostgreSQL, introduced the new syntax allowing for inserting all these rows in a single one INSERT statement, so you may insert several tuples in one DML...

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> insert into DEPT values 
     (50,'HR','LOS ANGELES'), 
     (60,'IT','SAN FRANCISCO'),
     (70,'MANUFACTURING','DETROIT');
3 rows created.

Among better compatibility with some other databases, this statement can be also used to ensure consistency of some insert operations in autocommit mode, which can be important
for, for example, for some APEX applications using this mode to work on a data.

RETURNING clause of UPDATE and MERGE statement

This clause has been implemented long time ago as a part of EXECUTE IMMEDIATE statement. However in Oracle Database 23c we can find it as a part of traditional, static DML statements - in this case it allows for obtaining old and new values of columns from a row processed by such statement:

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> SELECT ename, sal FROM emp
     WHERE ename = 'KING';

ENAME             SAL
---------- ----------
KING             5000

SQL> VARIABLE old_salary NUMBER
SQL> VARIABLE new_salary NUMBER

SQL> UPDATE emp
     SET sal=sal+1000
     WHERE ename = 'KING'
     RETURNING OLD sal, NEW sal into :old_salary, :new_salary;
1 row updated.

SQL> PRINT old_salary
OLD_SALARY
----------
      5000

SQL> PRINT new_salary
NEW_SALARY
----------
      6000

Joins in UPDATE and DELETE

You may update table date via joins - based on foreign table conditions. There is no need for sub  selects or IN clause. For example in instead of using prior to 23c the folliwng statements

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
update emp e set e.sal=e.sal*2
where e.deptno in 
(select d.deptno from dept d where e.deptno=d.deptno 
and d.dname='RESEARCH')

You may use now ...

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> update emp e set e.sal=e.sal*2
from dept d
where e.deptno=d.deptno
and d.dname='RESEARCH';  
5 rows updated. 
 

Annotations, new metadata for database objects

Annotations are optional meta data for database objects. An annotation is either a name-value pair or name by itself. The name and optional value are freeform text fields.  An annotation is represented as a subordinate element to the database object to which the annotation has been added. Supported schema objects include tables, views, materialized views, and indexes. With annotations you may store and retrieve metadata about a database objects. You can use it to customize business logic, user interfaces or provide metada to metatdata repositories. It can be added with CREATE or ALTER statement. - on table or column level. 
With annotations you may store and retrieve metadata about a database objects. You can use it to customize business logic, user interfaces or provide metada to metatdata repositories.

Let's create an annotated table emp_annotated with column and table annotations. 

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
create table emp_annotated
( empno number annotations(identity, display 'person_identity', details 'person_info'),
  ename varchar2(50),
  salary number annotations (display 'person_salary', col_hidden))
  annotations (display 'employee_table')
/  

Data Dictionary views such as User_ANNOTATIONS, USER_ANNOTATION_VALUES or USER_ANNOTATIONS_USAGE can help to monitor the usage.

"Light weight object types" with SQL Domains

A SQL domain is a dictionary object that belongs to a schema and encapsulates a set of optional properties and constraints and is created with a CREATE DOMAIN statement. Domains provide constraints, display, ordering and annotations attributes. After you define a SQL domain, you can define table columns to be associated with that domain, thereby explicitly applying the domain's optional properties and constraints to those columns.  
SQL Domains allow users to declare the intended usage for columns. They are data dictionary objects so that abstract domain specific knowledge can be easily reused.

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> create domain yearbirth as number(4)
     constraint check ((trunc(yearbirth) = yearbirth) and (yearbirth >= 1900))
     display (case when yearbirth < 2000 then '19-' ELSE '20-' end)||mod(yearbirth, 100)
     order (yearbirth -1900)
     annotations (title 'yearformat');

SQL> create table person
     ( id number(5),
       name varchar2(50),
       salary number,
       person_birth number(4) DOMAIN yearbirth
      )
     annotations (display 'person_table'); 
Table created.

SQL> desc person
 Name                                                                      Null?    Type
-------------------------------------------------------------------------- -------- ----------------------------
 ID                                                                                  NUMBER(5)
 NAME                                                                                VARCHAR2(50)
 SALARY                                                                              NUMBER
 PERSON_BIRTH                                                                        NUMBER(4) SCOTT.YEARBIRTH

SQL> insert into person values (1,'MARTIN',3000, 1988);

With the new function DOMAIN_DISPLAY you can display the property.

Copied to Clipboard
Error: Could not Copy
Copied to Clipboard
Error: Could not Copy
SQL> select DOMAIN_DISPLAY(person_birth) from person;

DOMAIN_DISPLAY(PERSON_BIRTH)
-------------------------------------------
19-88

Domain usage and Annotations can be monitored with data dictionary views e.g.

SQL> select * from user_annotations_usage;

OBJECT_NAME     OBJECT_TYP COLUMN_NAME     DOMAIN_NAM DOMAIN_OWN ANNOTATION_NAME      ANNOTATION_VALUE
--------------- ---------- --------------- ---------- ---------- -------------------- ----------------
EMP_ANNOTATED   TABLE                                            DISPLAY              employee_table
PERSON          TABLE                                            DISPLAY              person_table
EMP_ANNOTATED   TABLE      EMPNO                                 IDENTITY
EMP_ANNOTATED   TABLE      EMPNO                                 DISPLAY              person_identity
EMP_ANNOTATED   TABLE      EMPNO                                 DETAILS              person_info
EMP_ANNOTATED   TABLE      SALARY                                DISPLAY              person_salary
EMP_ANNOTATED   TABLE      SALARY                                COL_HIDDEN
YEARBIRTH       DOMAIN                                           TITLE                yearformat
PERSON          TABLE      PERSON_BIRTH    YEARBIRTH  SCOTT      TITLE                yearformat
번호 제목 글쓴이 날짜 조회 수 추천 수
158 MariaDB Enterprise 10.6.12-8 now available 명품관 2023.05.25 947 0
157 Oracle Linux and Unbreakable Enterprise Kernel (UEK) Releases 명품관 2023.05.24 5100 0
156 ODA 19.19 Release is Now Available! 명품관 2023.05.24 1088 0
155 PostgreSQL 15.3, 14.8, 13.11, 12.15, and 11.20 Released! 명품관 2023.05.18 7332 0
154 PgBouncer 1.19.0 released 명품관 2023.05.18 4511 0
153 MariaDB 10.11.3, 10.10.4, 10.9.6, 10.8.8, 10.6.13, 10.5.20, 10.4.29 and 10.3.39 now available 명품관 2023.05.18 948 0
152 MariaDB Node.js Connector 3.1.2 now available 명품관 2023.05.04 2740 0
151 Oracle Spatial Studio 23.1 Free 릴리즈 명품관 2023.05.04 6299 0
150 Exadata System Software Updates - April 2023 명품관 2023.05.03 806 0
149 MariaDB Java Connector 3.1.4 now available 명품관 2023.05.03 814 0
148 Oracle GoldenGate Free 21c now available! 명품관 2023.05.03 4339 0
147 Oracle Database World 2023 - Watch the Replays 명품관 2023.04.28 917 0
146 ACE Blog Posts and Podcasts April 10 – April 19, 2023: Oracle 23c Free Developer Release, APEX, Database, OCI, SQL, Analytics and More 명품관 2023.04.21 1125 0
145 MySQL 8.0.33 GA(General Availability) 릴리즈(2023-04-18) 명품관 2023.04.20 1402 0
144 오라클 April 2023 Critical Patch Update Released 명품관 2023.04.19 1008 0
143 Oracle Database Monthly News - March 2023 - Quick Links 명품관 2023.04.18 5740 0
142 pgAdmin 4 v7.0 Released 명품관 2023.04.18 730 0
141 MariaDB ODBC Connector 3.1.18 now available 명품관 2023.04.18 891 0
» Oracle Database 23c Free Developer Release - 10 features you should know 명품관 2023.04.13 775 0
139 Oracle Enterprise Manager 13c Release 5 Update 14 (13.5.0.14) is now available 명품관 2023.04.11 1254 0
위로