Home » Developer & Programmer » Forms » How can define the format mask
How can define the format mask [message #232718] Mon, 23 April 2007 01:43 Go to next message
habib.khan
Messages: 20
Registered: March 2007
Location: Islamabad
Junior Member
Hello everybody,
i am using oracle 10g.i have a field name cnic number with data type is 'char'.i want to define the format mask in this field .i have been try like this '99999-9999999-9' but oracle display an error message 'wrong format mask for this data type'. How can i solve this problem.
if anyone can help me,please send the format mask instruction.
thanks in advance.
habib khan
Re: How can define the format mask [message #232774 is a reply to message #232718] Mon, 23 April 2007 04:28 Go to previous messageGo to next message
imen_mr2004
Messages: 22
Registered: October 2006
Location: tunisia
Junior Member
just try this mask, i'm using it in forms, i wish it can resolve ur problem, good luck
999" "999" "990.099
Re: How can define the format mask [message #232892 is a reply to message #232718] Mon, 23 April 2007 19:10 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
From the Oracle SQL Reference Manual
A format model is a character literal that describes the format of DATE or NUMBER data stored in a character string. You can use a format model as an argument of the TO_CHAR or TO_DATE function for these purposes:

Bascially, it does not work on a character field but during the transformation INTO a character field.

You have a database field 'cnic' which is on type 'char'. To use formatting you need to work with it as a number.

In your form do NOT display your character 'cnic' field, create a non-database field ('cnic_num') of type number with the format you desire, in the Post-Query trigger populate 'cnic_num' from 'cnic' and in the When-Validate-Item trigger of 'cnic_num' populate 'cnic'.

If you wish to STORE the number WITH the hyphens ('-') then you will have to use that format in the 'to_number' and 'to_char' that you have in the two triggers.

David
Previous Topic: How to change canvas sequences of a form
Next Topic: problem running form10g
Goto Forum:
  


Current Time: Sun May 26 18:11:13 CDT 2024