3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Oracle Database 23cで追加されたSQLの新機能"SELECT Without FROM Clause"をFree版で試してみた

Posted at

23cから"SELECT Without FROM Clause"機能が追加され、DUAL表を使う問合せに関して"FROM DUAL"句の記述が不要となりました。
これにより、SYSDATEの出力などが以下のように書けます

SQL> SELECT SYSDATE;

SYSDATE
--------
23-06-07

SQL> SELECT 1+2;

       1+2
----------
         3

ちなみに 10053 SQLトレースを確認すると、問合せ変換されていることが分かります。

SQL> ALTER SYSTEM FLUSH SHARED_POOL;

SQL> ALTER SESSION SET EVENTS '10053 trace name context forever';

SQL> SELECT SYSDATE;

SYSDATE
--------
23-06-07

SQL> SELECT 1+2;

       1+2
----------
         3

SQL> ALTER SESSION SET EVENTS '10053 trace name context off';

SQL> SELECT VALUE FROM V$DIAG_INFO WHERE NAME = 'Default Trace File';

VALUE
--------------------------------------------------------------------------------
/opt/oracle/diag/rdbms/free/FREE/trace/FREE_ora_3339190.trc

上記で確認したトレースファイルを見てみます。

$ grep -c 3 "Final query" /opt/oracle/diag/rdbms/free/FREE/trace/FREE_ora_3339190.trc
...()...
Final query after transformations:******* UNPARSED QUERY IS *******
SELECT SYSDATE@! "SYSDATE" FROM "SYS"."DUAL" "DUAL"
...()...
Final query after transformations:******* UNPARSED QUERY IS *******
SELECT 3 "1+2" FROM "SYS"."DUAL" "DUAL"

以上から、内部的にはDUAL表へ問い合わせるように変換されているようです。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?