Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
625 B
2
Indexable
Never
# ... (previous code)

# Inside your main function, update the code where you construct insert_values
for column_name, source_val in source_row.items():
    if source_val is not None:
        if isinstance(source_val, str) and source_val.startswith('TO_DATE'):
            # If it already starts with TO_DATE, don't add TO_DATE again
            insert_values.append(source_val)
        else:
            # Format datetime values using TO_DATE
            insert_values.append(f"TO_DATE('{source_val}', 'YYYY-MM-DD HH24:MI:SS')")
    else:
        insert_values.append('NULL')

# ... (the rest of your code remains the same)