Sub topic 4
SQL Developer and SQLcl: when to use which
This chapter helps you choose between Oracle's two main client tools. Later chapters cover how to connect with each one in detail. It assumes you know basic SQL and can use a terminal. It also assumes you have an Oracle Database you can reach and a Java runtime, or a download that bundles one.
Two tools, one connection model
Oracle SQL Developer is a graphical application. SQLcl (SQL Command Line) is a command-line program. Both are Java programs, and both open a session through Oracle's JDBC driver. The host, port, service name, and credentials you give them are the same, and so are the errors you get when something is wrong. The difference is how you drive the session.
SQLcl is also a modern replacement for SQLPlus. It runs SQLPlus-style scripts and adds features that SQL*Plus lacks.
| Aspect | SQL Developer | SQLcl |
|---|---|---|
| Interface | Windows, trees, grids, dialogs | Terminal prompt and scripts |
| Connection setup | A form (Basic, TNS, and other types) | `CONNECT` command, saved connections |
| Best for | Browsing objects, editing code, reading result grids | Automation, remote shells, quick checks |
| Needs a desktop | Yes | No |
| Startup time | Slower, loads a full application | Fast |
| Repeatable by script | Limited | Yes, natively |
| Result output | Grid, export wizard | Text, CSV, JSON, and other formats via `SET SQLFORMAT` |
What each tool does well
SQL Developer
SQL Developer is the better choice when you need to see structure. Its Connections panel shows schemas, tables, views, packages, and their dependencies. You can open a table and inspect its columns, constraints, indexes, and data on separate tabs without writing a query.
- Editing and debugging PL/SQL. The code editor offers syntax highlighting, compile error markers, and a debugger.
- Reading results. Query output appears in a grid that you can sort, filter, and export.
- Managing many connections. Each connection is a named entry with its own settings, and you can color-code them. A color for production helps you avoid running a statement against the wrong database.
- Guided features. Explain plan viewers, data import wizards, and report tools are available from menus.
Its costs are weight and dependence on a display. It takes longer to start, uses more memory, and does not run over a plain SSH session unless you forward a graphical display.
SQLcl
SQLcl is the better choice when you need speed, repeatability, or a text-only environment. It starts quickly and works in any terminal, including SSH sessions, containers, and CI jobs.
- Interactive comfort. It has command history, line editing, and tab completion for object names.
- Output formats.
SET SQLFORMATchanges how results print, so you can produce CSV or JSON without a wizard. - Scripting. It runs
.sqlfiles, accepts parameters, and returns control to the shell when done. - Connection management. You can save, list, and reuse connections from the prompt.
Here is a short session that formats a result as CSV:
SQL> set sqlformat csv
SQL> select employee_id, last_name from employees fetch first 3 rows only;Its costs are the absence of a visual object browser and a steeper start for people who are used to menus. You need to remember or look up commands.
A decision guide
Ask what the task is and where it runs.
These rules cover most situations:
- Browsing a schema you do not know. Use SQL Developer. The tree view is faster than querying the data dictionary by hand.
- Writing and debugging a stored procedure. Use SQL Developer for the editor and debugger.
- Running a deployment script on a server. Use SQLcl. A server often has no desktop, and the script must run the same way every time.
- Checking that a connection works from a new host. Use SQLcl. It tests the network path, the listener, and the credentials with almost no setup.
- Exporting query results for another program. Use SQLcl for repeated exports, or SQL Developer for a one-time export.
- A scheduled report. Use SQLcl called from your scheduler.
Using both together
Most people use both. A common pattern is to design and test a query in SQL Developer, then move it into a script that SQLcl runs. Since both tools use the same connection details, you do not have to relearn anything about hosts, ports, or service names when you switch.
Connection definitions can move between the tools. SQLcl's saved-connection manager, connmgr, can import and export connection definitions, so you can reuse connections you created in SQL Developer. The later chapter on saved connections covers the details.
Differences that cause surprises
SQL*Plus compatibility
Both tools run most SQLPlus commands, such as SET LINESIZE, SPOOL, DEFINE, and @script.sql. SQLcl follows SQLPlus behavior most closely. SQL Developer's script runner handles many of the same commands, but a few SQL*Plus commands are ignored or behave differently. If a script works in SQLcl but not in a SQL Developer worksheet, check the command before you suspect the database.
Script versus statement execution
SQL Developer's worksheet has two run modes. Run Statement (Ctrl+Enter) runs only the statement at the cursor and shows a grid. Run Script (F5) runs everything as a script and shows text output. The same query can look different in each mode. SQLcl always behaves like a script runner, so it matches Run Script.
Transactions
Both tools start a transaction when you change data, and neither commits for you unless you ask. SQL Developer shows commit and rollback buttons. SQLcl needs an explicit COMMIT or ROLLBACK. Closing a SQL Developer connection with uncommitted work usually prompts you. A script that ends in SQLcl without a COMMIT leaves the work to the exit behavior of the client, so write the COMMIT explicitly.
Environment and Java
Both tools need a supported Java runtime. If a tool refuses to start, or starts with odd errors, check which Java version it finds before you look at the database. The two tools may find different Java installations on the same machine.
Quick start
You do not need the details yet. These two commands show how the tools differ at launch. SQL Developer opens as a window and you create a connection in a form. SQLcl needs only a line in the terminal:
sql hr@//dbhost.example.com:1521/orclpdb1.example.comThe form for SQL Developer and the syntax for this command are covered in the next chapters.
Choosing a default
If you are new to a database, begin with SQL Developer to learn its objects, then add SQLcl for anything you will do more than once. If you work mostly on servers, begin with SQLcl and open SQL Developer only when you need to see structure. Either way, learn one connection model and use it in both tools.
Exercise
You must run the same data-load script every night on a Linux server that has no desktop. Which tool do you choose, and give two reasons from this chapter?
Show answer
SQLcl. It runs in a plain terminal, so it works over SSH and without a desktop, and it runs scripts non-interactively, so the job can be scheduled and repeated the same way each time. SQL Developer needs a graphical display and is built for interactive work.
Exercise
A query shows a grid when you press Ctrl+Enter in a SQL Developer worksheet, but F5 shows plain text. Why does this happen, and which SQLcl behavior does F5 resemble?
Show answer
Ctrl+Enter runs only the statement at the cursor and presents a grid, while F5 runs the worksheet as a script and prints text output. SQLcl always behaves like a script runner, so it resembles F5.