COPY TO statement
COPY TO with NULL
Overview
A NULL
value indicates that the value does not exist in the database. In Oxla, you can use the NULL
option in the COPY TO
state to specify a string that will replace NULL
values when copying data from the table to a CSV file.
Syntax
The syntax for using the NULL
option in the COPY TO
is as follows:
Parameters in the syntax include:
-
table_name
: The table containing the data to be exported. -
file_path
: A CSV file location where the data will be saved. -
NULL ‘replacement_string'
: The specified string that will replace NULL values in the exported CSV file. The default value is' '
.
Example
- Create a table with a
NULL
value.
- Now, let’s use
COPY TO
with an empty string:
- The
NULL
values in the table are replaced with the empty string in the CSV file.
You can specify another string to replace the null value, such as blank, empty, invalid, etc.