{
  "date": "2014-11-05T17:19:37",
  "slug": "the-future-of-sqlplus-and-some-oddities",
  "link": "https://www.dbi-services.com/blog/the-future-of-sqlplus-and-some-oddities/",
  "title": {
    "rendered": "The future of SQL*Plus and some oddities"
  },
  "content": {
    "rendered": "<h2>By Franck Pachot</h2>\n<p>.<br />\nRumors are coming after OOW14. Oracle is working on a new SQL*Plus version. Not only a new version. It&#8217;s a completely new development. Here is what we know currently about the future of sqlplus an sqldeveloper. But I start with some very old stuff.</p>\n<h3>SQL*Plus</h3>\n<p>sqlplus is an old tool. With many features that look as oddities today.</p>\n<p>You want to see some oddities? Good idea because it can be error-prone. Without knowing them, an error when commenting out a line can be very problematic:</p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SQL&gt; create table MY_DUAL ( DUMMY varchar2(1) );\nTable created.\n\nSQL&gt; insert into MY_DUAL values ('X');\n1 row created.\n\nSQL&gt; /*I've inserted only one row, right?*/\n1 row created.\n\nSQL&gt; select count(*) from MY_DUAL;\n\n  COUNT(*)\n----------\n         2\n</pre>\n<p>Yes, my comment without a space after the &#8216;/*&#8217; executed the previous command again, as does the &#8216;/&#8217;</p>\n<p>Another one? Imagine that by mistake you comment a line using the linux comments &#8216;#&#8217;</p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SQL&gt; # drop table MY_DUAL;\nTable dropped.\n</pre>\n<p>The command was executed. The &#8216;#&#8217; executes the command. What is the reason for that? Imagine I&#8217;m typing a long pl/sql and I want to run a describe in order to check table columns. I&#8217;m in 1985 so I just can&#8217;t open a new window.</p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SQL&gt; declare\n  2   cursor c is select * from SCOTT.EMP where\n  3  # -- what are the columns of EMP ?\n  3  # -- ok let's get them:\n  3  # desc SCOTT.EMP\n Name                                      Null?    Type\n ----------------------------------------- -------- ----------------------------\n EMPNO                                     NOT NULL NUMBER(4)\n ENAME                                              VARCHAR2(10)\n JOB                                                VARCHAR2(9)\n MGR                                                NUMBER(4)\n HIREDATE                                           DATE\n SAL                                                NUMBER(7,2)\n COMM                                               NUMBER(7,2)\n DEPTNO                                             NUMBER(2)\n\n  3    mgr is null;\n  4  begin\n  5   null;\n  6  end;\n  7  .\nSQL&gt; l\n  1  declare\n  2   cursor c is select * from SCOTT.EMP where\n  3    mgr is null;\n  4  begin\n  5   null;\n  6* end;\nSQL&gt;\n</pre>\n<p>Great, I was able to run a command without disturbing the statement I was writing. Cool feature in 1985. Risky feature in 2014. Still there for compatibility. Up to you to disable it with:</p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SQL&gt; set sqlprefix off\nSQL&gt; #drop table MY_DUAL;\nSP2-0734: unknown command beginning \"#drop tabl...\" - rest of line ignored.\n</pre>\n<h3>SQL Developer</h3>\n<p>SQL Developer was a nice evolution. I use it a lot. I don&#8217;t know enough all the possibilities. For example I discovered only very recently that there is a command line access to SQL Developer which has a few features:</p>\n<pre>F:orasqldevelopersqldeveloperbin&gt;sdcli\nAvailable features:\ncart: Database Cart Batch Tasks\ndba: Basic Batch DBA Tasks\nformat: SQL Format Task\nmigration: Database Migration Tasks\nreports: Basic Batch Reporting Tasks\nunittest: Unit Testing Batch Tasks\n</pre>\n<p>More info about it on jeff Smith blog</p>\n<h3>SQL Developer 4.1</h3>\n<p>At Oracle Open World, Jeff Smith (Product Manager of SQL Developer) not only organized the Golden Gate Run, but also unveiled a few SQL developer 4.1 new features. It&#8217;s not only a tool for developers, but you can do many DBA or monitoring tasks from it.</p>\n<p>His presentation is <a href=\"https://oracleus.activeevents.com/2014/connect/fileDownload/session/B1FE70947C1D9FE63E8D76DEFC7B2410/CON7326_Smith-OOW14WhatsNewSQLDEV41.pptx\">here</a></p>\n<h3>A new SQL*Plus?</h3>\n<p>If you follow Kris Rice tweets you have probably seen a few teasers about a new sqlplus coming. Yes, they are completely rewriting sqlplus.<br />\nHere is an example:</p>\n<blockquote lang=\"en\"><p>A little more of a preview of what we&#8217;re building. <a href=\"http://t.co/Xfx01EexRf\">http://t.co/Xfx01EexRf</a></p>\n<p>— krisrice (@krisrice) <a href=\"https://twitter.com/krisrice/status/528200484142989314\">October 31, 2014</a></p></blockquote>\n<p>What we can expect?</p>\n<ul>\n<li>Auto completion (proposes table names in the same way as linux bash proposes file names)</li>\n<li>Statement history in the same way we do with our <a href=\"https://www.dbi-services.com/offering/products/database-management-kit-dmk\">DMK</a></li>\n<li>simple command to get the create statements, such as: &#8216;DDL EMP&#8217; to show the &#8216;CREATE TABLE EMP &#8230;&#8217; statement</li>\n</ul>\n<p>Another teaser screenshot:</p>\n<blockquote lang=\"en\"><p>\nHow about this one? What else should be there? <a href=\"https://twitter.com/hashtag/orclapex?src=hash\">#orclapex</a> <a href=\"http://t.co/J7oLzMGaHd\">pic.twitter.com/J7oLzMGaHd</a></p>\n<p>— krisrice (@krisrice) <a href=\"https://twitter.com/krisrice/status/528270310723055616\">October 31, 2014</a>\n</p></blockquote>\n<p>Because, as a consultant, I&#8217;m often going to new environments where I have to adapt to the customer tools, I prefer to use the tools that are easily available. sqlplus is always there. sqldeveloper is easy to install (just unzip and it connects through jdbc).SQL Developer is shipped in ORACLE_HOME snce 11g. It&#8217;s not the latest version but you will be happy to find it if you&#8217;re not allowed to install anything. And I&#8217;m not talking only about customer environments, but if you have to take a hands-on certification exam you will also appreciate 😉</p>\n<h4>A small update:</h4>\n<p>it&#8217;s not a rewrite of sqlplus but rather using the sqldeveloper sqlplus engine.</p>\n",
    "protected": false
  }
}
