Skip to Main Content

SQLcl: MCP Server & SQL Prompt

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Sqlformat ansiconsole disappears, again

user9540031Jul 29 2026

Tested in SQLcl 26.2.0 (either stand-alone, or embedded in the SQL Dev for VS Code extension, 26.2.0) on Windows 11.

This time it is caused by defining a NOPRINT NEW_VALUE column.

SQLcl: Release 26.2 Production on Wed Jul 29 17:39:05 2026

Copyright (c) 1982, 2026, Oracle.  All rights reserved.

Password? (**********?) ******
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.9.0.0.0

SQL> select owner, object_name, object_type, last_ddl_time from dba_objects fetch first 1 row only;

OWNER    OBJECT_NAME       OBJECT_TYPE    LAST_DDL_TIME    
________ _________________ ______________ ________________ 
SYS      I_FILE#_BLOCK#    INDEX          28-APR-19        

SQL> column unrelated_col noprint new_value unrelated_substvar
SQL> /

OWNER
--------------------------------------------------------------------------------
OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE             LAST_DDL_
----------------------- ---------
SYS                                                                             
I_FILE#_BLOCK#                                                                  
INDEX                   28-APR-19

SQL> clear columns
columns cleared

SQL> select /*ansiconsole*/ owner, object_name, object_type, last_ddl_time from dba_objects fetch first 1 row only;

OWNER
--------------------------------------------------------------------------------
OBJECT_NAME
--------------------------------------------------------------------------------
OBJECT_TYPE             LAST_DDL_
----------------------- ---------
SYS                                                                             
I_FILE#_BLOCK#                                                                  
INDEX                   28-APR-19

That's right: all it takes to ruin the ansiconsole format and have SQLcl revert to the default (SQL*Plus) format for all queries is a single, unrelated COLUMN … NOPRINT NEW_VALUE command once. And clearing it does not fix it.

Workaround: either

  • exit from SQLcl

Or, if you have set up a Javascript-enabled SQLcl (more about that in the following 2 articles: link, link):

  • try to do the housekeeping yourself, using:
script
    ctx.getColumnMap().remove(new java.lang.String('UNRELATED_COL'))
/

Why that {UNRELATED_COL=unrelated_subtvar} entry in ctx.getColumnMap() caused the sqlformat to revert to default for all SQL queries, and why that entry was not removed by the CLEAR COLUMNS command, are mysteries to me—it looks like we could have 2 defects in 1 here.

Best regards,

Comments
Post Details
Added on Jul 29 2026
1 comment
65 views