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!

sqlcl - Exit after executing file

Is there a way to have sqlcl exit after executing the “start” file?

I mean a sqlcl command-line option so that after running something like this:

sql … @foo.sql

… after executing foo.sql sqlcl exits.

I know that there's an “exit” command that can be added at the end of foo.sql, but it's not the cleanest approach for what we need.

Here is an explanation for the need: We have multiple scripts, that we sometime run with sqlcl directly, or include them in other scripts and those are executed by sqlcl instead. Whenever we execute any of these scripts with sqlcl from the command line, we want to exit sqlcl after the execution. Without a command line option to exit after executing the script, we are forced to have two scripts for each script: a foo.sql that does not end in “exit” and which can be safely embedded in other scripts, and a foo+exit.sql that includes foo.sql and then exits, which we can be used directly with sqlcl.

Comments
Post Details
Added on Feb 14 2023
4 comments
576 views