Re: [SQL] Enc: Help to replace caracter - postgresql
This is a discussion on Re: [SQL] Enc: Help to replace caracter - postgresql ; On Friday 14 Nov 2008, paulo matadr wrote: > I Need to replace string (" ) in the situation below : > > select clie_nmcliente from cadastro.cliente where clie_nmcliente > like '%"%'; > > result: > JOANA D"ARCALMEIDA" > EMLURB ...
![]() |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| |||
| |||
| > I Need to replace string (" ) in the situation below : > > select clie_nmcliente from cadastro.cliente where clie_nmcliente > like '%"%'; > > result: > JOANA D"ARCALMEIDA" > EMLURB "P M R." > CECILIA D"CAGNO" > HELENA FERREIRA D"FREITAS" > JOSE M. "BARRACA DO BOLA" > FORTE" DUNAS BAR" > JOANA D"ARC R. DE SOUZA > ASSEMBLEIA DE DEUS" > USINA SALGADO"SUPRIMENTO > JOSE MOURA 'BIGODE" > BEATRIZ MEDEIROS D"EMERY > > Any help me to create pgPL/sql or funcion to replace ( " ) to null > value, I have many table with this. Thanks for help For a single field, you can use something like this to achieve your objective (this will delete all " characters in the field): update cadastro.cliente set clie_nmcliente = regexp_replace(clie_nmcliente, '"', '', 'g') where clie_nmcliente like '%"%'; -- delete all ": not tested! You could replace the '' with some other string to replace all " with that string. It may be quicker to edit an ASCII dump of the database and reload it if you want to do the same replacement in multiple fields in multiple tables. Regards, -- Raju -- Raj Mathur raju@kandalaya.org http://kandalaya.org/ GPG: 78D4 FC67 367F 40E2 0DD5 0FEF C968 D0EF CC68 D17F PsyTrance & Chill: http://schizoid.in/ || It is the mind that moves -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql |
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| Display Modes | |
| |
All times are GMT -4. The time now is 03:42 AM.




Linear Mode