Re: What is the proper default value for VARCHAR?
Posted by:
Rick James
Date: November 12, 2016 06:28PM
I think this is the set of actions:
** What happens if you do not provide a value for the column:
Table definition || value put into table
NULL || NULL
NOT NULL || '' (or 0 for numeric); plus Warning "doesn't have default"
DEFAULT 'x' NULL || 'x'
DEFAULT 'x' NOT NULL || 'x'
** What happens if you provide NULL:
NULL || NULL
NOT NULL || Error: "cannot be null"
DEFAULT 'x' NULL || NULL
DEFAULT 'x' NOT NULL || Error: "cannot be null"
** What happens if you provide 'zz':
NULL || 'zz'
NOT NULL || 'zz'
DEFAULT 'x' NULL || 'zz'
DEFAULT 'x' NOT NULL || 'zz'
Also, AUTO_INCREMENT and certain TIMESTAMP and DATETIME columns have special actions when given no value, or NULL.
Subject
Written By
Posted
November 07, 2016 10:29AM
November 09, 2016 04:24PM
Re: What is the proper default value for VARCHAR?
November 12, 2016 06:28PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.