- 1 year ago
Remove/Prevent First Blank from Oracle CSV MARKUP output file
To remove or prevent the first blank line from an Oracle CSV MARKUP output file, you can use the SET MARKUP
command in your SQL query and specify the appropriate options.
Here's an example of how you can modify the SQL*Plus script to achieve this:
sqlSET MARKUP CSV ON DELIMITER ',' QUOTE OFF
SET PAGESIZE 0
SET FEEDBACK OFF
SET HEADING OFF
SET TRIMSPOOL ON
SPOOL output.csv
-- Your SQL query here
SPOOL OFF
In this example, the SET PAGESIZE 0
command removes the page header and footer, the SET FEEDBACK OFF
command suppresses feedback messages, and the SET HEADING OFF
command removes column headers from the output. These settings help to eliminate any additional lines from the output.
The SET TRIMSPOOL ON
command removes trailing spaces from each line in the spooled output.
Finally, the SPOOL output.csv
command specifies the output file name (e.g., output.csv
) for the SQL*Plus output.
By configuring these settings and using the SET MARKUP
command with the appropriate options, you can generate a CSV output file without the first blank line.
Note that these commands are specific to SQL*Plus, and the exact syntax and options may vary depending on the version of Oracle and the tool you are using.