Tons of bug fixes, mostly.
You can now ask for your working directory via the PWD command.
Download is here.
Scroll down to the bottom, link is on the right side.
Tons of bug fixes, mostly.
You can now ask for your working directory via the PWD command.
Download is here.
Scroll down to the bottom, link is on the right side.
You want the create script for a table.
You want the create script for ALL of your tables.
You want the tablespace.
But not the constraints.
How do you configure this in our tools?
Go to the preferences.
Database, utilities, export.
This will also set the defaults for the Database Export wizard.
HELP SET DDL
SET DDL
Might need to add more options, let us know!
And now run the DDL command.
You could add these to your login.sql or do up an alias command to toggle things on and off…
HR@orcl🆒 >help SET ddl SET DDL SET DDL [[ PRETTY | SQLTERMINATOR | CONSTRAINTS | REF_CONSTRAINTS | CONSTRAINTS_AS_ALTER|OID | SIZE_BYTE_KEYWORD | PARTITIONING | SEGMENT_ATTRIBUTES | STORAGE | TABLESPACE | SPECIFICATION | BODY | FORCE | INSERT | |INHERIT | RESET] {ON|off} ]| OFF ] HR@orcl🆒 >SET ddl constraints off DDL OPTION CONSTRAINTS off HR@orcl🆒 >SET ddl ref_constraints off DDL OPTION REF_CONSTRAINTS off HR@orcl🆒 >SET ddl tablespace off DDL OPTION TABLESPACE off HR@orcl🆒 >SET ddl segment_attributes off DDL OPTION SEGMENT_ATTRIBUTES off HR@orcl🆒 >ddl locations CREATE TABLE "HR"."LOCATIONS" ( "LOCATION_ID" NUMBER(4,0), "STREET_ADDRESS" VARCHAR2(40), "POSTAL_CODE" VARCHAR2(12), "CITY" VARCHAR2(30), "STATE_PROVINCE" VARCHAR2(25), "COUNTRY_ID" CHAR(2) ) ; COMMENT ON COLUMN "HR"."LOCATIONS"."LOCATION_ID" IS 'Primary key of locations table'; COMMENT ON COLUMN "HR"."LOCATIONS"."STREET_ADDRESS" IS 'Street address of an office, warehouse, or production site of a company. Contains building number and street name'; COMMENT ON COLUMN "HR"."LOCATIONS"."POSTAL_CODE" IS 'Postal code of the location of an office, warehouse, or production site of a company. '; COMMENT ON COLUMN "HR"."LOCATIONS"."CITY" IS 'A not null column that shows city where an office, warehouse, or production site of a company is located. '; COMMENT ON COLUMN "HR"."LOCATIONS"."STATE_PROVINCE" IS 'State or Province where an office, warehouse, or production site of a company is located.'; COMMENT ON COLUMN "HR"."LOCATIONS"."COUNTRY_ID" IS 'Country where an office, warehouse, or production site of a company is located. Foreign key to country_id column of the countries table.'; COMMENT ON TABLE "HR"."LOCATIONS" IS 'Locations table that contains specific address of a specific office, warehouse, and/or production site of a company. Does not store addresses / locations of customers. Contains 23 rows; references with the departments and countries tables. '; CREATE INDEX "HR"."LOC_CITY_IX" ON "HR"."LOCATIONS" ("CITY") ; CREATE INDEX "HR"."LOC_COUNTRY_IX" ON "HR"."LOCATIONS" ("COUNTRY_ID") ; CREATE INDEX "HR"."LOC_STATE_PROVINCE_IX" ON "HR"."LOCATIONS" ("STATE_PROVINCE") ; HR@orcl🆒 >
If you know how to edit your code in SQL*Plus, you already know how to do it in SQLcl. But I get asked this a lot, do you support EDIT? Do you support CHANGE? And what does SQLcl offer over those?
So let’s tackle the old and then the new…
SQL*Plus has the C[HANGE] command.
C[HANGE] sepchar old [sepchar [new [sepchar]]]
Changes the first occurrence of the specified text on the current line in the buffer. The buffer has no command history list and does not record SQL*Plus commands.
We support that.
FETCH FIRST – you know about this nifty 12c syntax, yes?
It also has the EDIT command.
ED[IT] [file_name[.ext]]
where file_name[.ext] represents the file you wish to edit (typically a script).
Invokes an operating system text editor on the contents of the specified file or on the contents of the buffer. The buffer has no command history list and does not record SQL*Plus commands.
Enter EDIT with no filename to edit the contents of the SQL buffer with the operating system text editor.
We support that.
edit with something in the buffer…
you can change it to EMACS if you want to feel special a la DEFINE _EDITOR = “vi”
SQLcl additionally offers an inline editor.
You can go through your history, find what you want, and then just arrow around the buffer, and make live changes. When you’re ready to execute the statement, you can just hit Ctrl+R.
the ‘*’ shows which line the cursor is on in case you lose track of where you are…
HR@orcl🆒 >help edit EDIT --------- Invokes an operation system text editor ON the contents OF the specified file OR ON the contents OF the SQL buffer. ED[IT] [file_name[.ext]] The DEFINE variable _EDITOR can be used TO SET the editor TO USE IN SQLcl, _EDITOR can be SET TO "inline". This will SET the editor TO be the SQLcl editor. This supports the following shortcuts ^R - Run the CURRENT buffer ^W - GO TO top OF buffer ^S - GO TO bottom OF buffer ^A - GO TO START OF line ^E - GO TO END OF line HR@orcl🆒 >
Oracle SQL*Plus has been around since 1985. It does what it does, and it does it well.
The top new TV show was MacGyver – STILL LOVE THAT SHOW.
SQL Developer has been around since 2006. It’s become the de facto IDE and GUI for the Database.
There was an opportunity to build something new that could take the command line interface and enhance it to meet the needs of today’s database professional.
So really the question that our team was faced with wasn’t ‘Why?’ it was..
New folks to Oracle aren’t exactly thrilled when they discover most of the help docs and training materials are written to a command-line interface that is completely foreign to them.
Writing a simple SELECT * FROM query often leads to a result-set that trails off the screen and is near-impossible to read.
Easier to read query results, just one little thing you’ll fall in love with when using SQLcl.
Basic things like recalling previous statements or getting help with your query or building new commands to make verbose things like a Create Table as SELECT or esoteric things like generating the DDL for an object – we could make those things available and so much easier.
So why not build that?
And that’s what we’ve done. Hopefully this isn’t a surprise seeing as I’ve been talking about SQLcl for more than a year now.
We’re starting to wind down the Early Adopter process. It’s going to be real, soon.*
* Soon – meaning I can’t say exactly when because legal, because other things, but you’ll see it go GA sooner versus later.
To the bigger questions some of you have been asking – when will this ship with the database and clients, what happens to SQL*Plus itself, etc., a few notes:
I’m a big fan of choice. Our customers pay more than a little for their database licenses. They shouldn’t have to be limited to just a few, or even one, interface to their Database.
I’m not going to tell you which interface is the best one for you, but I’ll tell you what you need to know so you can make the right decision for yourself.
And who doesn’t like having choices? I usually have a piece of pecan and apple pie at Thanksgiving- just like I normally use both SQL Developer AND SQLcl most days.
Look for more news, demo’s, and a chance to provide feedback directly to us at KScope16 and Oracle Open World 2016.
Question: Why is SQLcl truncating my column header names? It doesn’t do it if I use SET SQLFORMAT ANSICONSOLE though…
Answer: Because, SQL*Plus.
Longer Answer: SQLcl follows the SQL*Plus rules.
And in this case, the rule is:
The default width of CHAR and VARCHAR2 (VARCHAR) columns is the width of the column in the database.
The questioner was seeing that the 2nd column in their query was having its column name truncated – because it was a VARCHAR2(3) defined column with a name having many more than 3 characters.
SQL> CREATE TABLE dave 2 (sak_aid_elig NUMBER, 3 cde_aid_elig_reason varchar2(3), 4 dte_added NUMBER); TABLE DAVE created. SQL> INSERT INTO dave VALUES ( 2 674008026, '052', 21121218); 1 ROW inserted. SQL> INSERT INTO dave VALUES ( 2 674008026, '404', 21160706); 1 ROW inserted. SQL> commit; Commit complete. SQL> SET sqlformat SQL Format Cleared SQL> SELECT * FROM dave; SAK_AID_ELIG CDE DTE_ADDED ------------ --- ---------- 674008026 052 21121218 674008026 404 21160706 SQL> SET sqlformat ansiconsole SQL> / SAK_AID_ELIG CDE_AID_ELIG_REASON DTE_ADDED 674008026 052 21121218 674008026 404 21160706 SQL> col cde_aid_elig_reason format a20 SQL> SET sqlformat SQL Format Cleared SQL> / SAK_AID_ELIG CDE_AID_ELIG_REASON DTE_ADDED ------------ -------------------- ---------- 674008026 052 21121218 674008026 404 21160706 SQL>
The important bit there is this:
SQL> col cde_aid_elig_reason format a20
That’s a SQL*Plus thing – otherwise the definition of the column shapes the size of the column header.
SET SQLFORMAT ANSICONSOLE – in addition to smart-sizing the data itself, it also prints the full column name, no matter what. Your SQL*Plus report style formatting commands are pretty much ignored when using a SQLFORMAT – so pick one poison or the other.
I have an UMLAUT table. Pretty simple really…
CREATE TABLE "HR"."UMLAUT" ( "CHARACTERS" VARCHAR2(2) ) ; REM INSERTING INTO UMLAUT SET DEFINE OFF; INSERT INTO UMLAUT (CHARACTERS) VALUES ('Ñ'); INSERT INTO UMLAUT (CHARACTERS) VALUES ('Ä'); INSERT INTO UMLAUT (CHARACTERS) VALUES ('Ñ'); COMMIT;
Looks great in SQLDev, but not so much in SQLcl…
Weird…
Everything is UNICODE by default in Java applications. It’s converted to Unicode coming in and going out… [docs]
This is a HUGE advantage in the Java world. We don’t have to do anything special when it comes to supporting Unicode.
So what’s happening above?
Windows CMD by default isn’t setup to use a Unicode code page.
So yeah, that’s not going to work.
UNTIL you do this.
So what does ‘chcp 65001’ do?
The CHCP command changes the code page for the CMD window. And the 65001 code page is for UTF-8.
But, you probably don’t want to have to do this every time you open a CMD window.
So, buy a Mac and use a proper BASH shell environment
Or, you can follow the advice here on StackOverflow. You basically edit the Windows registry to start CMD out with the Unicode code page.
In SQL Developer we have color coded connections.
Feeling blue?
This was added, not because we like Christmas trees and all the pretty lights, but because sometimes you need a reminder of what database you’re on. So you don’t TRUNCATE stuff, accidentally. Visual cues won’t prevent all mistakes, but they sure help.
With SQLcl, you have the abilty to setup your SQL prompt with custom text and colors. This works better if you have a decent terminal. Windows 7? Not so much.
I thought I’d share an example or two here, and let others share theirs in the comments. Have fun!
>set sqlprompt "@|white _USER|@@@|green _CONNECT_IDENTIFIER|@@|white 🆒 >|@"
GREEN = ‘safe place’ AWESOME emoji, just b/c
Tip: On a Mac, you can invoke the Emoji keyboard by hitting ctrl+cmd+spacebar.
The @|white@ @|green@ – stuff – that invokes terminal text coloring. Examples for text coloring/decorating are specified here – thanks Kris!
Using the SCRIPT command to invoke some javascript at connect time, we can see who your user is and what your SERVICE/SID is and update your prompt dynamically.
Again, example here thanks to Kris.
/* execute a sql and get the first column of the first row as a return*/ var dbUser = util.executeReturnOneCol('select user from dual'); /* based on the connect user change my SQL prompt*/ if ( dbUser == 'KLRICE' ) { sqlcl.setStmt('set sqlprompt "@|red _USER|@@@|green _CONNECT_IDENTIFIER|@@|blue>|@"'); } else { sqlcl.setStmt('set sqlprompt "@|blue _USER|@@@|green _CONNECT_IDENTIFIER|@@|blue
>|@"'); } sqlcl.run();
Again, with javascript and the SCRIPT command.
Remind me not to upset these folks.
Where’s the code you say? Here.
Leave something in the comments – we’ll all be thankful!
Oracle SQL Developer Command Line (SQLcl) is the full name for what we’ve been calling, SQLcl.
Have you seen the video? It’s only 8 minutes and will catch you up on just what SQLcl is.
Anyways, there’s a ‘new’ command called SCRIPT that I want to show you today. I say ‘new’ because we added this in October of 2015.
Stealing from @krisrice…
This new command can radically change things you can do in the tool. The script command runs a script that can be any language that is JSR-223 enabled. The best list I can find is here: https://en.wikipedia.org/wiki/List_of_JVM_languages So you want to program sql scripting in groovy,perl,javascript,pascal,…. All doable now.
Javascript is the only one built into Java by default so most example will be focused on that although I do have some Jython ones also to post.
To run a script simple type: script script_name If there is no file extension passed along it assume a .js The language is loaded based on this extension. If the language can’t be loaded you get a message saying as much “Could not load Scripting Engine for :py” More on how to add the other languages later.
We’ve been publishing examples on GitHub, and there are 23 so far. While they may not do exactly what you want, they do expose all the underlying principals and concepts needed to write your own.
This SCRIPT will take the results of a query, and print them like on an index card, or kind of like you see in SQL Developer’s Single Record Viewer.
I’m going to make you go HERE to get the code. There’s lots of good stuff in this project.
So how do you use it?
Grab the code, save it to a file.
I saved this to ‘cardview.js’ in my SQLcl/bin folder.
You call the the javascript by using the SCRIPT command. You pass the name of the file over along with any arguments.
In this case, you pass it the query you want the results formatted to an index card type view.
/* rebuild the sql that was passed in as args*/ var sql=""; for(var i=1;i<args.length;i++){ sql = sql + " " + args[i]; }
You can see where Kris is taking in the argument passed to the script and is building out the SQL string.
I’m not going to talk more about the code, because it’s pretty easy to follow, and I would only make it sound harder than it is. I did change it up a little bit for this post. I added row #’s to the output.
My JS is horrible so I just steal it off the internet.
I haven’t been blogging much because we’ve been working hard to get stuff ready for Oracle Open World next week. I’ll be doing a What’s New and Tips & Tricks talk where I’ll be showing stuff like this.
Want another fun example? I took the AUDIO.JS example on GitHub and used it to add a startup sound to SQLcl.
SQLcl Startup, A-10 edition https://t.co/8SbWKZxLSZ HT @krisrice
— SQLcl (@oraclesqlcl) September 7, 2016
Oracle SQL Developer Command Line (SQLcl) is now officially available. (Download)
No more Early Adopter status!
Thanks to the many of you who provided feedback and helped us make this ready. We plan on very regular updates, every 60-90 days, so the fun hasn’t stopped.
Oracle SQL Developer v4.1.5 is now officially available.
You can now drag and drop objects to copy them from one database to another, Oracle or non-Oracle to Oracle (on prem or Cloud), and we have support for a new Database Cloud service you’ll hear more about soon.
Oracle SQL Developer Data Modeler v4.1.5 is now officially available.
Maintenance release, lots of bug fixes.
Oracle SQL Developer v4.2 Early Adopter is now available. (Download)
You’ve seen me tease a few things here over the past few months. Now it’s time for you to come check them out for yourself.
Instance Viewer can flip from storage/IO stuff to Top SQL.
I’ll be posting all about these new features over the new few days and weeks. We’ll have another Early Adopter release with a few more features, and fixes/changes you find and recommend based on this first Early Adopter offering.
Twitter wasn’t playing nice, so I’ll just blog this
Everything you can do with the History Command in Oracle SQLcl.
Add this to your login.sql.
prompt Bumping up SQL History to 250 Items script var MultiLineHistory = Java.type("oracle.dbtools.raptor.console.MultiLineHistory"); MultiLineHistory.getInstance().setMaxItems(250); /
Don’t go crazy, remember each item gets written to its own XML file. We load those on start-up.
We by default don’t store certain things in your SQLcl HISTORY list – like CONNECTs. For obvious reasons, it’s best not to store certain things, either for convenience or for security.
Here’s how that is controlled.
SET HISTORY BLACKLIST command1, command2, …, commandN
An example:
So I previously added ALTER to the list, and just now added DESC. And then I ran a few commands that use those blacklisted commands.
Now let’s check our HISTORY.
Note: we changed how the blacklisting is managed from when the Early Adopter was running.
Same place we store your ALIAS list of commands…it’s per OS user, not per install of SQLcl.
I made some small, but important changes to my SQL Developer Tips & Tricks slide deck.
I really, really need about 90 minutes to do this session ‘proper’ in the real world. But, it will only take you a few minutes to skim through it. I advise you look for one or two things you can pick up and run with right away.
I even included a video tip in case you’re feeling too burnt out to read today.
Without further ado:
P.S. I never like to blog on Fridays, except for when I do
When I make jokes about copying and pasting code from StackOverflow or Github, I’m not really joking.
But in this case, it’s OK. Because, I’m copying and pasting code from OUR GitHub project, AND my boss wrote the code.
A question came in, and it’s come in a few times, but here’s the most recent variant:
@Rumtis no way – you’ll need to write your own custom formatter with the SCRIPT (js) command
— SQLcl (@oraclesqlcl) December 12, 2016
So basically, you want to use one of our formatters, but you don’t like it 100%, so you want to change it a bit. And I said, just write your own then.
To the GitHubs!
So I’m going to change up the code to write the records delimited by a ‘;’ and no quotes on the strings.
var CopyFormatter = Java.type("oracle.dbtools.raptor.format.CopyFormatter") var FormatRegistry = Java.type("oracle.dbtools.raptor.format.FormatRegistry") var NLSUtils = Java.type("oracle.dbtools.raptor.utils.NLSUtils"); var cmd = {}; cmd.rownum = 0; cmd.start = function() { } cmd.startRow = function() { cmd.rownum++; ctx.write(cmd.rownum+ "\n"); } cmd.printColumn = function(val,view,model) { try{ var v = NLSUtils.getValue(conn,val); ctx.write(v + ";"); } catch(e){ ctx.write(e); } } cmd.endRow = function () { } cmd.end = function () { } cmd.type = function() { return "weird"; } cmd.ext = function() { return ".weird"; } // Actual Extend of the Java CommandListener var weirdFormat = Java.extend(CopyFormatter, { start: cmd.start, startRow: cmd.startRow, printColumn: cmd.printColumn, endRow: cmd.endRow , end: cmd.end, getType: cmd.type, getExt: cmd.ext, setTableName: function(){} }); // Registering the new Command FormatRegistry.registerFormater(new weirdFormat());
Yes, I hard-coded the delimiter – ‘;’
Note that I named this format ‘weird’ – totally not judging folks in Europe for calling it CSV but not using a comma
So let’s see it work.
Any bugs here are mine – I’m not a great copy-paster to begin with and my JS skills are hilariously inept.
JSON – it’s the new whiz bang.
JavaScript has taken off, and you don’t need to take my word for it.
And with JavaScript comes JSON. There are so many libraries on GitHub that are about turning data into really slick web and mobile applications. We have our own set of libraries available – have you heard of Oracle JET?
So JSON is here for awhile. What can you do with it? Well, you know what you can do already with the Oracle Database. What if you could harness the power of our database engine and our SQL layer, but apply that to all the JSON you have laying around?
That’s the core idea behind the Oracle Document Store. In 12c (12.1.0.2) you can store JSON in an Oracle table, and work with it as JSON vs text that you’d have to manipulate manually.
And one of the interfaces we provide for this is known as Simple Oracle Document Access (SODA). We provide both REST and Java implementations for doing SODA.
AND, we also provide support for SODA in Oracle SQLcl.
If you want to create a new collection of documents, you can simply use the SODA CREATE command.
Actually, if you want to do any sort of SODA work, SQLcl supports that.
pretty straightforward once you get used to thinking in terms of collections vs tables
When you create a collection in SODA, it actually goes and creates a table in your schema to hold it.
Did you know you can view BLOBs as text?
If you want to quickly create some collections, query them, update them, delete them, or whatever – the entire SODA api is available in SQLcl. I’m not going to demo all of it for you, but if you’re interested in SODA, just know that SQLcl is already and waiting to help you.
Let’s add to our SODA collection.
We have a new row in our Oracle table now.
Now let’s see what we have in there.
What’s in there overall, how many, and maybe a quick query?
One of the concepts I found immediately alluring was the notion of ‘Query By Example’ (QBE). Here I can use a bit of JSON to tell SODA what I’m looking for in the collection.
Name – test. Value – starts with the text ‘@eatRaleigh’.
For what it’s worth, I’ve downloaded my tweets and stored them in the Oracle Document Store for these examples.
I hope you have an idea now of what’s available to you.
Before you run away, a few things:
I’m out on vacation this week, but you’re in luck. I have to do the Southwest 24 hour check-in thing, so that means I’m stuck on my laptop for a few minutes.
If you’re a command-line kind of guy or gal, then you know all about SQL*Plus. If you’ve spent any time here, then you also know all about SQLcl – our new, modern CLI for Oracle Database.
You’ve probably seen that the tool automatically keeps track of your previous work, and that you can recall it. We call this feature, ‘History’ – and that’s the same name of the command.
Here’s 10 reasons you’re gonna love using this feature.
You don’t have to do anything to turn it on – it just works out of the box.
You can just use the up or down arrow keys to cycle through your recent history.
Out of the box, SQLcl does NOT store commands like ‘CONNECT.’ You also don’t have to worry about filling up your history list with a bunch of SET commands. Of course, you can always set the blacklist to dis-allow anything you want.
The application stores your history in your OS user $HOME directory, and it’s available from one session to the next.
We save 100 of your last ‘things’ out of the box. If you don’t like this limit, you can just change it.
If your query or script fails, it won’t go into the history. But, you might not like that, so you can change it. Just toggle using the SET HISTORY command.
If you run an anon block, we’re saving those too. Oh, and they count as just a single entry or ‘statement.’
We auto-magically append the SET TIMING ON numbers to your queries. You can see these with the HISTORY TIME command.
Don’t worry, you won’t see your
SELECT * FROM HR.EMPLOYEES;
queries filling up your history list – we just store it once. And if you run HISTORY USAGE, you’ll see just how many times each item has been executed in SQLcl.
Type it. Run it. See your list. Find the item you want, then add it to the buffer via a ‘history #.’ That history item will now be ready for you to execute or edit.
A49 – A52 acquired for the family. I wonder what’s happened in the real-world these past few days?
Many of you might not know that most of what you can do in SQcl, can also be done in SQL Developer version 4.2.
In fact, it’s the same code that handles running statements/scripts in SQLcl as it is in SQL Developer’s SQL Worksheet.
Assuming of course, that you use THIS button.
There’s one large exception to this. TODAY: we don’t allow you to use the SCRIPT command, yet.
And one small exception: you can ALIAS a command, but it won’t persist between SQL Developer sessions. We’re not maintaining an ALIASES file in SQL Developer.
If you close SQLDev and re-open it, my PEEPS command will be gone. You could add these via a LOGIN.SQL script though…
Simple, key in your SQL*Plus or SQlcl commands into a worksheet. Hit F5. See the output below.
Here’s an example with our bigger and better DESC – INFO.
Now, let’s get the DDL for a table, spool it to a file, format the file using SQL Developer’s formatter, and then print the contents of the file.
You can always tell SQL Developer to execute a script using the @ syntax. Simply point to the file – either on your machine or out on the scary INTERNET.
You have a new version of SQLcl to download this morning.
Lots and lots of bug fixes – again, thanks everyone in the community for providing feedback so we can make continuous improvements.
A few things of note:
They do pretty much what you’d expect.
You’ll also notice something new on startup/connects if you’re using a ‘local’ LOGIN.SQL
What’s a ‘local’ LOGIN.SQL?
It’s a LOGIN.SQL file that we find in your current working directory when starting SQLcl and doing a CONNECT.
If we find one, we won’t run any SQL. But, we will let you run SET commands so you can get your prompt and DDL shaping settings all just the way you need for your script. You can override this security precaution by setting your SQL_PATH env var to include the ‘.’ directory – not something I’d recommend.
Yes, we support 12cR2. More than that, SQLcl is using a 12.2 JDBC driver by default.
And one of the things you can do in 12.2 is of course get more descriptive TABLE and COLUMN names.
Our insight feature supports that, as well.
Good news – SQLcl is already there!
No config needed! SQLcl there by default in 12cR2. @oraclesqlcl @OracleDatabase pic.twitter.com/eoDk61WR6e
— Tim Hall (@oraclebase) March 2, 2017
Of course, it’s already out of date with today’s update.
We’re able to update SQLcl and SQL Developer MUCH more frequently on OTN…not so much with core database and client distributions. It’ll be there if you need it, but you might want to check OTN for the latest updates and bug fixes.
Just because you’re in a command line interface doesn’t mean you’re stuck with ugly code!
Wait, if it’s my code, you’re stuck with ugly code.
But if it’s YOUR code, then you’re not stuck with poorly formatted code.
You can of course use the FORMAT command to format what’s in a file or in the SQLcl buffer.
Have no fear.
Load up the GUI.
Yes, THAT GUI.
Set your preferences.
Save them.
Set it and forget it?
Go back to SQLcl, load the formatter rules.
remember, you have HELP for each command and for each SET[ting] in SQLcl!
Before the format…
I want leading commas!
Ok, let’s format that.
Most of you will hate this formatting scheme.
Easy-peasy!
Note I did with this the latest copy of SQLcl – updated just LAST WEEK – and a pre-production version of version 4.2 of SQL Developer which you folks will be able to get access to later this year.
Here’s SQLcl using formatter settings applied from EA2, so that SHOULD work for those of you using the EA.
My code’s not ugly, YOUR code is ugly
Love the command line? Hate ugly, out-of-the-box formatting of your results?
You’re in luck, we have just the thing for you:
It offers the ability to auto-pretty up your SQL results to the screen.
Here’s a quick video overview of what that is, and how it works.
How do you get through your day w/o cat videos and Marvel Studios movie trailers?
Anyways, here’s a quick recap:
SET SQLFORMAT ANSICONSOLE
Add that to your login.sql
When you startup your SQLcl, your queries will go from…
…to this:
Each page of results is measured for ‘best fit’. We can’t make your screen bigger, so this isn’t a silver bullet.
If you want to use ANSICONSOLE, don’t use the SQL*Plus Report formatting commands like COL – use one or the other, your choice.
And you have a few more formats you can use…
What’s now self-explanatory is the ‘delimited’ format which isn’t listed in the Help for reasons (bug!)
I get the impression that many of you have thought about getting more acquainted with our development tools and platforms here at Oracle. But I ALSO get the impression that many of you just haven’t had the time.
So, I’m officially inviting you to participate in a series of upcoming webinars I’ll be hosting.
We’ll use a online conference solution that lets me share my desktop with you. I’ll be doing live-demo after a few powerpoint slides to get the business stuff out of the way.
You’ll be able to ask questions as we go – via voice OR chat.
I’ll answer questions as I can, or take notes to get back to you afterwards.
Try to get in a few minutes before start time – you may need to install the Zoom software, but it’s very quick and easy.
You missed it! But that’s OK, I recorded it.
You missed it! But that’s OK, I recorded it.
Tuesday, August 22nd @ 1PM ET
Oracle REST Data Services powers https access to your Oracle Database. We’ll cover just exactly what REST is, why a database person should care, how to quickly stand up ORDS, and we’ll cover a few examples of working with simple SQL statements, scripts, and stored procedures.
Oracle Zoom Conference Details
Join the meeting.
Audio Information – Join by phone:
+1 408 638 0968 or +1 646 558 8656 US Toll
Meeting ID: 364 715 166
International numbers available
New to Zoom? In preparation, please download the Zoom “Desktop Client” ahead of the meeting. Visit https://oracle.zoom.us for more information.