Home » Developer & Programmer » Reports & Discoverer » Format mask for Char Fields (report 6i)
Format mask for Char Fields [message #325803] Mon, 09 June 2008 00:01 Go to next message
alijeyan
Messages: 184
Registered: January 2007
Location: IRAN
Senior Member
Hi All
how I can set Format mask for Char fields ?
(for example : iwant use : this format 99"/"99"/"99 for a field that value is '999999')
For Date field i can set "format mask" property .

ThanQ
Re: Format mask for Char Fields [message #325836 is a reply to message #325803] Mon, 09 June 2008 02:34 Go to previous messageGo to next message
Littlefoot
Messages: 21821
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Character fields don't have format. You'll have to do that in a query (or create a formula column). Here's an example:
SQL> create table test (char_col varchar2(20));

Table created.

SQL> insert into test (char_col) values ('123456');

1 row created.

SQL>
SQL> select char_col,
  2         replace(to_char(to_number(char_col), '99,99,99'), ',', '/') form_c
  3  from test;

CHAR_COL             FORM_C
-------------------- ---------
123456                12/34/56

SQL>

In other words:
- first convert character into a number (TO_NUMBER)
- apply valid format mask (TO_CHAR)
- replace comma with a slash (REPLACE)
Re: Format mask for Char Fields [message #325849 is a reply to message #325836] Mon, 09 June 2008 04:02 Go to previous message
alijeyan
Messages: 184
Registered: January 2007
Location: IRAN
Senior Member
ThanQ LittleFoot .
Very Goooooooooooooooddddddddd Idea !
Thanks
ALI
Previous Topic: Reports 6i - Calculation on Pagination
Next Topic: Arabic language in Reports 10g
Goto Forum:
  


Current Time: Sat Nov 09 00:20:28 CST 2024