#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    nm
    Posts
    17
    Rep Power
    0

    pl/sql format mask


    I have declared the following variables:

    variable name: city_population
    value: 55000
    data type: Number

    variable name: statehood_population
    value: 07/10/1890
    data type: Date

    I want to display city_population as 55,000 and statehood_population as July 10, 1890 using DBMS_OUTPUT. How do I use the format mask to do this? Should the format mask be used when declaring the variables or when displaying them? thanks!!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    68
    Rep Power
    12
    For the date one, please try:
    select to_char(sysdate,'Month DD,YYYY') from dual

    Cheers,
    Dan
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    68
    Rep Power
    12
    For the number conversion, please try:
    select to_char(1000000, '99G999G999') from dual;

    Cheers,
    Dan
  6. #4
  7. No Profile Picture
    Senior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Canada
    Posts
    308
    Rep Power
    12
    For number conversion you can also use:

    SELECT to_char(city_population,'99,999,999') from dual;

IMN logo majestic logo threadwatch logo seochat tools logo