Print Thread
Editor: Search and replace TRIM function
#30550 08/13/08 02:01 AM
Joined: Aug 2008
Posts: 29
Moravia
M
Member
OP Offline
Member
M
Joined: Aug 2008
Posts: 29
Moravia
Hello

I have a lot of SQL commands containing TRIM() functions. I would like to replace all occurrences of TRIM(Table.Field) with NVL(TRIM(Table.Field), ' ').
Is it possible in PL/SQL Developer? Or any other tool? Some regular expression replace?
Thanks for tip.

Re: Editor: Search and replace TRIM function
#30551 08/13/08 02:26 AM
Joined: Jul 2003
Posts: 1,140
Virginia, USA
Member
Offline
Member
Joined: Jul 2003
Posts: 1,140
Virginia, USA
Notepad++ would allow you to do it.

search for "trim(.*)"
replace with "nvl(trim\1,' ')"

turns this - trim(this.field)
into this - nvl(trim(this.field),' ')


Scott Mattes
Re: Editor: Search and replace TRIM function
#30552 08/13/08 05:46 AM
Joined: Dec 2002
Posts: 491
Wellington, NZ
Member
Offline
Member
Joined: Dec 2002
Posts: 491
Wellington, NZ
notepad++ is underrated. i downloaded it the other day, its pretty good.


... suck in your lips and frown like a werewolf ...
Re: Editor: Search and replace TRIM function
#30553 08/13/08 03:05 PM
Joined: Aug 1999
Posts: 22,220
Member
Offline
Member
Joined: Aug 1999
Posts: 22,220
In PL/SQL Developer you can perhaps use a Macro for this.


Marco Kalter
Allround Automations
Re: Editor: Search and replace TRIM function
#30554 08/13/08 05:12 PM
Joined: Jul 2003
Posts: 1,140
Virginia, USA
Member
Offline
Member
Joined: Jul 2003
Posts: 1,140
Virginia, USA
Sorry, I didn't think of that!

do a find on "trim(./)", then do a ctl-home.

start recording a macro, press the Find Next (defaults to ctl-l if I remember). Now you have the first trim highlighted. Do ctl-x to put it into the clipboard, type "nvl(", ctl-v, ", ' ')" and stop the macro recording.

Now press f12 repeatedly.

Marco, when is regex going to be upgraded to handle this?


Scott Mattes

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.137s Queries: 13 (0.037s) Memory: 2.5157 MB (Peak: 3.0428 MB) Data Comp: Off Server Time: 2024-05-18 21:46:08 UTC
Valid HTML 5 and Valid CSS