For a long time now, I've had my login.sql file configured to set the prompt in SQLPLUS to two lines, so that it looks like so:
my_username@my_db_instance
SQL>
The code within login.sql that accomplishes this is below (the chr(10) is what creates the 2nd line):
define gname = 'SQL'
column global_name new_value gname
select user||'@'||instance_name||chr(10)||'SQL' as global_name
from v$instance;
set sqlprompt '&&gname> '
However, the same does not work for SQLcl, and the same code results in the SQLcl prompt appearing all one line, like so
my_username@my_db_instance SQL>
I tried replacing the chr(10) with chr(13), chr(13)||chr(10), and u'\000A', but the SQLcl prompt displays on one line regardless. I've confirmed that SQLcl is actually reading the login.sql in question by making other changes to the prompt (e.g. replacing SQL with SQL1), and those changes worked.
Does anyone know whether it's possible to separate the SQLcl prompt into 2 lines? And if so, how?
(ps, I realize this is a pretty petty annoyance, but though I like having the connection info in the prompt, having the 1st line of all my sql starting way off to the right is just...yuck :)