format phone number

I need to format the phone number in a column of table as phone_number to

(+ 1-888-888-8888) to (888)888-8888


y at - it a function or query in oracle for this.  Help is appreciated

SQL> with t
  2  as
  3  (
  4  select '(+1-888-888-8888)' phone_no from dual union all
  5  select '888888-8888' phone_no from dual union all
  6  select '+1-888-888-8888' phone_no from dual union all
  7  select '1232341233' phone_no from dual
  8  )
  9  select phone_no
 10       , '(' || substr(phone_no_digit, 1, 3) || ')' || substr(phone_no_digit, 4, 3) || '-' || substr(phone_no_digit, 7) phone_no_new
 11    from (
 12          select phone_no
 13               , substr(regexp_replace(phone_no, '[^[:digit:]]'), -10) phone_no_digit
 14            from t
 15         );

PHONE_NO             PHONE_NO_NEW
-------------------- --------------------
(+1-888-888-8888)    (888)888-8888
888888-8888          (888)888-8888
+1-888-888-8888      (888)888-8888
1232341233           (123)234-1233

SQL>

Tags: Database

Similar Questions

  • Remove formatting phone number?

    I have a form in which a user enters his phone number and I need another field to fill the numbers without any formatting. For example, if a user enters 555-232-4455 it would appear in the new domain as 5552324455. I guess it could be a script made in the field of origin on the blur, but I don't know the best way to do it. Any suggestions? Thank you!

    In the second field, you can use this custom code as the calcluation script:

    Event.Value = this.getField ("Phone No").valueAsString.replace(/\D/g,"" ");

  • Phone number fields

    Hello

    I have my phone set up number fields so that when the user enters a 10-digit phone number, they tab above and it appears as such: (999) 999-9999. I was wondering if there is a script that can be used to allow only the codes 204 and 431.

    Thank you in advance for any help you can give me.

    NikDk

    Form1.Page1.Subform1.telephone::exit - (JavaScript, client)

    validat formats include 1234567890, (123)456-7890 and (123) 456-7890

    var regex = / ^-(?) () \d{3})\) ? [- ]? ({\d{3}) [- ]? (\d{4})$/;

    var str = this.rawValue;

    If (regex.test (str)) {}

    var areaCode = "";

    Regex = / ^ \d{10}$/;

    If (regex.test (str)) {}

    the format is 1234567890

    codeZone = str.substring (0.3);

    If (ZipCode == '204' | codeZone == "431") {}

    "Str =" ("+ str.substring (0.3) +" "") "" + str.substring (3.6) + '-' + str.substring (6.10);

    this.rawValue = str;

    }

    else {}

    xfa.host.messageBox ("the area code must be either 204 or 431.");

    }

    }

    else {}

    the format is (123)456-7890 or (123) 456-7890

    codeZone = str.substring (1.4);

    If (ZipCode == '204' | codeZone == "431") {}

    this.rawValue = str;

    }

    else {}

    xfa.host.messageBox ("the area code must be either 204 or 431.");

    }

    }

    }

    else {}

    xfa.host.messageBox ("Please enter the 1234567890 format phone number, (123)456-7890 or (123) 456-7890" ");

    }

    Steve
  • Display the format US phone number - best practices

    JDeveloper 12.1.3

    -Telephone table has field VARCHAR2 with phone numbers. All records have exactly 10 numbers (characters) length

    -In the user interface, I want to show number xxx-xxx-xxxx, that is to say with af:outputText or similar device

    -observe that I am looking for display, and no to entry/edit phone number

    -in search of best practices

    What I did but am not satisfied:

    -In the t 3 has created a transitional attributes with the default SQL string. For example:

    Phone1To3: substr (Phones.Phone, 1, 3)

    Phone4To6: substr (Phones.Phone, 4, 3)

    Phone7To10: substr (Phones.Phone, 7, 4)

    Then in file jsff (the table component):

    <af:outputText value="#{row.Phone1To3}-#{row.Phone4To6}-#{row.Phone7To10}" shortDesc="#{bindings.Phones.hints.Phone.tooltip}" id="ot2222"/>
    

    Another way (better, easier)?

    In my view, that the best practice is to do your own converter in this case you will not need transitional attributes as you did. After doing a converter, you can add this converter inside outputText inputText. .. to display the required format

    To find out how a converter, you can check this url

    Sameh Nassar: Create custom converter

  • Phone number format

    Hi team,

    need your help, I am using oracle 11G.

    My phone field is of type varchar2 and it shows data on format below.

    81668798343000000000000

    I wanted to remove unwanted zeros.

    result should be 816687983430

    Please help me out here

    Hello

    siebelD kirjoitti:

    Hi team,

    need your help, I am using oracle 11G.

    My phone field is of type varchar2 and it shows data on format below.

    81668798343000000000000

    I wanted to remove unwanted zeros.

    result should be 816687983430

    Please help me out here

    No, you don't say what the rules involved in this area. Otherwise it's hard to know that a zero belong to a phone number and rest zeros does not work.

    I guess the length of phone number is 12

    Select substr ('81668798343000000000000', 1, 12) of double

  • Validate / Format of phone number with Extension

    I am trying to allow users to enter a phone number, with the POSSIBILITY of adding an extension at the end, but I can't seem to get the good coding...

    Thus, users should be able to type the following:

    5555555555

    555-555-5555.

    (555)555-5555

    555-555-5555

    As well as

    55555555551234

    1234 5555555555

    555 555 5555 1234

    555-555-5555 1234

    And they should all validate/format:

    555-555-5555 ext (number of optional expansion)

    5 years and 1234 s are only examples.

    I tried to use a mask of arbitrary, but you are unable to view OPTIONAL characters method... they want to all be necessary therefor 9999999999 ext9999 eventually REQUIRE a 4-digit extension.

    Thanks in advnace for your help

    It can be done using a custom size validation script.

  • Phone number in html format

    My problem is related to the recognition of phone number in the Blackberry browser: I have created a simple webpage using html and displays the numbers as 07811987654
    I need to click on it and call the phone call

    07811987654

  • How to make a 'active' phone number in the text box?

    I'm testing in 10.1 and 10.2, using the following QML simulators.  What I'm trying to understand is that 'rules' the text box used to set the active text, including phone numbers.  All I'm trying to do is to put a phone number in the text box that my users the opportunity to click on it to the phone.  But I can't make it work, or more exactly, may not get the phone number to become active.  .

    As you can see that I tried a variety of number formats, some specific UK because I was afraid that he may use country specific recognition, but nothing I try works.

    On the other hand the address which I also put in the TextArea is 'hot' and started the map.

    FYI, the client is running in Canada on Q10s using 10.1.  The numbers are also completely fictitious, if they work, then that is a stroke of luck.

                    TextArea {
                        inputMode: TextAreaInputMode.Text
                        editable: false
                        content.flags: TextContentFlag.ActiveText
                        text: "#123 1234, #123-1234  ph: 780-784-1231. ph: (403)218-1248. ph: 403-242-1231. ph: (01637)123456. 81 Street NE, # 101 ,, Calgary. "
                    }
    

    I saw this:

    http://supportforums.BlackBerry.com/T5/native-development/textarea-showing-quot-phone-numbers-quot/m...

    I was expecting that I didn't set the attributes for the text using C box.

    And I don't have permissions phone - eslewhere in the application that I detect when the user is on the phone.

    Any ideas on how I could get a phone number in a TextArea to be active, would be appreciated.

    Well, for what it's worth here's what I get with your data :

  • getDevicePhoneNumber() provides the phone number with the unicode left-to-right mark

    I use getDevicePhoneNumber (boolean format) ( http://www.blackberry.com/developers/docs/4.6.0api/net/rim/blackberry/api/phone/Phone.html#getDevice... (boolean)) to get the telephone number of my camera. I know that maybe it's not the actual number. I also can't use something else as the pin of the device. I use it to fill a field "my phone number" by default that can be edited manually in the case where the number is not correctly being read on the SIM card.

    It works really well and displays the phone number in the field. However, a thorough review to the string of shows that he has the mark unicode '% E2% 80% 8F' in front of the string. This brand is known in unicode (utf-8) "BRAND LEFT-to-RIGHT ' (sources: http://www.tachyonsoft.com/uc0020.htm and http://unicode-search.net/unicode-namesearch.pl?term=mark ).

    I only experienced it in BB OS 4.6 devices (does not check 4.7 yet), but it seems not to happen in OS 4.5 and below.

    Were there changes to the orientation of the chain in OS 4.6?

    Can I get rid of this brand using String.trim (); or I have to use something else?

    This problem persists on my 9000 "BOLD", but none of my other GPS phones.

    Because it was a pain to try to understand, here's the code I used to solve this problem.

    private String trimPhoneNumber(String phoneNumber){
        byte phoneBytes[] = phoneNumber.getBytes();
        int length = phoneNumber.length();
        int offset = 0;
        if ( phoneBytes[0] == 0x3F ) {
            length--;
            offset++;
        }
    
        return new String(phoneBytes, offset, length);
    }
    
  • Get the phone number

    Hello

    I would like to get the phone number of the device by using APIs.

    Is this possible?

    DK

    Phone class
    public static String getDevicePhoneNumber (boolean format)
    Retrieves the phone number of the device if it is present

  • Contact phones number smart blackBerry when rings

    When my phone rings, it shows the phone number of the appellants, but it will not show the name if they are in my contact list. Finished the call name contacts indicated in the call log, just don't no when sounds. Any ideas? Worm 4.7.1.57

    It could be one of the three solutions... Try these:

    1. make sure that you set your own country code to the Phone Dialer screen > Options > smart dialing.
    Set your country code in this format: "+ xx" where xx = country code. Some countries have two or three-digit country Codes. Do not place not the '+' in the entrance of your contact.
    * In the United States, the value of this country as '+ 1' Code and place your local area code in the appropriate box (this normally the default setting in a new BB).

    2. in the same place, change the length of National number for the number of digits corresponding to your country (since some countries have less than 10 as that set by default in the BB). Check out the total numbers, less country code. Do not place not the '+' in the entrance of your contact.
    * For example, some countries have a total number to 8 (more than 3 for the country code). You must enter '8 '.

    3. you probably have "Content Protection" located on your address book.
    Look at the Options > Security > General settings. Scroll down to the content Protection > include addresses = no

  • I have a request for a phone number in my HTML code in my database which is automatically filled with the correct sales phone number when sending emails. I create HTML code in dreamweaver and then put the code in my e-mail program. I need to do the ph

    I have a request for a phone number in my HTML code in my database which is automatically filled with the correct sales phone number when sending emails. I create HTML code in dreamweaver and then put the code in my e-mail program. I need to make the phone number in the clickable query. I know the code to do it well not in a query. What is the code?

    As far as I saw, most of the smartphones will automatically recognize it these days, as long as the number is written in a format of regular phone number. This format also allows to make images or text other than a telephone number in a tap to call the link.

    Looking at what you have presented I guess it would be something along the lines of...

    urmcell>>">urmcell >

    When the location of the link and the link text would be the same variable.

    I've never worked with Intelliclick so above is a wild guess. They would be those who need to ask themselves if there is a way to fill in the address of a link like that.

  • GREP phone number

    Hello

    Im not no matter what good to GREP and stumbled on a GREP that formats telephone numbers, as they should.

    But I can't understand how to change that GREP, since I don't understand nothing.

    \d ( ? =(\d{2}) + \ >) | \d{1}/

    Currently my GREP is housed in a paragraph style. It applies to a character-stye with single spacing, do look good (in Germany) to phone number

    Telephone 01234/12345

    TO

    Phone 0 12 34 / 1 23 45

    So far so good!

    But currently I use two styles of paragraph for a complete address as

    123 MyStreet

    Phone 1234/123456

    do not format my street.

    I want to use only a single paragraph with GREP inside for this style, so the GREP should be changed to
    don't apply, if 'telephone ' is in front of a number.
    Is this possible? Can you experts help out me?

    See you soon

    Jan

    Seems to work:

  • int, long variables print 03444482399 phone number not correct on console

    Hi all

    my code is public class {student

    private String name;
    private int rollNo.
    private String stclass;
    private phoneNo long;
    program on the private channel;

    public void setName (String name) {}
    myIdName = name;
    }
    {} public void setRollNo (int rollNo)
    this.rollNo = rollNo;
    }
    {} public void setstClass (String stclass)
    This.stclass = stclass;
    }
    {} public void setPhoneNo (long phoneNo)
    this.phoneNo = phoneNo;
    }
    {} public void setProgram (television program)
    This.Program = program;
    }
    public String getName () {}
    return the name.
    }
    public int getRollNo () {}
    Return rollNo;
    }
    public String getstClass () {}
    Return stclass;
    }
    public long getPhoneNo () {}
    Return phoneNo;
    }
    public String getProgram () {}
    back to programs;
    }
    public student (String name, int rollNo, stclass, long phoneNo, program of the string String) {}
    setName (name);
    setRollNo (rollNo);
    setstClass (stclass);
    setPhoneNo (phoneNo);
    setProgram (the program);
    }

    public String toString() {}
    Return "\n" + name + "" + rollNo + "\t" + stclass + "\t" + phoneNo + '\t' + program;
    }

    {} public void finalize()
    }
    }

    Please find below the console out put of my program of javac.

    Student REGISTRATION 1

    ___________________________________________________________________________
    : S-NAME: S-ROLL No.: S-class: S-phone number: S-PROGRAM

    ___________________________________________________________________________
    : ali raza hasan: 15: HE 633338943: GCS
    ----------------------------------------------------------------------------------------------------------------------------------

    I want my phone number in the correct format to print console.

    The real reason for your problem, it's that a phone number is normally not a long or integer type, but more as a string type. Long and wide are signed numbers, so you are in trouble if the phone number is greater then the positive long more important or integer (unsigned: 2³²-1 = 4·1024³-1; signed:-2³¹.. +2³¹-1, because the sign bit is the highest bit).
    Think about international phone numbers that start with a sign '+' as an abbreviation for the combination to get an international line.
    I suggest to use String as a type for the phone number.

    Timo

  • Adding a '-' in the name field for things like SS # or phone number

    This seems to be a simple question, but a search is not just do what anyone.  Maybe I don't know what to look for?

    I'm doing in the fields with the hyphens "-" already in place for the fields as a social security number or phone number.

    Example of phone:

    A person in the field of 5555551212 types and fills "555-555-1212" automatically by moving the cursor to the next empty space when this section of the field is complete.

    Example of the art:
    A person types in 223233923 and the same thing happens with dashes: 223-23-3923

    I have the same question for Dates too, but with slashes: 07202012 would result in the 20/07/2012.

    This is probably a simple framework, but I don't know where to look.  Help, please!

    PS. I know how to change the 'format' to force the user to ENTER the '-' or ' / ', but what about automatically place there for them or have aready here?

    PPS. I found the Script 'Auto-onglet' here: http://www.planetpdf.com/developer/article.asp?ContentID=javascript_setfocus_method_f & gid = 6267 however, which forces me to cut to the top the field in 3 different areas and I would avoid it if I could.

    You can use the following to format your SSnumber:

    Put this in a document-level script:

    function formatSSN () {}

    var s = event.value

    var re = /^(\d{3}) [---]? (\d{2)} [ -]? (\d{4})$/;

    If (re.test (s)) {}

    var match = re.exec (s);

    Event.Value = match [1] + '-' + match [2] + '-' + match [3]

    }

    }

    Put this in the Script of custom Format for the fields that you want to format:

    formatSSN)

Maybe you are looking for