Format mask a number
Hi,
I'm using db 10.2.0.1.0
I'm trying to find a difference between two dates using the below formula
:STM_DURATION := to_number ( trunc( :STM_END_TIME - :STM_ST_TIME )*24
+ trunc( mod( (:STM_END_TIME - :STM_ST_TIME)*24, 24 ) )
||'.'|| trunc( mod( (:STM_END_TIME - :STM_ST_TIME)*24*60, 60 ) )) ;But if the difference is 3 minutes or 30 minutes, it is showing .3
How can i set the number to 2 decimal point? or how can i find the actual difference
Thanks
Edited by: Divya on Oct 31, 2011 10:12 PM
Divya wrote:
Hi,
I'm using db 10.2.0.1.0
I'm trying to find a difference between two dates using the below formula
:STM_DURATION := to_number ( trunc( :STM_END_TIME - :STM_ST_TIME )*24
+ trunc( mod( (:STM_END_TIME - :STM_ST_TIME)*24, 24 ) )
||'.'|| trunc( mod( (:STM_END_TIME - :STM_ST_TIME)*24*60, 60 ) )) ;But if the difference is 3 minutes or 30 minutes, it is showing .3
How can i set the number to 2 decimal point? or how can i find the actual difference
Thankswhat do you mean "the actual difference"
your result will give you the number of hours in the rounded down number of days between the two dates.
don't trunc the result of taking one date away from another if you want the real result. also, since a date minus a date is a number, you don't need to_number.
as for actually displaying the result the way you want, the function you should look into is TO_CHAR();
Similar Messages
-
How do you add a format to the "Date Picker Format Mask" available formats?
Hi,
When I select the Date Picker Format Mask or "Number / Date Format" they doen't have YYYYMMDD or others that may be desired...
How do you add a format to the available formats?
Thank you, BillBill - From the popup help text:
If you need to create a Date Picker item, but the format you need does not appear in the Display As list, select Date Picker (use application format mask). When an application uses this type of date picker, the Application Express engine derives the date format from an item named PICK_DATE_FORMAT_MASK. You can populate this item in two ways:
- By defining an application substitution string named PICK_DATE_FORMAT_MASK
- By creating an application-level item named PICK_DATE_FORMAT_MASK
See the doc for more details.
Scott -
Number format mask of text item is not applied
Hello all,
I want to format a number like 999G999G999G999G990D00
Is specify the format mask under source of the item. But it is not applied and I don't understand why.
See http://apex.oracle.com/pls/otn/f?p=53873:2 for example
Btw. is it possible to set the format for all numbers in the application at once? I want to have a thousand separator in most cases.
Message was edited by:
Jacob_BHello Jacob,
Btw. is it possible to set the format for all numbers
in the application at once? I want to have a thousand
separator in most cases.I am using substitution strings for things like that. You can define some "global" substitution strings on page application definition.
So you just have to put in the format (999G999G999G999G990D00 ) in there once and give it a name. Let's say NUMBER_THOUSAND.
Afterwards you can reference it wherever you need the format e.g. this way:
to_char(10000,'&NUMBER_THOUSAND.').
This way you just have one place where to change the format model.
Regards,
Tine -
Applying date and number format mask
I have specified a date format for an attribute and a number format for another attribute of an entity object using Entity Object Editor - Control hints for the attributes.
The date format is:
Format type: Simple Date
Format: dd.MM.yyyy
The number format is:
Format type: Currency
Format: 0,000.00 km
When using <c:out value="${bindings.MyDate}"></c:out> the format mask for the date is applied and it looks good, but when using
<c:forEach var="Row" items="...">
<c:out value="${Row.MyDate}"></c:out>
</c:forEach>
the format mask is not applied.
When it comes to the number format it is not applied no matter what I use.
I have tried setting the format for the view object attributes as well but the result is the same. How do I make this work?Can it have something to do with <html:form> ? Since it works using <c:out value="${bindings.MyDate}"></c:out> inside a html:form.
-
Apex 4.2: Date picker & format mask number
Hello
In Apex 4.2, in a Date Item, how can I modify the date picker to set Monday as the start of week day? I can set Monday as the start of week day on a calendar, but not in a Date Item.
In a Number Item, there's no format mask to set the comma char as a decimal separator and the dot char as a thousand separator. How can I create a new format mask number?
Thank you.
Edited by: user7034195 on 12-mar-2013 3:24for the Date Item, you can check this link, you have to call the process on the page load
http://stackoverflow.com/questions/1313317/set-start-day-of-the-week-in-jquery-ui-datepicker
and for the Number format, there's a little trick involved, will try to explain
First of all convert you items from Number field to simple Textfield.
1. Write this in your items Post Calculation Computation: TO_CHAR (:item_name, '999G999G999G999G990D00', 'NLS_NUMERIC_CHARACTERS = '',.''')This will do the number formatting you want, but in oracle above format is not acceptable, so while submitting the above values to database we need to undo the changes for that you can use the below code.
2. Create a Computation "After Submit" for every item you did the above formatting and copy this code in it: replace(replace('1.00.00,00','.',''),',','.') for the 2nd step you can create a package/function which will get the items value as string and do the conversion as number using above code and return back the number.
This should help you.
Regards,
Tauceef -
I want Change format mask for all fields that type's number
Such as
if :parameter_value = 1 then
all fields format mask = ' 999,999,990.000' ;
else
all fields format mask = ' 999,999,990.00' ;
end if;
RegardsSo, i have bad news for you : you'll have to rebuild again.
Meanwhile i have excellent news for you : there's an online tool made by Johannes Henseler called Sidecar xml which builds the necessary xml file for you, sort of what you find in the Digital Publishing Folio Editor website, but saves it in your Folio folder.
Next time you import all your folder (with that file), it will place all the necessary information, and even reorder the articles.
Build once, play many times. -
Number field - Format mask and validation
APEX 4.2.1
When a page item with source=DB column uses a Number type and a currency format mask (FML999G etc), when the page is rendered, it properly formats the number.
The built-in Item is numeric validation appears to be handle this reasonably ok. i.e. both formatted values and only-digits both validate ok.
But any after-submit validations choke on the non-numeric characters in the field! Please don't tell me I have to a) create shadow items and/or b) replace() out the non-numeric characters in the validation.
After so many years and versions, why doesn't APEX have a simple, declarative, elegant solution to handle such a basic function?
Am I missing something?
ThanksAs described in the item help
"Select or enter a format mask. Note that format mask is applicable only to items of source type Database Column."
In my experience, and this goes for the great web experience, not just the application you're designing - I've found the most data entry fields avoid formatting.
Relevant information is often shown item labels.
Any occasional the business has specifically asked for formatting, I've taken the same approach as I've needed to for years - before web development (and every time you use the to_date/to_char functions for date conversions) - validate the information as per expectation. If you think the user will be adding punctuation to a numeric field, then you must validate accordingly.
This usually means adding TO_CHAR(value_entered, expected_format_mask) to your validation control, instead of presuming APEX will read the user's mind and know the content of that numeric field may not be numeric.
Date entry does the same thing - ultimately there is a session date format that is implicitly used by Oracle to convert an entry of 12-10-2012 to the appropriate date -- ie, is it October or December?
Have a think about the various websites you visit personally - plane bookings, concerts, ebay, etc - how many expect entry to be purely numeric? My recollection is most, except maybe some credit card fields, but most use some sort of regular expression to sort that out. And you can tell the validation is coded respectively.
Generally, I reserve this sort of primping to reporting - even then it's made to be subtle - just like I'd prefer makeup to be ;-)
Most users just care about the data, not how it looks.
Scott
blog: [url grassroots-oracle.com]grassroots-oracle.com
twitter: [url twitter.com/swesley_perth]@swesley_perth
-- please mark any useful posts as helpful or correct, in the end it helps us all -
APEX cannot accept any other number format mask except 999G999G999G999G990?
Hi, guys:
Can anyone help me on this problem? I have a report with a column of number type, but I want to use accounting format mask such as <1234.56>, however. whenever I choose any other format model for this number column, I got the error message as "ORA-01481: invalid number format model", I can only choose Numeric format mask: 999G999G999G999G990
Anyone could give me a hint on this? I am using APEX 4.1 and Oracle 11G R2. Here is my query for report
select uh.descr, inv6.userkey, inv6.invno, inv6.amt-pa_temp.Subtotal_Payment over_short_amount
from
(select pa6.invoicekey, sum(pa6.amt) Subtotal_Payment
from payments pa6
where trunc(pa6.pmtdate)<=to_date(:P55_DP_VPF_PROD_DATE,'DD-MON-YY')
and pa6.type not in (5)
and pa6.invoicekey in (select pa5.invoicekey
from payments pa5
where trunc(pa5.pmtdate)=to_date(:P55_DP_VPF_PROD_DATE,'DD-MON-YY')
and pa5.type=2
group by pa6.invoicekey) pa_temp, invoices inv6, userhdr uh
where inv6.userkey=uh.userkey
and pa_temp.invoicekey=inv6.invoicekey
and pa_temp.Subtotal_Payment<>inv6.amt
and abs(inv6.amt-pa_temp.Subtotal_Payment)>1000
order by 1Thanks a lot!
SamI found the cause. Thanks!
-
How to ignore/remove number format mask ?
Hi
I have to import some numbers from the excel sheet, and that number has been saved along with the format mask like (9,999.99) (2,000.00,1,500,00,......)
but that field in my table is a number filed and i have to equal that number with the number that exist in my table
i have write that relation like
mytable.filed1=to_number('excel_filed',9,999.000)
but I does not work
So what the solution for that
Thank youDouble post. See How to remove a number format mask ?
-
Portal Form: Number Format Mask Accepted Values
Hi, i'm trying to format the way numbers are displayed in our forms, specifically instead of 50,000.00 we want 50,000 - without the .00.
I cannot find anything on format masks in the portal documentation, and the standard oracle masks I have looked up such as "NNNN" etc don't seem to be supported.
Trial and error has yielded a mask of : 99,999,999 which does get rid of the decimal, but introduces a problem where if the value is smaller than the mask it is shifted into the middle of the field (leading spaces are being added for every missing unit that is specified in the mask), but obviously if a smaller mask definition is used then larger numbers appear as ###### which is worse than the leading zero problem.
Where in the documentation can I find the accepted forms of numerical number format masks for use in portal forms?
Thanks..Let me know if you find a solution to this. I even asked my Oracle instructor and she couldn't tell me how to setup a date format mask. This is what she gave me which doesn't work, but I'm not saying I'm the quickest race car at the track. lol
"Hi,
Try the following format mask "("099")""-"099"-"0999. They have an example of this on page 7-12. I'm not sure if OTN may have a listing of any Forms format mask. Search under Forms Developer and see if you find anything.
Take care,
L" -
Civil Identity Number Format Mask
Dears,
I Need to change the Format Mask for the Civil Identity Number In The People Enter And Maintain Form
Any Idea How Can I Do That ?
Thanks in Advance.
BR,Thanks. I did an "on submit and before computation" process that did a SQL replace on the page item. The DML process then successfully inserted the value into the database.
Alex. -
Oracle Number and Java Format Mask Issue
I have a oracle number column, in my view object it is of type BigDecimal and the query column type is NUMBER
I put the following format mask in the hints section
#####.00
with a format type of Number,
Yet when I run the application, I always get the following error
java.lang.NumberFormatException: For input string: "-3750.00"
Anyone any ideas why this does not work?
Regards
OrlandoHi,
try with <af:convertNumber>
See:
http://jdevadf.oracle.com/adf-richclient-demo/docs/tagdoc/af_convertNumber.html
ADF 11.1.1.4.0 af:convertNumber not working with #,##,##,##,##,##,##0.00 -
If i am providing format mask is 9 and providing value as 5, then i am getting output as " 5", means a white space padded just before the output. so can any body inform me is this a forms 6i bug, or the output is something like this only.
A white space is padding just before the output for any Format Mask.what is the maximum lenght of the value?
select max(length(MODEBA))
from POLK_A_CT
SQL> with POLK_A_CT as
2 (select '123' MODEBA from dual
3 union all
4 select '456' MODEBA from dual
5 union all
6 select '0987' MODEBA from dual)
7 select to_number(MODEBA,'999') MODEBA
8 from POLK_A_CT;
ERROR:
ORA-01722: invalid number
no rows selected
SQL> with POLK_A_CT as
2 (select '123' MODEBA from dual
3 union all
4 select '456' MODEBA from dual
5 union all
6 select '0987' MODEBA from dual)
7 select to_number(MODEBA,'099') MODEBA
8 from POLK_A_CT;
ERROR:
ORA-01722: invalid number
no rows selected
SQL> with POLK_A_CT as
2 (select '123' MODEBA from dual
3 union all
4 select '456' MODEBA from dual
5 union all
6 select '0987' MODEBA from dual)
7 select lpad(MODEBA,3,'0') MODEBA
8 from POLK_A_CT;
MOD
123
456
098
SQL> -
Hi All,
If I enter 99999 in the form it has to display 99,999.00.
What is the format Mask that I have to use to make it dispaly in this way.
Actually I tried 999,999,999.99 but this is leaving empty spaces...and If the number is bigger then It wont display that...
Please advice.
Thanks,
SatishOnce you have the number format, you can trim the left spaces.
1* select to_char(99999,'99,999,999,999.00') result from dual
sql > /
RESULT
99,999.00
sql > select ltrim(to_char(99999,'99,999,999,999.00')) result from dual;
RESULT
99,999.00Thanks,
Rajesh. -
How to remove a number format mask ?
I have to import some data form excel sheet. but the number in that sheet have been saveed as the following format mask 1,000.000(2,000.000,1,5000,00) as charchter
but in may table that field is a number, so how can remove the format mask from the excelsheet?
Thanks846640 wrote:
I have to import some data form excel sheet. but the number in that sheet have been saveed as the following format mask 1,000.000(2,000.000,1,5000,00) as charchterI am wonder how to apply format mask in excel for the character cell.
but in may table that field is a number, so how can remove the format mask from the excelsheet?So, while reading from excel how the values is coming in the variable i assume its coming with comma(,) than what happens if you try like below?
variable_name:=TO_NUMBER(REPLACE(variable_name,',',''));
-Ammad
Maybe you are looking for
-
I had drafted a message about my Firefox freezing up when opened and, before I hit "Post Question," I tried to check to see what add-ons I have. Somehow that opened a new page on top of the one I was on. When I tried to back up to my message to hit t
-
Mixing hypervisors and Ironic with NSX
I've been tasked with setting up a laboratory environment with OpenStack (Juno), and blades running KVM, Xen and VMware ESXi hypervisors, as well as bare-metal deployment of an arbitrary kernel, which I hope to do using Ironic (deploying CoreOS). It'
-
How to connect iphone to a lap which has itunes
Culd sme one help me in syncing my 5s to lap itunes
-
I have a DV2270US, and I can't get the integrated webcam to work. I tried to uninstall it and that failed, so I attempted to do it manually by removing the program folder, removing registry keys, etc. Now everytime I try to run the installer, I get a
-
BPEL process instance getting created twice
Hi, We have B2B - BPEL integration developed using AQ and we are using this for importing 850 Purchase Orders. It is a simple flow involving dequeuing 850 transaction message by the AQ adapter and processing the message through Receive, Transform and