Skip to content

Instantly share code, notes, and snippets.

@jakeboone02
Created November 20, 2013 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jakeboone02/7567107 to your computer and use it in GitHub Desktop.
Save jakeboone02/7567107 to your computer and use it in GitHub Desktop.
Toad: Using SYSDATE instead of specific dates when exporting as Insert statements

When extracting data via INSERT statements with Toad, date fields get hard-coded to the date stored in the database in the form of TO_DATE('<the_date>','MM/DD/YYYY HH24:MI:SS'). Many times the actual date in the source table doesn't matter, and you would rather insert SYSDATE in the destination table instead.

Since the dates can be different in each statement, a standard Find/Replace doesn't help automate the process of converting the TO_DATEs to SYSDATEs. However, you can use this regular expression that is agnostic about the content between the parentheses:

TO_DATE\(.*?\)

Most text editors have a regex option in the Find/Replace function. I have tested this successfully with Sublime Text and Notepad++, but the TextPad regex engine does not support it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment