format accontno

chalie001
chalie001 used Ask the Experts™
on
how can i format account no

select acctno from employee

bb0201938

display like
bb-010-1938

oracle database
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Team Lead
Commented:
try:
select acctno, substr(acctno,1,2)||'-'||substr(acctno,3,3)||'-'||substr(acctno,6,4) NewacctNo
from employee;

Open in new window

Ryan ChongSoftware Team Lead

Commented:
i assume you mean "bb-020-1938", NOT "bb-010-1938"

bb0201938 >> bb-020-1938
awking00Information Technology Specialist

Commented:
Will the acctno always be in the same format (e.g. in your example 2 alpha characters followed by 7 digits)?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
it can be both

12-001-1451
bb-020-7775
Most Valuable Expert 2012
Distinguished Expert 2018

Commented:
Did you try the substr in the first post?

If that didn't work, please explain why.

Author

Commented:
correct

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial