메뉴 건너뛰기

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
번호 제목 글쓴이 날짜 조회 수 추천 수
189 MariaDB 10.4.2 Beta Release 명품관 2019.02.01 352769 0
188 Announcing the general availability of Oracle Linux 7.2 명품관 2015.11.30 187076 0
187 MOS Note:136697.1 - New HCHECK.SQL for Oracle Database 12c 명품관 2016.06.01 119170 0
186 MOATS: The Mother of All Tuning Scripts! (by TANEL PODER) 명품관 2016.04.28 83530 0
185 오라클 18c Express Edition(XE) 윈도우 버전 사용 가능 명품관 2019.02.22 64340 0
184 Oracle Database 19c 다운로드 가능 명품관 2019.04.30 59607 0
183 Oracle Magazine Junary/February 2019 명품관 2019.03.12 39978 0
182 Watch featured OTN Virtual Technology Summit Replay Sessions - Nov 30, 2015 명품관 2015.12.01 29323 0
181 Time-out and Thanks by Tom Kyte (Tom Kyte 의 휴식) 명품관 2016.01.08 20656 0
180 MySQL Database Service (in Oracle Cloud Infrastructure) file 명품관 2021.02.04 16648 0
179 오라클 릴리즈 로드맵 [2] file 명품관 2019.05.15 7234 1
178 New! Announcing MySQL Enterprise Transparent Data Encryption 명품관 2016.04.23 6090 0
177 Oracle Cloud Infrastructure and Red Hat Enterprise Linux 명품관 2023.02.01 5722 0
176 오라클 19c에서 desupport 되는 기능들 명품관 2019.02.19 5179 0
175 Oracle Database 19c 매뉴얼 문서 오픈 명품관 2019.02.15 4532 0
174 오라클 클라우드 피닉스, 서울 리전이 마이크로소프트 Azure와 연결 리전으로 추가 명품관 2022.01.28 4436 0
173 오라클 데이터베이스 19c 버전이 리눅스 8.x Update 1+에서 인증 명품관 2020.05.14 4366 0
172 Oracle Database Migration Assistant for Unicode(DMU) 명품관 2016.05.31 4044 0
171 Oracle Database 19c requires OL7, RHEL7 or SLES12 or newer 명품관 2019.02.15 3859 0
170 Oracle Database certification on Microsoft Windows 10 명품관 2016.01.08 3136 0
위로