10.4. Calendar Scrubs
When a range of possible values is limited, you can use a table for those Values that you wish to allow into the database schema.
The idea is simple enough and should have been part of the CHECK () constraints on the base tables in the schema. But when you are importing external data, you might need help.
Troels Arvin posted a problem in the DB2 newsgroup in early 2007 in which he had a non-SQL data source with CHAR (10 ) dates that were supposed to be in ISO-8601 format (i.e., 2006-12-24). Some of the values were known to be invalid (such as 0000-00-00 or 2006-02-45). His goal was to convert the strings to DATE values as he loaded them into his schema.
One proposed solution was to use an internal use-defined function (UDF) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access