News
Perth, Australia
+ (61) 417713124
prosolutions@gavinsoorma.com

SQL*Plus New Features in Oracle 12c Release 2 and 18c

  • Posted by Gavin Soorma
  • On June 25, 2019
  • 0 Comments
  • 12c new feature, 18c, 19c, 19c new features, set feedback only, sql*plus, sqlcl

A number of new features were added in Oracle 12c Release 2 and Oracle 18c related to SQL*Plus.

Let us have a quick look at some of these new features and how they can be used.
 

Oracle 18c
  • SET FEEDBACK ON SQL_ID: Display the sql_id for the currently executed SQL statement
  • SET ROWLIMIT n: Set a limit for the number of rows displayed for a query
  • SET LINESIZE with WINDOW option: Dynamically change and format the displayed output to fit the screen or window size
Oracle 12c Release 2
  • HISTORY: Display and run previously executed SQL and PL/SQL commands
  • SET MARKUP CSV: Option to output data in CSV format with choice of delimiter
  • SET FEEDBACK ONLY: Option to only display the number of rows selected and no data is displayed
  • sqlplus –F or -fast: Changes the default values of settings like ARRAYSIZE,LOBPREFETCH,PAGESIZE,ROWPREFETCH to improve performance

 

SQL> set feedback only

SQL> select * from hr.employees;

107 rows selected.


SQL> set feedback on sql_id

SQL> select * from hr.employees where first_name='Susan';

EMPLOYEE_ID FIRST_NAME		 LAST_NAME
----------- -------------------- -------------------------
EMAIL			  PHONE_NUMBER	       HIRE_DATE JOB_ID 	SALARY
------------------------- -------------------- --------- ---------- ----------
COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
-------------- ---------- -------------
	203 Susan		 Mavris
SMAVRIS 		  515.123.7777	       07-JUN-02 HR_REP 	  6500
		      101	     40


1 row selected.

SQL_ID: gw7ra2jba93p6

SQL> set rowlimit 5

SQL> select first_name from hr.employees;

FIRST_NAME
--------------------
Ellen
Sundar
Mozhe
David
Hermann

5 rows selected. (rowlimit reached)

 

SET LINESIZE WINDOW – As the window is being made bigger with every execution of the same query, we can the linesize automatically changing and more columns appearing on the same line
 

 
 

 

SQL> SHOW ARRAYSIZE LOBPREFETCH PAGESIZE ROWPREFETCH STATEMENTCACHE
arraysize 15
lobprefetch 0
pagesize 14
rowprefetch 1
statementcache is 0

SQL> quit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

[oracle@linux01 bin]$ sqlplus -fast apex_owner/oracle

SQL*Plus: Release 12.2.0.1.0 Production on Wed Jul 12 22:47:00 2017

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> SHOW ARRAYSIZE LOBPREFETCH PAGESIZE ROWPREFETCH STATEMENTCACHE
arraysize 100
lobprefetch 16384
pagesize 50000
rowprefetch 2
statementcache is 20

 

SQL> set markup csv on 

SQL> select * from hr.regions;

"REGION_ID","REGION_NAME"
1,"Europe"
2,"Americas"
3,"Asia"
4,"Middle East and Africa"

SQL> set markup csv on quote off delimiter |
SQL> /

REGION_ID|REGION_NAME
1|Europe
2|Americas
3|Asia
4|Middle East and Africa

 

SQL> show history
history is OFF

SQL> set history on 

SQL> select count(*) from exp_detail;

  COUNT(*)
----------
       450

SQL> select count(*) from months;

  COUNT(*)
----------
	 6

SQL> select sysdate from dual;

SYSDATE
---------
12-JUL-17

SQL> history
  1  select count(*) from exp_detail;
  2  select count(*) from months;
  3  select sysdate from dual;


SQL> history 2 run

  COUNT(*)
----------
	 6

SQL> history 3 run 

SYSDATE
---------
12-JUL-17

SQL> history clear  

SQL> history
SP2-1651: History list is empty.
 4

0 Comments

Leave Reply

Your email address will not be published. Required fields are marked *