HowTo set Virtuoso "isql" command tool output format to be CSV

The output format of the Virtuoso isql command line tool can be set to CSV (comma-separated values) format with the command:

set CSV_RFC4180 ON;

after which any queries or command run in isql will return any results in CSV format, for example:

SQL> set CSV_RFC4180 ON;
SQL> select top 3 u_id, u_name, u_full_name from sys_users;
"U_ID","U_NAME","U_FULL_NAME"
"122","OAuth",""
"123","OAuth2",""
"115","PKI",""

3 Rows. -- 1 msec.
SQL>

The output of running a query/command can also be written directly to a CSV file with a command of the form:

    isql 1111 dba dba CSV_RFC4180=ON VERBOSE=OFF EXEC="query/command" > output.csv

For example:

$  isql 1111 dba dba CSV_RFC4180=ON VERBOSE=OFF EXEC="select top 3 u_id, u_name, u_full_name from sys_users" > output.csv
$ cat output.csv
"U_ID","U_NAME","U_FULL_NAME"
"123","GDATA_ODS",""
"121","OAuth",""
"122","OAuth2",""
$