COPY FROM with NULL
NULL means no value. In other words, it does not have any value, not equal to 0, empty string, or spaces. In Oxla, we can specify a different string as the null value in the COPY FROM query.
You can define a string with any strings that will replace the null value, as shown in the syntax below:
1) To begin with, create a CSV file called idvals.csv with a null value:
2) In addition, create a table called idqty by specifying the column with an integer data type:
3) Execute the COPY FROM query with a NULL option:
4) A null value from the CSV file will be displayed in a table with an empty row that has no value, as shown below:
1) A string is represented with a double quote. In this case, we create a CSV file called idvals.csv with a null value as a string.
2) Create a table called idqty by specifying the column with an integer data type:
3) Execute the COPY FROM query with a NULL option:
4) You can see that a null value from the CSV file will be displayed in a table with “null”:
You can specify another string to replace the null value. Such as blank, empty, invalid, etc.
