Solved

PLSQL- replace is not working for â¿¿

Posted on 2014-10-21
12
259 Views
Last Modified: 2014-10-24
hi experts:

i am trying this
UPDATE ta_cuenta_contable
SET nombrecuentacontable   = REPLACE(nombrecuentacontable ,'â¿¿','-');
commit;

the data is
Participaciones de los trabajadores diferidas â¿¿ Pa

but it is not working
0
Comment
Question by:enrique_aeo
  • 6
  • 6
12 Comments
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 500 total points
ID: 40395970
Seems to work for me:
SQL> select REPLACE('Participaciones de los trabajadores diferidas â¿¿ Pa','â¿¿','-') from dual;

REPLACE('PARTICIPACIONESDELOSTRABAJADORESDIFERIDAS
--------------------------------------------------
Participaciones de los trabajadores diferidas - Pa

Open in new window


The upside down question mark is typically some non-printable character for Oracle.  Make sure what you have in the data is exactly the character you are trying to replace.

What are you getting?
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 40395972
You can check the values with:
select dump('diferidas â¿¿ Pa') from dual;

Do the same with the string you are wanting to replace and make sure they are the same.
0
 

Author Comment

by:enrique_aeo
ID: 40395980
this is result

select dump('diferidas â¿¿ Pa') from dual;

Typ=96 Len=16: 100,105,102,101,114,105,100,97,115,32,226,191,191,32,80,97
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:enrique_aeo
ID: 40395986
you can send the code to the UPDATE
0
 

Author Comment

by:enrique_aeo
ID: 40395993
I EXECUTE THIS
select REPLACE('Participaciones de los trabajadores diferidas â¿¿ Pa','â¿¿','-') from dual;

the result
Participaciones de los trabajadores diferidas - Pa
0
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 500 total points
ID: 40396022
>>Typ=96 Len=16: 100,105,102,101,114,105,100,97,115,32,226,191,191,32,80,97

That is that I got.  I actually meant for you to DUMP the actual column value in the table you have.  Remember the upside down question marks may just be unprintable characters.

If the replace works in a SELECT, it will work in an UPDATE.

Since you state it doesn't work, then the data you have in the table doesn't match the data you have in the replace string.

Check the actual data in the table and NOT what we have been copying and pasting.
0
 

Author Comment

by:enrique_aeo
ID: 40396028
is not working

UPDATE ta_cuenta_contable
   SET nombrecuentacontable = REPLACE(nombrecuentacontable,
                                      'Typ=96 Len=16: 100,105,102,101,114,105,100,97,115,32,226,191,191,32,80,97',
                                      '-');
0
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 500 total points
ID: 40396051
You do not put the dump string in the replace.

You figure out what characters you actually have in the data and make sure you have those same characters in the replace string.

The DUMP shows what the actual data is.

What does this return:
select nombrecuentacontable, dump(nombrecuentacontable ) from ta_cuenta_contable
where nombrecuentacontable like 'Participaciones de los trabajadores%';
0
 

Author Comment

by:enrique_aeo
ID: 40400743
this result
NOMBRECUENTACONTABLE      DUMP(NOMBRECUENTACONTABLE)
Participaciones de los trabajadores diferidas – Pa      Typ=1 Len=52: 80,97,114,116,105,99,105,112,97,99,105,111,110,101,115,32,100,101,32,108,111,115,32,116,114,97,98,97,106,97,100,111,114,101,115,32,100,105,102,101,114,105,100,97,115,32,226,128,147,32,80,97
Participaciones de los trabajadores diferidas – Pa      Typ=1 Len=52: 80,97,114,116,105,99,105,112,97,99,105,111,110,101,115,32,100,101,32,108,111,115,32,116,114,97,98,97,106,97,100,111,114,101,115,32,100,105,102,101,114,105,100,97,115,32,226,128,147,32,80,97
Participaciones de los trabajadores diferidas – Pa      Typ=1 Len=52: 80,97,114,116,105,99,105,112,97,99,105,111,110,101,115,32,100,101,32,108,111,115,32,116,114,97,98,97,106,97,100,111,114,101,115,32,100,105,102,101,114,105,100,97,115,32,226,128,147,32,80,97
Participaciones de los trabajadores diferidas – Pa      Typ=1 Len=52: 80,97,114,116,105,99,105,112,97,99,105,111,110,101,115,32,100,101,32,108,111,115,32,116,114,97,98,97,106,97,100,111,114,101,115,32,100,105,102,101,114,105,100,97,115,32,226,128,147,32,80,97
Participaciones de los trabajadores diferidas – Pa      Typ=1 Len=52: 80,97,114,116,105,99,105,112,97,99,105,111,110,101,115,32,100,101,32,108,111,115,32,116,114,97,98,97,106,97,100,111,114,101,115,32,100,105,102,101,114,105,100,97,115,32,226,128,147,32,80,97
Participaciones de los trabajadores diferidas – Pa      Typ=1 Len=52: 80,97,114,116,105,99,105,112,97,99,105,111,110,101,115,32,100,101,32,108,111,115,32,116,114,97,98,97,106,97,100,111,114,101,115,32,100,105,102,101,114,105,100,97,115,32,226,128,147,32,80,97
Participaciones de los trabajadores diferidas – Re      Typ=1 Len=52: 80,97,114,116,105,99,105,112,97,99,105,111,110,101,115,32,100,101,32,108,111,115,32,116,114,97,98,97,106,97,100,111,114,101,115,32,100,105,102,101,114,105,100,97,115,32,226,128,147,32,82,101
Participaciones de los trabajadores diferidas – Re      Typ=1 Len=52: 80,97,114,116,105,99,105,112,97,99,105,111,110,101,115,32,100,101,32,108,111,115,32,116,114,97,98,97,106,97,100,111,114,101,115,32,100,105,102,101,114,105,100,97,115,32,226,128,147,32,82,101
Participaciones de los trabajadores diferidas – Re      Typ=1 Len=52: 80,97,114,116,105,99,105,112,97,99,105,111,110,101,115,32,100,101,32,108,111,115,32,116,114,97,98,97,106,97,100,111,114,101,115,32,100,105,102,101,114,105,100,97,115,32,226,128,147,32,82,101
Participaciones de los trabajadores diferidas – Re      Typ=1 Len=52: 80,97,114,116,105,99,105,112,97,99,105,111,110,101,115,32,100,101,32,108,111,115,32,116,114,97,98,97,106,97,100,111,114,101,115,32,100,105,102,101,114,105,100,97,115,32,226,128,147,32,82,101
Participaciones de los trabajadores diferidas – Re      Typ=1 Len=52: 80,97,114,116,105,99,105,112,97,99,105,111,110,101,115,32,100,101,32,108,111,115,32,116,114,97,98,97,106,97,100,111,114,101,115,32,100,105,102,101,114,105,100,97,115,32,226,128,147,32,82,101
Participaciones de los trabajadores diferidas – Re      Typ=1 Len=52: 80,97,114,116,105,99,105,112,97,99,105,111,110,101,115,32,100,101,32,108,111,115,32,116,114,97,98,97,106,97,100,111,114,101,115,32,100,105,102,101,114,105,100,97,115,32,226,128,147,32,82,101
result-DUMP.txt
0
 
LVL 77

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 500 total points
ID: 40400757
Cool.

Now DUMP the string used in your replace statement.  Make sure the values match.

select dump('<your replace string>') from dual;

where <your replace string> is the actual characters in bold below:
REPLACE(nombrecuentacontable ,'â¿¿','-');

It looks like the characters you want to replace have the dumped values: 226,128,147
0
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 40400798
The upside down question marks tells me the editor/program/??? you are using doesn't recognize the characters.

If the dumps are accurate, try the replace with the values instead of the characters.

Try this:
select REPLACE(nombrecuentacontable ,chr(226)||chr(128)||chr(147),'-')
from ta_cuenta_contable;
0
 

Author Comment

by:enrique_aeo
ID: 40402315
select nombrecuentacontable, REPLACE(nombrecuentacontable ,chr(226)||chr(128)||chr(147),'-')
from ta_cuenta_contable
where nombrecuentacontable like 'Participaciones de los trabajadores%';

Participaciones de los trabajadores diferidas – Pa      Participaciones de los trabajadores diferidas - Pa
Participaciones de los trabajadores diferidas – Pa      Participaciones de los trabajadores diferidas - Pa
Participaciones de los trabajadores diferidas – Pa      Participaciones de los trabajadores diferidas - Pa
Participaciones de los trabajadores diferidas – Pa      Participaciones de los trabajadores diferidas - Pa
Participaciones de los trabajadores diferidas – Pa      Participaciones de los trabajadores diferidas - Pa
Participaciones de los trabajadores diferidas – Pa      Participaciones de los trabajadores diferidas - Pa
Participaciones de los trabajadores diferidas – Re      Participaciones de los trabajadores diferidas - Re
Participaciones de los trabajadores diferidas – Re      Participaciones de los trabajadores diferidas - Re
Participaciones de los trabajadores diferidas – Re      Participaciones de los trabajadores diferidas - Re
Participaciones de los trabajadores diferidas – Re      Participaciones de los trabajadores diferidas - Re
Participaciones de los trabajadores diferidas – Re      Participaciones de los trabajadores diferidas - Re
Participaciones de los trabajadores diferidas – Re      Participaciones de los trabajadores diferidas - Re

i use
update ta_cuenta_contable
set nombrecuentacontable = REPLACE(nombrecuentacontable ,chr(226)||chr(128)||chr(147),'-')
where nombrecuentacontable like 'Participaciones de los trabajadores%';

This OK. Thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question