Αποτελέσματα Αναζήτησης
You can write a function that tests to see whether a string can be converted to a date and return either the converted date or a NULL. You can then use that instead of to_date.
1 Ιουν 2023 · Oracle DECODE Function with NULL Values. As I mentioned above, the Oracle DECODE function is an exception to other functions in how it handles NULL values. It treats a NULL expression and NULL search as equal (so NULL == NULL). So, this example will return 1: SELECT DECODE(NULL, NULL, 1, 0) FROM DUAL;
28 Ιαν 2008 · update t nvl_null_value set name1 = nvl(l_name,name1); rollback; update t decode_null_value set name1 = decode(l_name,null,name1,l_name); rollback; l_name := 'abc'; update t nvl_not_null_value set name1 = nvl(l_name,name1); rollback; update t decode_not_null_value set name1 = decode(l_name,null,name1,l_name); rollback; end; / and tkprof says:
How to convert Dates in Oracle using TO_DATE, TO_CHAR functions with examples. Date formats available in Oracle.
19 Δεκ 2023 · "decode( :dateintr, 'MMMMMM', to_date( .... ), to_date(:dateintr,'format') )" that way, decode returns A DATE, not a string.
1 Φεβ 1990 · To handle the cases where the date value could be zeroes or spaces, you could add a filter condition using TRANSLATE function. WHERE translate(column_name, '#0 ','#') IS NOT NULL. For example, Setup. SQL> CREATE TABLE t(A VARCHAR2(8), b DATE); Table created. SQL> INSERT INTO t(A) VALUES('00900201'); 1 row created.
21 Ιουλ 2004 · When you insert, simply "insert into t values ( to_date( SOME_STRING, 'mm/dd/yyyy' ) )" You can change the default date format using alter session set nls_date_format='mm/dd/yyyy'; but I would strongly DISCOURAGE that.