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!
Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.
Interesting, I would like to try to reproduce your problem. Do you mind posting a short example with command and code you try to reformat? Screen shot is fine.
I am using the below command from the path where the sdcli.exe file is available in the SQLDEVELOPER BIN directory
I have placed my PL/SQL packages in the folder E:\FORMAT_IN for which I am trying to do the code formatting
Sorry I can't help you; I reproduced a similar error message in both version 17.4 and 17.3: "Failed to create the processor for command format" Since all the other commands to sdcli works I guess a component is left out from these distributions. I found an older version (4.1.3) and with that one it works.
Hi,
Thanks for the update, for me also the SDCLI command works, but I am unable to format the PL/SQL code , in lower version of 4.2 , the advanced formatting option does not exist which is required for formatting PL/SQL, the SDCLI command in lower versions only formats the SQL commands.
Please find the screenshot of the feature missing in below versions of 4.2
As a work around use sqlcl's "FORMAT" command:
https://docs.oracle.com/database/sql-developer-17.4/SQCQR/toc.htm#SQCQR-GUID-6736ADCE-ABD9-49B8-91E5-7973221DC434
FORMAT [BUFFER | RULES <filename> | FILE <input_file> <output_file>]Where FORMAT BUFFER - formats the script in the SQLcl Buffer FORMAT RULES <filename> - Loads SQLDeveloper Formatter rules file to formatter FORMAT FILE <input_file> <output_file>
FORMAT [BUFFER | RULES <filename> | FILE <input_file> <output_file>]
FORMAT BUFFER - formats the script in the SQLcl Buffer
FORMAT RULES <filename> - Loads SQLDeveloper Formatter rules file to formatter
FORMAT FILE <input_file> <output_file>
[Edit: added sqlcl inline help for FORMAT:
SQL> versionOracle SQLDeveloper Command-Line (SQLcl) version: 17.4.0.354.2224SQL> formatFORMAT---------FORMAT BUFFER - formats the script in the SQLcl BufferFORMAT RULES <filename> - Loads SQLDeveloper Formatter rules file to formatter.FORMAT FILE <input_file> <output_file>Format used is default or for SQLcl can be chosen by setting an environmental variablepointing to a SQLDeveloper export (.xml) of formatter options.The variable is called SQLFORMATPATHIn SQLDeveloper the format options are the default chosen in the preferences.SQL>
SQL> version
Oracle SQLDeveloper Command-Line (SQLcl) version: 17.4.0.354.2224
SQL> format
FORMAT
---------
FORMAT RULES <filename> - Loads SQLDeveloper Formatter rules file to formatter.
Format used is default or for SQLcl can be chosen by setting an environmental variable
pointing to a SQLDeveloper export (.xml) of formatter options.
The variable is called SQLFORMATPATH
In SQLDeveloper the format options are the default chosen in the preferences.
SQL>
]
def sounds like a bug, please report to My Oracle Support
using SQLcl as a workaround is a good suggestion, might be faster (much faster than sdcli too!)
Jeff
Thanks Jeff, already reported in My Oracle support.
SR Number : 3-16562725141
Correct SR Number : 3-16562724151
Here's a working sqlcl example of formatting sql files in F:\IN directory and writing the formatted files to F:\OUT:
F:\Oracle>type format.sqlscript sqlcl.setStmt('version'); sqlcl.run(); /* include helpers.js from github, as written by krice etal */ load('https://raw.githubusercontent.com/oracle/Oracle_DB_Tools/master/sqlcl/lib/helpers.js'); /* Get File names */ var cmd = 'cmd /c "for /f %i IN ( \'dir/s/b f:\\IN\\*.sql\' ) DO @echo format file %~fi f:\\OUT\\%~nxi"' ctx.write("Debug: " + cmd + "\n"); var files = helpers.exec(cmd).stdout.split("\n"); // Uncomment if you want to "include" SQLDeveloper export formatter rules file. // sqlcl.setStmt('format rules your_exported_format_rules.xml'); // sqlcl.run(); for (f in files) { ctx.write(files[f] + "\n"); /* FORMAT the file(s) */ sqlcl.setStmt(files[f]); sqlcl.run(); }/exit;F:\Oracle>sql -s /NOLOG @.\format.sqlOracle SQLDeveloper Command-Line (SQLcl) version: 17.4.0.354.2224Debug: cmd /c "for /f %i IN ( 'dir/s/b f:\IN\*.sql' ) DO @echo format file %~fi f:\OUT\%~nxi"format file f:\IN\x.sql f:\OUT\x.sqlformat file f:\IN\y.sql f:\OUT\y.sqlformat file f:\IN\z.sql f:\OUT\z.sqlF:\Oracle>
F:\Oracle>type format.sql
script
sqlcl.setStmt('version'); sqlcl.run();
/* include helpers.js from github, as written by krice etal */
load('https://raw.githubusercontent.com/oracle/Oracle_DB_Tools/master/sqlcl/lib/helpers.js');
/* Get File names */
var cmd = 'cmd /c "for /f %i IN ( \'dir/s/b f:\\IN\\*.sql\' ) DO @echo format file %~fi f:\\OUT\\%~nxi"'
ctx.write("Debug: " + cmd + "\n");
var files = helpers.exec(cmd).stdout.split("\n");
// Uncomment if you want to "include" SQLDeveloper export formatter rules file.
// sqlcl.setStmt('format rules your_exported_format_rules.xml');
// sqlcl.run();
for (f in files) {
ctx.write(files[f] + "\n");
/* FORMAT the file(s) */
sqlcl.setStmt(files[f]);
sqlcl.run();
}
/
exit;
F:\Oracle>sql -s /NOLOG @.\format.sql
Debug: cmd /c "for /f %i IN ( 'dir/s/b f:\IN\*.sql' ) DO @echo format file %~fi f:\OUT\%~nxi"
format file f:\IN\x.sql f:\OUT\x.sql
format file f:\IN\y.sql f:\OUT\y.sql
format file f:\IN\z.sql f:\OUT\z.sql
F:\Oracle>
(For this to work on linux, the "var cmd =" line would be changed to a linux command).