DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: Total Beginner Question..or two

  1. #1
    Join Date
    Nov 2002
    Location
    Edmonton
    Posts
    2

    Talking Total Beginner Question..or two

    Hello:
    I have a question about PL/SQL, and also setting up JDeveloper 9.0.3

    I know i have been reading the PL/SQL 101 Books From Oracle Press and I purchased the Oracle 8i Web Developent book, However I cannot seem to find how to do a Phone Number for the Project I am Playing with.
    Example a 18005551212 I want to do 1 (800) 555-1212 would I have to do a substruct? how do you do a substruct? (It is not in the book)


    how does one do that?


    Question 2 Since My Setup at home Does not have the power to Run Orale 9ias i am Running Oracle 8.1.7 Rev 3 . Can I Use Jdev 9.0.3 with the JDBC thin Client With the Oracle 8.1.7 Rev 3 Enterprise? If so the how can i do that?

  2. #2
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    If only Oracle had a mask like Access. Perhaps you could write a function that started from the right and grabbed 4 digits, and then grabbed the next 3 and inserted a hyphon between the two, and then if there are another three digits enclose in () and if there is a 1 place it in the front. You could even add in logic that says if there isn't an area code then it would become the default area code. you can also look into a third party tool to clean up and format the data.

    One such tool is made by a company called 1st Logic. I'm sure there are others.

  3. #3
    Join Date
    Aug 2001
    Location
    Waterloo, On
    Posts
    547
    You can use the substr function in oracle and build upon it. You can either make your own function, your build a select statement directly,
    viz : select '('||substr(phone, 2,4)||')' from phone_table;

    Raminder Singh

    Oracle Certified DBA: Oracle 8i, 9i


    Mail me at raminderahluwalia@rediffmail.com.

  4. #4
    Join Date
    Nov 2002
    Location
    Edmonton
    Posts
    2

    Finally Phone Number mask for PL/SQL

    Once again Thank you Raminder Just thought I would post what I did to the code that Raminder explained to me for a simple table called contacts

    create table contacts (
    First_Name varchar2 (15),
    Last_Name varchar2 (15),
    Phone varchar2 (10));

    insert into contact values
    ('John', 'Doe', '1234567890');

    then to view them i did this


    select '('||substr(phone, 1,3)||')' "AREA",
    ''||substr(phone, 4,3)||'-'||substr(phone, 7,4)||'' "PHONE" from contact;

    And it works great in the PL/SQL viewer that I did the code into. I know lots of people are wanting to know this so here it is.


    Just making my first contribution in this forum.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width