SQL to remove special characters from my research

Hello world.  I am very new to sql and hit another road block.  I do a query on my database in oracle sql developer.  I want to search numbers manufacturer but sometimes they were seized with dashes (999-99-9999) and other times not (999999999) is possible to use a function that give my number query and in the mfr_nbr database column on the dashboard in two?

any help would be appreciated.

Kelly

Hi, Kelly.

Of course, you can use REPLACE function to return a copy of a string, but with all dashes (if there is) removed.

For example, if you have a string: user_input and you try to compare this to mfr_nbr, but you don't know if one (or two) contains dashes, you can tell

...

WHERE REPLACE (: user_input, '-') =.

REPLACE (mfr_nbr, '-')

You might want to permanently remove the dashes in the table, like this:

UPDATE table_x

SET mfr_nbr = REPLACE (mfr_nbr, '-')

WHERE mfr_nbr LIKE '%-% '.

;

then add a CHECK constraint (mfr_nbr = REPLACE (mfr_nbr, '-')) and perhaps a trigger, to keep the dashes in the table.

Tags: Database

Similar Questions

  • How to remove special characters from the string using translate() without typing all special characters?

    Hi all

    I am trying to remove special characters without the help of regular expressions.

    translate (the column name or string,'!@#$ & * (* () _) * "" :} {?}) >? /, «, » ')

    I want to eliminate this manual process to give all special characters using a chr() or ascii() function.

    Please show me the way.

    Thanks in advance

    Similar to the solution of Michael...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select "[it comes of the #] [more amazing!") Test @# "$* & $%) assuming chain cost $ 5 000' double Str)
    2, i like (select level 1 c from dual connect by level<=>
    3 less
    4 Select + 32 (level-1) double connect by level<=>
    5 less
    6 select + 58 (level-1) double connect by level<=>
    7 less
    8 select + 91 (level-1) double connect by level<=>
    9 less
    10. Select 123 + (level-1) from dual connect by level<=>
    11 less
    12. Select 255 double
    13            )
    14, ts as (select level r, substr (str, level 1) c
    15 t
    16 connect by level<=>
    17             )
    18, tf as (select row_number() (order for r) r
    19                    ,ts.c
    20 TS
    21 I join on (i.c = ascii (ts.c))
    22             )
    23 select replace (sys_connect_by_path(c,'!'),'! ') Str
    24 TF
    25 where connect_by_isleaf = 1
    26 connect r = prior r + 1
    27 * start with r = 1
    SQL > /.

    STR
    -----------------------------------------------------------------------------------------------------------------------
    Thisisthemostamazingtest¸astringcosting5000

    Or something as horrible as this...

    SQL > ed
    A written file afiedt.buf

    1 with t as (select "[it comes of the #] [more amazing!") Test @# "$* & $%) assuming chain cost $ 5 000' double Str)
    2, I like (select replace (sys_connect_by_path (chr (c), 'A'), 'A') as tr)
    3 of)
    4 select c, rownum r
    5 (select 32 + (level-1) as the double connection by level c<=>
    6                         union
    7 select + 58 (level-1) double connect by level<=>
    8                         union
    9 select + 91 (level-1) double connect by level<=>
    10 the union
    11. Select 123 + (level-1) from dual connect by level<=>
    12 union
    13. Select 255 double
    14 tri 1
    15                        )
    16                  )
    17 where connect_by_isleaf = 1
    18 log r = prior r + 1
    19 start with r = 1
    20            )
    21 select translate (str, 'A' |) TR, 'A') as str
    22 * t, I
    SQL > /.

    STR
    --------------------------------------------------------------------
    Thisisthemostamazingtest¸astringcosting5000

  • remove special characters

    Hello

    How to remove special characters except '-'',' '. " in a string.

    Database: 10g

    Thank you

    Hello

    For example, use the REGEXP_REPLACE

    REGEXP_REPLACE (str

    , '[^-,.]'

    )

    I hope that answers your question.

    If this isn't the case, please post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.

    In the case of a DML (UPDATE), for example, the sample data should show what looks like the tables before the DML, and the results will be the content of the or the tables changed after the DML.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

  • How to remove special characters that are not available in the key board

    Hi all
    How to remove special characters that are not available in the key board.
    select '106    ©      500049' str from dual;
    
    After removal of the special symbols ( not only copy right, it can be any special symbol other than key board symbols), I want to add a single space between two number.
    
    Output should be like:
    Str
    106 500049
    Thank you for your help in advance.
    select
     '106    © ® (k)      500049' str
    ,regexp_replace('106    © ® (k)     500049', '[^[:digit:]]+', ' ') r
    from dual
    
  • I have Adobe Acrobat Pro XI.  I went to special characters from the Edit menu and choose some emoji as Favorites, but I can't understand how to insert in the document.  How can I insert special characters into a document?

    How can I insert emoji or other special characters in a document using Adobe Acrobat Pro XI?  I went to special characters from the Edit menu and may not understand how to insert the special character in the document.

    He's not that kind of editor. You can use the characters in a font. If you can select a font with the emoji, which fits into the case, and then enter the characters, it can work.

    This suggests that you try to do TOO MUCH with a PDF file. It is a common thing, but the message should be: everything simply because you can edit a PDF file, does not mean that it is the most effective way for you to do your job.

  • Function to remove special characters

    I'm trying to figure out if there is a function anywhere in the Finder that can be used to remove special characters in a field. I wish they had just removed. Any help would be great.

    Thank you!

    934527,

    I'm glad it helped.

    When I said, "import" function, I should say, 'save' function. Using the administration tool of the Disco, the following should be done:

    -Connect to the instance of eul
    -Select Tools > register of PLSQL function
    -the import function (owner is SYS) and the function is in the package, 'STANDARD '. It seems that you did not identify SYS as the owner. In addition, it is very important to be aware that the 'STANDARD' is the package.

    Directions to the disco of 11g administration tool are here, http://docs.oracle.com/cd/E17904_01/bi.1111/b32519/adpsff01.htm.

    Patrick

    Published by: Patrick Bacon on May 20, 2013 14:32

  • Function to remove special characters in a column.

    Hi all

    In one of my column, we get special characters, as well as others. The data are extracted and loaded through Informatica. We are not face any problem while loading into the target, but when we try to extract these data through the report, it fails with the error:

    ORA-29275: partial multibyte character sets

    When we check this column, we find the special characters. Initially, we have implemented logic with the CHR to replace these NULL values. But every time we get different values. To make the permanent solution, we decided to remove all characters except available on Board of the key.

    Now, to this end, I need to write a function in Oracle's PL/SQL. I do not know more easy way from there to achieve. If I go with the CHR() function, I have to write for all these characters, which I think is not the right solution.

    Enjoy, if someone can help me identify the function or the way to get there.

    Thanks in advance.

    Hello

    AceNovice wrote:

    ... we have decided to remove all characters except available on key board...

    It depends on your keyboard.

    All that is on the keyboard you, something similar to this shoud work:

    REGEXP_REPLACE (string_column

    , '[^]0-9A-Za-z~!@#$%^&*()_+`={}| [\:";'' <>?,./-]'

    )

    This will return a copy of string_column, but with all the characters that are not not in the 2nd deleted argument.

    [Inside the brackets, ']' must come first (immediately after the ' ^') and '-' must come last.

  • Read the special characters from the txt file

    Hi guys,.

    on blackberry 9000, I tried to read some special characters like this: ° ²® µ±³ ° ¯´µ±´¯® text file

    using this function:

    FileConnection fc = (FileConnection) Connector.open ("file:///SDCard/test.txt", Connector.READ_WRITE);
    InputStream is = fc.openInputStream ();
    InputStreamReader reader = new InputStreamReader (is, "UTF - 8");
    LineReader lineReader = new LineReader (is);
    line & = new String (lineReader.readLine ());

    what I get is different, I can't write it here, it is difficult to find these characters.

    I change the content of the file to:

    ddfdsfdsfdsfdsfdsf
    aaaaabbbc ° ² ° ¯´µ±´¯® µ±³®

    now I get:

    ddfdsfdsfdsfdsfdsf
    aaaaabbbc, then the same characters

    How to display the same as what I have in the text file?

    Thank you

    To add to what martijnbrinkers said, you need not to the InputStreamReader because you don't use it (and this is why your code has no idea that the file is in UTF-8 encoding).

  • How to remove special characters UNICODE as n

    Hi all
    In my RDF file, I should accomidate comes so that, whatever currupt characters (UNICODE symbols in particular) between the email_address, he must change his later character like that...

    The output of n should be n. It is a kind of example...

    When the input value is 'john.mun [email protected]' he must return to "[email protected]".

    I tried to use the following functions, but the result shows me always the same...

    Select UNISTR ("john.mun [email protected]") of the double

    Select translate (trim (email_address) {,'1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ WE8ISO8859P1 ~! #$% ^ & * () _ +} {":?"}) [> < ' =] ["'; /, ',' (1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ') of per_people_f]
    where employee_number = 3951

    Select CONVERT ('john.mun [email protected]', 'US7ASCII') of double

    Select regexp_replace ('john.mun [email protected]', ' [^-. @, a - z, A - Z, [: space:]]') twice;

    If you have any ideas... Please let me know...
    Thanks in advance
    Ravi.

    Published by: rkpinus on July 30, 2009 08:14

    rkpinus wrote:
    In my RDF file, I should accomidate comes so that, whatever currupt characters (UNICODE symbols in particular) between the email_address, he must change his later character like that...

    The output of n should be n. It is a kind of example...

    When the input value is "john.mun[email protected]"he should return to ' [email protected]'

    You said it is corrupt, and you know n must be converted to n.

    You can add more characters you know the output should be, just add it to the function to translate.

    SQL> select
      TRANSLATE ( 'john.muñ[email protected]' ,'üéâäàåêëèïîìÄÅÉæÆôöòîìÅæáíóúñÑ','ueaaaaeeeiiiaaeaaoooiiaaaiounn')
    from dual ;
    
    TRANSLATE('JOHN.MUñO
    --------------------
    [email protected]
    

    SS

  • Request to remove special characters in a column

    How to retrieve only numbers in a column

    For example

    123-456-9876 need to be removed as a 1234569876

    -345 (123) - 6789 should be extracted as 1233456789

    + 1234567891111 should be extracted as 1234567891111

    Thank you

    IJ

    Hello

    Here's one way:

    SELECT REGEXP_REPLACE (str, '\D') AS digits_only

    FROM table_x;

    where str is the column.

    I hope that answers your question.

    If this isn't the case, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.

    If you ask on a DML statement, such as UPDATE, the sample data will be the content of the or the tables before the DML, and the results will be the State of the or the tables changed when it's all over.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: https://forums.oracle.com/message/9362002#9362002

  • How to find and remove special characters in the file name?

    I have a files in various Windows Server 2003 with a special character in its name, which cause problem with backup software, I Don t know which character is because in the browser that they do not appear and command line, they are listed only as a mark of the interrogation and for this, I Don t know how I'll find and delete then.

    Thank you.

    Ask in the forum Windows Server:
    http://social.technet.Microsoft.com/forums/en-us/category/WindowsServer

  • very special characters in columns

    I am trying to remove special characters from a db column using the below query, but I'm not getting results can someone help

    Select replace (CHR. (5) |) ' ABC'. Chr (1) | ' lkaljsk', Chr (5) | » '|| Chr (1)) double

    SQL > select regexp_replace (CHR. (5) |) ' ABC'. Chr (1) | ' lkaljsk ',' [' | CHR. (5) |] » ' || Chr (1) | ') of double
    2.

    A
    ----------
    abclkaljsk

    SQL >

    SY.

  • Values between removal of special characters

    Hi all

    I'm using the version of oracle 10.2

    create table
    CREATE TABLE DMM.foretst
    (
      lastname       varchar2(20 BYTE)
    );
    INSERT orders
    insert into foretst  (lastname) values
    ('ted'); 
    
    insert into foretst  (lastname) values
    ('teddy {abc}'); 
    
    insert into foretst  (lastname) values
    ('paul #'); 
    
    insert into foretst  (lastname) values
    ('paul #ggg#'); 
    
    insert into foretst  (lastname) values
    ('parker #'); 
    
    insert into foretst  (lastname) values
    ('ash 1'); 
    
    insert into foretst  (lastname) values
    ('$123$ vini'); 
    power required
    lastname
    ted
    teddy
    paul
    paul
    parker
    ash
    vini
    I know how to remove special characters. How to remove values between two special characters?

    any help is appreciated.

    Thanks in advance

    Something like that...

    Ranit>> select
      2  regexp_replace(lastname,'[^a-zA-Z]+(.)*[^a-zA-Z]+','')
      3  from foretst;
    
    REGEXP_REPLACE(LASTNAME,'[^A-ZA-Z]+(.)*[^A-ZA-Z]+','')
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ted
    teddy
    paul
    paul
    parker
    ash
    vini                                                                                                                                                                                                                        
    
    7 rows selected.
    
  • Remove the unused characters from string

    Hi, I try to remove unused characters from a string, but I can't find a function for this.

    The string like: 0000 0000 0000 0000 0000 0000 0130 3130 3030 3030 3004 0000 0000 0000 0000 0000 0000 0000, I need the characters from 01 to 04.

    I need some advice.

    If the characters between the SOH and EOT had a NULL value, then Match Regular Expression can be a choice:

    Find \x01, find something else THAN \x04, then find \x04

  • Remove unnecessary characters, space and channel numbers

    Oracle 11.2.0.1

    Windows

    I have data from the table like this:

    David Parker

    Robert Josh

    Hick 1/4

    John ' Fowler

    Bill.Gates

    Herman Patrick «»

    Andrew % Clark

    I want to delete all the numbers, special characters, more than one space between the words and make the correct name.  How can I remove extra characters from string.

    In fact, we get data that has sometimes special characters, including numbers and more spaces in name and it still creates a bad output query.

    Thank you.

    Or...

    SQL > t

    2 ALSO (SELECT "David Parker' DOUBLE str")

    3 UNION ALL

    4. SELECT 'Robert Josh' DOUBLE

    5. ANY TRADE UNION

    6. SELECT ' Hick' 1/4 OF the DOUBLE

    7 UNION ALL

    8. SELECT q ' [John 'Fowler'] ' FROM DUAL

    9 UNION ALL

    10. SELECT 'Bill.Gates' FROM DUAL

    11 UNION ALL

    12. SELECT q'[Herman 'Patrick']' FROM DUAL

    13 UNION ALL

    14 SELECT q'[Andrew % Clark]' FROM DUAL)

    15 SELECT regexp_replace (str, "[^ A-Za-z] + ',' '") final_str

    16 FROM t

    17.

    FINAL_STR

    -----------------------------------------------------------

    David Parker

    Robert Josh

    Hick

    John Fowler

    Bill Gates

    Herman Patrick

    Andrew Clark

    7 selected lines.

    SQL >

Maybe you are looking for

  • Problem keys NB100 after BIOS upgrade

    Hello After I updated the bios to version 1.60 than some quick keys, such as the brightness setting (fn + f9/f10) or the 'secret' (fn + f6) don't work anymore when the operating system starts, they work rather before loading the operating system. I u

  • How can I use iwatch with lpad2

    How can I use iwatch with lpad2?

  • Z530 taking not updates

    My Z530 liquid does not update... It shows bin.debuggerd not found... update.zip is not correct

  • Reload of Windows Vista

    I'm trying to remove Unbuntu from my Windows Vista Dell laptop: I first used diskmgmt.msc to remove Unbuntu partitions. Then, and this is the problem the grub no longer works which should. What I need is a Windows Vista startup disk to start the comp

  • Windows Media Player will not play files .avi or .mpg - Error Message: C00D1199

    Windows Media Player won't play .avi or .mpg files; files which I know to be readable by Windows Media Player. In addition, this program has played these accurate files in the month of August. The files are readable on other programs. I searched othe