Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2005
    Posts
    25

    Unanswered: Need Help with Picture String

    I have a field called MacAddr. It is a varchar(12). In my report, I want to show it as 'XX-XX-XX-XX-XX-XX'. I don't know how. 'lil hep? Thanks

  2. #2
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    Is there a format that'll do it easily? Can't remember at the moment ... but this might work:

    SELECT REPLACE(TO_CHAR(macaddr, '99,99,99,99,99,99'), ',', '-') FROM your_table;

  3. #3
    Join Date
    Oct 2005
    Posts
    25
    Yes, but a MAC Addr is defined as a varchar(12) and contains Alphanumeric characters because if is a HEX number such as 000BCDF592B2. I would like my output to display:
    00-0B-CD-F5-92-B2
    Last edited by Book; 11-03-05 at 11:09.

  4. #4
    Join Date
    Feb 2004
    Location
    Dublin, Ireland
    Posts
    212
    maybe a bit uncomfortable, but what can you do...
    Code:
    select 
    substr(macaddr,1,2) || '-' || substr(macaddr,3,2) || '-' || substr(macaddr,5,2) || '-' || substr(macaddr,7,2) || '-' || substr(macaddr,9,2) || '-' || substr(macaddr,11,2) 
    from table

  5. #5
    Join Date
    Oct 2005
    Posts
    25
    Uncomfortable, perhaps, but, effective.

    Thank you.

Posting Permissions

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