To change the datatype using format mask -- [message #318309] |
Tue, 06 May 2008 08:13 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
sudharshan
Messages: 48 Registered: November 2006
|
Member |
|
|
Hi,
I want to change the value based on the datatype.
A part of the coding:
I have written one cursor to fetch v_format and then
IF v_format = 'NUM' THEN
m_format := '9999999.99' ;
ELSIF v_format ='DATE' THEN
m_format := 'DD-MON-YYYY' ;
ELSE
m_format := null ;
END IF ;
SET_ITEM_PROPERTY('blockname.column_name',FORMAT_MASK, M_FORMAT);
Column name is varchar2.
This piece of coding is not working. I kindly request someone in this group to throw light on what is wrong?
Regards
Sudharshan
|
|
|
Re: To change the datatype using format mask -- [message #318375 is a reply to message #318309] |
Tue, 06 May 2008 11:50 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
Quote: | This piece of coding is not working.
|
It is, of course, useless. How is anyone supposed to know what happened when you executed this piece of code unless you tell us? Is there any error? If so, which one? If not, what do you mean by "is not working"?
Topic title says that you'd like to change item's DATATYPE. As far as I can tell, you can't do that. Item datatype is defined during development process and can not be changed dynamically. What you are trying to do (using the SET_ITEM_PROPERTY built-in) is modifying FORMAT (not datatype).
Now, if you (for example) set item datatype to NUMBER, you can't expect it to contain DATE format (because DATE can not fit into NUMBER (unless it is Julian date)). Therefore, perhaps you should choose CHARACTER datatype for this item. Doing so, you might format it using the TO_CHAR function, using the appropriate format mask.
For example, you'd format numbers as TO_CHAR(value, '999G990D00'), dates as TO_CHAR(value, 'dd.mm.yyyy') etc.
|
|
|