SQLcl and login.sql
In SQL*Plus you can configure it to automatically run login scripts, typically used to configure your session. These are stored in the files
login.sql. Some examples that you'd find in these files are statements like:
set serveroutput on. You can read more about login scripts here.
SQLcl also handles login scripts, however it may require some additional configuration. The easiest way to leverage this is to create a file called
login.sql in your current directory, then call SQLcl from that directory.
If you're like me and launch SQLcl from many directories that approach won't work. Instead, you can create one
login.sql file and have it automatically referenced. To do this create
login.sql in a folder (in my case it was
Documents/Oracle) and then add the following to
export SQLPATH=~/Documents/Oracle/. For those that use oh-my-zsh modify
Now when you run SQLcl anywhere it will reference your