0

I have Notepad++ text editor and have the SQL script file that has many INSERT statements, exported from a table. There is a column TIMESTAMP in every row with value like this to_timestamp('08-NOV-13 11.51.51.480570000 AM','DD-MON-RR HH.MI.SS.FF AM').

I need to create a script and replace the above value with current_timestamp so all to_timestamp('08-NOV-13 11.51.51.480570000 AM','DD-MON-RR HH.MI.SS.FF AM') like values will be replaced with current_timestamp.

Also, let me know if there is any online site available to do do this conversion.

2 Answers 2

1

I think Sublime Text is very ideal for your needs.

Open Sublime Text, copy your input onto the text area, press Ctrl+H, press Alt+R, and input the following pattern:

to_timestamp\([^)]+\)

in the "Find What" text box. Now enter "current_timestamp" (without quotes) in the "Replace with" text box, then press "Replace" or "Replace All" and it's done.

Sign up to request clarification or add additional context in comments.

Comments

0

Following regex should match your to_timestamp() calls, try using it as find/replace pattern.

to_timestamp\('[0-9]{2}-[A-Z]{3}-[0-9]{2} (?:[0-9]{2}.){3}[0-9]{9} [AMP]{2}','DD-MON-RR HH.MI.SS.FF AM'\)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.