Format NUMBER fields in SQLPLUS
Hi All,
I'm trying to extract a table into a file (fixed-length fields) with SQLPLUS. The column is 'DEPTNO', defined as NUMBER(2), So I did:
select to_char(DEPTNO, 'FM09') from table;
But this always gave me 3-character long output. I expect it to be 2-character long. Given the definition and the fmt I used. I can't figure out why. I also tried '09' and even RTRIM and LTRIM. Didn't work.
I had the following settings:
set space 0
set colsep ""
Am i missing something here?
I'll appreciate your help in advance.
Thanks!
Scott
null
The number formatting functions leave an extra character for a potential sign. This is an old "feature".
If you have access to Oracle's bug database there is information and some cross references in bug 287153 you may wish to review.
- CJ
Similar Messages
-
hi
how to format a data field by thosand separator like
111111 after formating 1,11,111
i tried to format a data field in thousand separator like this
select format(111111,"#,##0") from dual
but error is comingOh really, error is coming? :)
Were you not able to find any example in the documentation?
I mean, something like this:
SQL> select to_char(123456,'999G999') from dual;
TO_CHAR(
123.456
SQL> -
How to format large number field in XML so that it appears as is in Excel
Hi
I need help in formating the number field so that the number displays completely in Excel.
Ex: 12345678889453 and this appers in Excel as 1.23457E+13
Please let me know if you have any idea on this.
ThanksHi friends,
Thanks to all of you that you all have replied my question and given your answers.
Thanks to all of you specially Alpana Phapale, Wallie Chang, Poonam Thorat and Raghavendra Gadhamsetty, the answers given by you is the perfect one may be in different ways and only one can be used by me. But your answers were exactly correct.
Thanks to Asha Lund, your answers is also correct but the result as per my report should be in figures and not in words.
Whatever it may be but for repling thanks to you too.
Please be always with me, I am very new to Crystal Report and just learnt by my own as my Boss ordered me to do this and I have to make about 50 reports within 15 days. I think the day will start from today.
Well friends thanks a lot again for all your effort. -
Whole number field formatted as timezone in CRM 2013 SP1UR1 gives error on saving
Hi,
I added a whole number field formatted as time zone to the appointment form and when I save the record I get an error saying
Crm Exception: Message: An unexpected error occurred., ErrorCode: -2147220970, InnerException: System.InvalidCastException: Unable to cast object of type 'Microsoft.Xrm.Sdk.OptionSetValue' to type 'System.IConvertible'.
This error is coming from the timezone field and only happens when I have data in the field. Has anyone seen this?
Thanks
Rickard Norström Developer CRM-Konsulterna
http://www.crmkonsulterna.se
Swedish Dynamics CRM Forum: http://www.crmforum.se
My Blog: http://rickardnorstrom.blogspot.seMore info, the error occurs on pipeline stage 30 of the Book or Reschedule message and the same thing happens in CRM 2015. I've started a thread on connect with URL
https://connect.microsoft.com/dynamicssuggestions/feedback/details/1128206/crm-2013-sp1ur1-cant-handle-the-timezone-field
This must be rather new because I've tried it in CRM 2011 UR late and it did not occur there, I haven't tried CRM 2013 RTM though so I can't say if it's a CRM 2013 or a CRM 2013 SP1UR1 issue.
BTW, the 2015 org was a complete vanilla so I've pretty much ruled out custom code as a culprit :)
Regards
Rickard Norström Developer CRM-Konsulterna
http://www.crmkonsulterna.se
Swedish Dynamics CRM Forum: http://www.crmforum.se
My Blog: http://rickardnorstrom.blogspot.se -
Date format(for number fields)
Hi there.
I'm creating some sql queries wich will be executed by some users throught the Oracle client PL/SQL, and I need to format some fields in date format.
Those fields are NUMBER(8) and they are in that format: "YYYYMMDD"
The format I want to put that information is: "DD.MM.YYYY".
What's the easiest way to do that?
The version that I'm using is Oracle 9.2.0.4.0.
Thanks by the way.Hi,
Use TO_CHAR to convert the number to a string,
use TO_DATE to convert the string to a date, then
use TO_CHAR to format the date.
TO_CHAR ( TO_DATE ( TO_CHAR ( numeric_column
, 'fm00000000'
, 'YYYYMMDD'
, 'DD.MM.YYYY'
)This shows why storing dates in some other kind of column is a bad idea. -
Web app Number field: How to format a number as currency in Business catalyst
Not a coder. I have a Number field I have created in my web app, please how can I format this field to display the figures like this 999,999,999,999 (#120,000,000) random figure. Help will be appreciated.
You can't. Number type field is there for storing integers. 999,999,999,999
is not an integer. You need to use text string. Unless you're using the
field inside the search form, in which case you need to use JavaScript to
format the content of the field on the frontend.
Cheers,
Mario -
Exporting to CSV, a number field is changing format
Post Author: MELANIE ELIASON
CA Forum: Exporting
Exporting to CSV, a number field is changing formats. I have it excluding the decimals places and commas.
Can anyone help? I am using version 10.
MelPost Author: V361
CA Forum: Exporting
If you are exporting to Excel, it may be Excel that is changing the number format.
you could totext , but then Excel will treat it as text and not as a number.
May not be what you want. -
How to FORMAT a number field in Formula editor
Dear All,
I have a "QUANTITY" field in database which has to get displayed in the report as " QTY : " that will look like QTY : 54.
Where as now it coming as QTY : 54.00
So, how to format this field in the Formula Editor while concatenation of
"QTY : " + CStr()
If any one has any idea please help me out.
Thanks and regards.Hi friends,
Thanks to all of you that you all have replied my question and given your answers.
Thanks to all of you specially Alpana Phapale, Wallie Chang, Poonam Thorat and Raghavendra Gadhamsetty, the answers given by you is the perfect one may be in different ways and only one can be used by me. But your answers were exactly correct.
Thanks to Asha Lund, your answers is also correct but the result as per my report should be in figures and not in words.
Whatever it may be but for repling thanks to you too.
Please be always with me, I am very new to Crystal Report and just learnt by my own as my Boss ordered me to do this and I have to make about 50 reports within 15 days. I think the day will start from today.
Well friends thanks a lot again for all your effort. -
Glogin.sql and number fields
Oracle 11.2.0.3
I can go
col <column name> format 999,999,999,999
Is there a way to do this for all number fields with 1 command? sqlplus has a numwidth field. I have a rather long glogin.sql script. This is just personal preference. I like seeing commands in the numbers fields.
This is more for convenience. I have a long list of these in my glogin.sql scripts and I am hoping to find 1 command.
http://docs.oracle.com/cd/B19306_01/server.102/b14357/ch6.htm
Hunted through the sqlplus commands, but I can't figure out how to do it.Like this?
SQL> set numformat 999,999,999,999
SQL> SQL> select 123456789 from dual;
123456789
123,456,789
John -
Format for fields in an internal table
DATA: BEGIN OF ITAB OCCURS 0,
AUFNR LIKE AFKO-AUFNR, " Purchase Order Number
PLNBEZ LIKE AFKO-PLNBEZ, " Part Number
BISMT like MARA-BISMT, " Old Material
LNO(2),
GAMNG LIKE AFKO-GAMNG, " Production Order Quantity
GLTRP LIKE AFKO-GLTRP,
VDATU LIKE VBAK-VDATU,
KWMENG LIKE VBAP-KWMENG,
MBDAT LIKE VBEP-MBDAT,
GBSTA LIKE VBUK-GBSTK,
PCTBS(5),
*CSHOT
"CDESC
END OF ITAB.
LOOP AT ITAB.
WRITE:/3 ITAB-AUFNR,
13 ITAB-PLNBEZ,
23 ITAB-BISMT,
LNO(2),
45 ITAB-GAMNG,
65 ITAB-GLTRP.
57 ITAB-VDATU.
*63 ITAB-KWMENG,
69 ITAB-MBDAT.
PCTBS(5),
*C
ENDLOOP.
I have a internal table and I have writing the itab in the write statement. I need to format the field in itab.
for eg:
itab-gamng(lenght as 5)
itab-gltrp(its a date) i just need the mm/yy how can I format it.You don' need to reformat the itab, just the fields before you write them.
<b>data: monthyear(5) type c.
data: qty(5) type c.</b>
LOOP AT ITAB.
<b>concatenate itab-gltrp+4(2) '/'
itab-gltrp+0(4)
into monthyear.
clear qty.
qty = qty + itab-gamng.</b>
WRITE:/3 ITAB-AUFNR,
13 ITAB-PLNBEZ,
23 ITAB-BISMT,
* LNO(2),
<b>*45 ITAB-GAMNG,
45 qty,
* 65 ITAB-GLTRP.
65 monthyear.</b>
* 57 ITAB-VDATU.
* *63 ITAB-KWMENG,
* 69 ITAB-MBDAT.
* PCTBS(5),
*C
ENDLOOP.
Regards,
Rich Heilman -
Minimum length of Number field in VO
Hi,
I am adding a attribute of NUMBER type in VO and i have to give the default value to 0001, to be displayed to user on screen.
But as it is a number, so on screen its displaying the value as 1.
How can we restrict that in VO?
Thanks,
PriyaHi Priya,
Follow the steps below-
Edit the transient attribute on which you want to do this. Go to Control Hints section. Select the Format Type field as 'Number'. You will see the Format field enabled now. Select '0000' in this field and you are done. You will now notice that even if you enter value '9' in this field, it will actually save it as '0009'.
Regards,
Ansh -
Right alignment of Number Field in OAF Page
Hi,
I need to right align the column of the table which is of number type in OAF page. I have extended the VO of that page to add new columns. After VO extension i added the column to the page via personalization and gave the reference of view attribute name as per Extened VO. I have set the following properties for that column
Item Sytle- Message Style Text
Data Type- Number
Nowrap=false
Vertical Alignment=Middle
View Attribute = Prior (same as Extended VO's column)
View Instance = XXPayEmpAccrualActionInfoVO
I need to set the value of this newly added column right align which is currently set as left align by default.
I have tried the following links from OTN
Re: Q: How to format number using personalization?
Right align number field
but while controller extension i m getting the following error-
Message not found. Application: FND, Message Name: FND_VIEWOBJECT_NOT_FOUND. Tokens: VONAME = XXPayEmpAccrualActionInfoVO; APPLICATION_MODULE = oracle.apps.pay.selfservice.payslip.US.server.PayPayslipAM;
The extended controller code is -
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
OATableBean tableBean = (OATableBean)webBean.findIndexedChildRecursive("PayPayslip4Ss");
tableBean.queryData(pageContext, true);
tableBean.prepareForRendering(pageContext);
DataObjectList aColFormat01 = tableBean.getColumnFormats() ;
oracle.cabo.ui.data.DictionaryData ColFormat01 =(oracle.cabo.ui.data.DictionaryData)aColFormat01.getItem(pageContext.findChildIndex(tableBean, "Prior"));
ColFormat01.put(COLUMN_DATA_FORMAT_KEY,NUMBER_FORMAT);
Please can anyone provide me some pointer here..this is really urgent.
Thanks in advance
Renu
Edited by: Renu Gupta on Jun 14, 2010 5:15 AMHi Renu,
Use the following code:
OAMessageStyledTextBean origContSumBean = (OAMessageStyledTextBean)webBean.findIndexedChildRecursive("<FieldName>");
if(origContSumBean!=null) {
origContSumBean.setAttributeValue(CURRENCY_CODE,new OADataBoundValueViewObject(origContSumBean,"CurrencyCode"));
Here CurrencyCode should be a view attribute in the VO associated to the items in the region.
Regards
Sumit -
Formatting a field in the repetitive area of the Print Layout Design
Our quantity fields in the repetitive area print out with a decimal point and 3 spaces after the decimal point (i.e. 10.000). How can I change the format of these fields so that there are no decimals included (i.e. 10) when we print an order?
Thanks.
Edited by: Philip Eller on Jun 19, 2008 9:56 AM
Edited by: Philip Eller on Jul 3, 2008 3:11 PM*Mike,
You could use the Formula ABS( )
Add a Formula type field
In the Formula select formala ABS()
syntax: ABS(Field_xyz)..here field Field_xyz is your number field
If your value was 10.000 the result will be 10. This formula ignores the decimal part.
The formula ROUND could be used if you want to ROUND the value to the nearest higher or lower integer
Consider number 10.450
ROUND(Field_xyz,2) will give 10
ROUND(Field_xyz,1) will give 11
Suda -
Format Number in XML Publisher
Hi
I am developing a RTF template for EXCEL output report. I am trying to format a number value in this report
<?xdofx:if to_number(QUARTER_QUANTITY) > -1 then QUARTER_QUANTITY end if?>
in the above line of code how could we format QUARTER_QUANTITY field (i need 9,999, 999 format)
I have tried both
format-number:fieldname;’999G999D99’
format-number(number,format,[decimalformat])
nothing worked for my.
Can some one please help me to resolve this issue.
thanks
RajHi Raj,
Were you able to solve this problem? I am running into the same problem where I want the number to dsiplayed with 2 decimals. When I view the output in Excel format , it cuts off the last zero for eg 18.30 becomes 18.3 If i use any other Output format like HTML trailing 0s are preserved. How do I solve this
Thanks -
Format-number not working for me with preview to excel
Hi,
I have a report with 8 fields across within a table.
Each field is formatted in the same way, with format-number like this (there are 8):
<?format-number:total-year-remaining;’PT999G999D99’?>
(that's the type-your-own form-field help text in the word template).
When I preview the PDF, the data looks fine (8 cells shown below):
.00 (.10) (.10) .00 (.50) (.50) (.60) (.60)
But when previewing to Excel, there are two problems:
1. Only the data in the last field (the 8th one) is formatted with the oracle mask:
(.60)
But upon closer inspection, there are two blank spaces after the number in that cell, and the value itself is treated like a string, e.g. '(.60) '. In fact if I ask excel to format this cell like a number with currency and two decimal places, in won't do it because of trailing spaces. Its just not a number to excel at that point. Probably the ('s don't help things either.
2. The data in the first seven fields in excel are numeric, and I can format them in excel as currency, but I wanted XMLP to handle this, not the excel user.
The bottom line is this: I want both PDF and excel output. I want both forms to have the fomat mask applied correctly. And I want excel to treat each cell as a number. Is this possible?
Thanks
AdamAnatoli,
Hello!
I don't know if my situation is the same as yours, but after a lot of head-scratching, forum searching and template rebuilding, I finally figured out my problem.
I had one column that no matter what I did kept appearing in Excel as text. I'd format it to Number in Excel and nothing. When trying to sum the column, Excel would not recognize any of the values as numbers. I even did the reformatting on the XML Word template to number, and the currency format that Adam mentions. Still no go. The $ and ',' appeared, but column still formatted as string.
I just finally noticed Adam's mention of the 2 extra spaces at the end of the numbers and sure enough mine was doing the same thing. Take out the 2 spaces and voila! Number!
Every time I redid my template in Word (07 and 03), I used the wizard. (Add-ins>Insert>Table>Wizard) walked through the steps, not really changing anything. Then I would preview and the spaces would be there. The column that I was having problems with was the last column of the table, which would get the text 'end G_ASSIGNED_CC' inserted in after the field name - separated by 2 spaces. Once I took out these two spaces, so the column now shows 'COSTend G_ASSIGNED_CC', it worked fine in Excel - all numbers.
Hope that helps someone out there as I was having a heck of a time finding anything (solutions anyway) on this.
Thanks,
Janel
Maybe you are looking for
-
I've downloaded iTunes 10.5 onto my iPod Touch, no problems but I've now got a constant error message on my laptop everytime I switch it on and access the internet. The message is "The procedure entry point xmlTextReaderConstName could not be located
-
Unexpected error when trying to reset Firefox sync
Hello, I am trying to reset my password for Firefox sync with no success. When i enter my email address and hit "next" i get "Unexpected error". I don't want to create a new account with a different email address. Any help is appreciated.
-
Some email not appearing in the inbox
My Iphone 3gs doesn't appear to be downloading all my emails. When I check my computer, some are downloaded and some are only on my computer. Anyone with similar issues? Any advice? Thanks!
-
I'm trying to buy from my In-Apps
Hi everyone. I hope someone can help me with this. I After the last update, I tried buying from my Apps some Extensions, but I can't. They all had the same "unknown error". What should I do?
-
i have the same problem if someone could please help Problem description: macbook very slow after installing yosemite EtreCheck version: 2.1.8 (121) Report generated 12 March 2015 at 1:56:10 PM SAST Download EtreCheck from http://etresoft.com/etreche