Oracle 23c has many new features and “SELECT without FROM” is one of the features. By using this feature, you can run queries without using FROM clause and specifying table name for testing expressions to get the results which can be easy of use for developers.
You will no longer receive error “ORA-00923: FROM keyword not found where expected” when running expressions to get results in Oracle 23c.
Here are few examples
Example 1: Run mathematical operations with or without using FROM clause and you will get the result
SQL> select 2+3 from dual;
SQL> select 2+3 ;
Example 2: Select current date with and without using FROM clause and you will get the result.
SQL> Select current_date from dual;
SQL> Select current_date;
Example 3: Select NEXTVAL with and without using FROM clause and you will get the result
SQL> Create sequence empno_seq;
SQL> select empno_seq.nextval from dual;
SQL> select empno_seq.nextval ;
Example 4: Pl/SQL block with and without using FROM clause and you will get the result
delcare
v1 number;
begin
select empno_seq.nextval into v1 from dual;
dbms_output.put_line ('v1= '||v1);
end;
/
delcare
v1 number;
begin
select empno_seq.nextval into v1;
dbms_output.put_line ('v1= '||v1);
end;
/
Many other databases such as MS SQL Server, MYSQL support without FROM clause, this will help improve SQL Code portability.
Thanks