In the SELECT statement below I'm casting a varchar2 to an integer value. How do I return NULL
if the cast fails? The CAST would fail if the text, e.g. 'dog' cannot be cast to a integer. The column contains integers stored as strings (varchar2) and NULL
.
SELECT CAST(text_column AS NUMBER(*,0)) column_alias
FROM schema.table@dblink;
Update - SELECT * FROM V$VERSION;
reveals Oracle Database 12c Enterprise Edition Release 12.1.0.2.0