Column/data varchar but req number formatting when digital.

Hello

I wrote some sql to retrieve data from our Oracle database.

Number formatting is a bit unfortunate.

The column reads:

1 000 000

0.010

1 000

0.0009

9999999.000

-

null

> NWG

If its not all of the numbers, but if it is a number, I need to correctly format i.e.

without decimal places if they are just led 0

I hope that there is a regular expression that I can use to format numbers ignoring the character entries.

Any suggestions?

Hello

Whenever you have a question, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the accurate results you want from this data, so that people who want to help you can recreate the problem and test their ideas.

Explain, using specific examples, how you get these results from these data.

Always say what version of Oracle you are using (for example, 11.2.0.2.0).

See the FAQ forum: Re: 2. How can I ask a question on the forums?

What do you mean by "if it's a number"?  The following could all be considered numbers:

  • -1
  • -1.2E + 3
  • $9,987,54
  • 123 456,7
  • 3/4

Depending on what you consider a 'number', you can use expressions regular, perhaps combined with other string manipulation functions, like to TRANSLATE.

You can consider a function defined by the user who tries to convert it to a NUMBER, but never to raise an error.  See How to determine if a Varchar2 string has characters from a to z?

Which type of formatting you want for the numbers?  You said that you don't want to end ' 0 decimal, but how about a trailing decimal point?  When you post the sample data and results, examples of all individual cases, you want to manage.

You may need TO_CHAR and then some channel, for example, RTRIM or REGEXP_REPLACE mainpulation functions.

As you realize you probably now, it's a really bad design.  You let people in chains that may or may not represent the numbers, then, much later, trying to guess the whehter they meant it to be number, and if so which COMP.  Guess, isn't a very good way to solve problems.  The person who knows the data if it is a number or not - make him tell you at the point where it enters the number.  For example, instead of having 1 VARHCAR2 column, you may have 2 columns (a VARCHAR2 and a NUMBER) and a CHECK constraint that requires at least 1 of them to be null.

Tags: Database

Similar Questions

  • Add the Date and time in PDF format when printing in Acrobat Pro ms

    Hello!

    I am trying to find a way to add a date stamp and time in a PDF file in Acrobat Pro ms when the document is printed. I found a great video on how to do it, but the version of Acrobat is older and the method no longer works.

    Old video version: https://acrobatusers.com/tutorials/how-to-add-a-date-stamp-to-a-form.

    The video lasts only 1.5 minutes and described what I need a t-shirt! I know that the process requires javascript, but I have no experience with this and need a very simple description of what I need to do (very, very basic if you please). As and for the record, I'm working on a Windows 7.

    mrsholliemae wrote:

    I am able to locate where to edit the document and the option "add text".

    ...

    Do not use it.

    Use the 'form to prepare' and add a text box.

  • Edition of text column data Format database columns of answers

    Hello

    We use Oracle Business Intelligence Enterprise Edition v10.1.3.4 on the cube for OLAP Oracle 11 g. Reports we create have (among other things) columns with an underlying type of VARCHAR data in oracle tables.

    When we try to change the properties of such a VARCHAR column column, "Data Format" tab shows only 'Plain Text' as an option under the menu drop-down "Override default data Format". Options to display the text 'HTML' or 'LINKS', etc. are not available.

    All entries on what can be done in the answers or the repository to get these options for formatting of column data are highly appreciated.

    Thank you
    Piyush

    You set your HardenXSS to false in the instanceconfig.xml file? By default, OBIEE is set to true. Setting to false allows the HTML tags to appear as options for fields VAR. check it out here... Chapter 2, page 37.

    http://download.Oracle.com/docs/CD/B40078_02/doc/bi.1013/b31766.PDF

  • The number of column date deadline - please explain

    I have a requirement where I have to save YYMMDD (source varchar) in MMDDYY (target date). How can I do that. Is it possible to save MMDDYY to the date data type.

    Hello

    958218 wrote:
    I have a requirement where I have to save YYMMDD (source varchar) in MMDDYY (target date). How can I do that. Is it possible to save MMDDYY to the date data type.

    No.; YYMMDD MMDDYY format apply only to broadcasters; all DATE columns are in the same internal format.
    If you have a string (in one of the predefined formats), you can use TO_DATE to convert it to a DATE. So if you found the information of date in YYMMDD format, you can do something like:

    INSERT INTO  table_x (entry_date)
    VALUES (TO_DATE, 'YYMMDD'));
    

    If you want to display a DATE in a particular format, use TO_CHAR. For example

    SELECT  TO_CHAR (entry_date, 'MMDDYYYY')  AS entry_date
    FROM    table_x;
    

    Avoid numbers 2 years where possible. They cause a lot of errors.

    Published by: Frank Kulash, 19 March 2013 14:56
    TO_CHAR TO_DATE examples added

  • Number format not valid in the data transfer Assistant

    I'm trying to download data from a CSV file in a table via the download data wizard. However, it always seems to fail on some lines with an error "invalid number format". Even if I stick one of these lines in the wizard, it still does not work. There is nothing wrong with the data, and I can do a regular insert Toad with no problems.

    The data are:
    28126238,101, RM, 29/01/2011

    The table looks like this:
    CREATE TABLE STR_PROD_UPLOAD
    (
    NUMBER OF PROD_CD,
    NUMBER OF STORE_CD
    CHARACTER VARCHAR2 (10 BYTE),
    DATE OF REPL_START_DT
    )

    It works very well on Toad:
    INSERT INTO STR_PROD_UPLOAD)
    STORE_CD,
    PROD_CD, line, repl_start_dt)
    VALUES (to_number('101'), to_number('28126238'), 'RM', to_date('1/29/2011','MM/DD/YYYY'));

    Anyone have any ideas on what might be wrong or how I can go about the matter of finding?

    FYI - evolution STORE_CD of a varchar2 and PROD_CD solves the problem, but I would like to know if it is possible to solve this problem for later use.

    Thx John

    Hi John,.

    For some reason, I get the same error. However with the download of the data, you can still provide you own number format in the case where the application could not a defined automatically. In your case, using Date / field number Format (for example: 99999999) will force the system to use the supplied format.

    Concerning
    Patrick

  • I can't open my camera of withdrawal because it asks to format when inserted, but when format us windows says it can't complete the format

    I can't open my camera of withdrawal because it asks to format when inserted, but when format us windows says it can't complete the format

    This problem is usually caused by

    1. problem with the connecting cable
    2. the problem with USB port
    3. problem with the device itself.
    I suggest you try changing ports and cable. If this does not work, the problem is with the device only.
    In addition, note that the option to remove is not necessary to be used if you use Windows XP or a higher version of Windows and the device has an indicator of activity.
    As you can see, most USB storage devices are configured for the fast-moving, which means, no need to use the option remove safely. If you are sure of a use, for example, a file transfer operation is complete, you can remove the device directly.
  • I just bought an upgrade for the 14 items.  I downloaded it, but when I try to activate it I need a serial number.  When I connect to my Adobe account and follow the links, there is no information on my account on theproduct so no naked series

    I just bought an upgrade for the 14 items.  I downloaded it, but when I try to activate it I need a serial number.  When I connect to my Adobe account and follow the links, there is no information in my account on the product so no serial number.  Can anyone help?

    When you purchase a download you will be emailed a serial number... did you receive your email?

    Find your http://helpx.adobe.com/x-productkb/global/find-serial-number.html serial No.

  • Installation of Acrobat 9. He got on another PC but want it on my new. When I install it, it asked the serial number. When I enter it, it says it's invalid. Old PC has the disable grayed out... any ideas?

    Installation of Acrobat 9. He got on another PC but want it on my new. When I install it, it asked the serial number. When I enter it, it says it's invalid. Old PC has the disable grayed out... any ideas?

    You must use the exact installation file that corresponds to your serial number.  of course, the versions must match.

    a little less obviously an acrobat pro installation file must be used with a number of pro series, and if a serial number is a sequence that includes acrobat, you must use the installation files on.

    Error "serial number is not valid for this product". Creative Suite

  • I am trying to convert my trial creative Cloud to a version of payment, but I keep blocked when the computer asks me to enter a serial number, WHERE can I FIND? Thanks for your response

    I am trying to convert my trial creative Cloud to a version of payment, but I keep blocked when the computer asks me to enter a serial number, WHERE can I FIND? Thanks for your response

    Hello

    You can check out the link below.

    Applications creative Cloud back in test mode after an update until 2015 for CC

    Hope this will help you.

    Kind regards

    Hervé Khare

  • I have purchased Adobe Design Standard CS6 2013 with serial number, but can't find the to no download on a new mac laptop. When I try and add the serial number to 24 digits on my account it doesn't seem to work?

    I have purchased Adobe Design Standard CS6 2013 with serial number, but can't find the to no download on a new mac laptop. When I try and add the serial number to 24 digits on my account it doesn't seem to work?

    CS6 - http://helpx.adobe.com/x-productkb/policy-pricing/cs6-product-downloads.html

    You can also download the demo version of the software through the page linked below and then use your current serial number to activate it.

    Don't forget to follow the steps described in the Note: very important Instructions in the section on the pages of this site download and have cookies turned on in your browser, otherwise the download will not work correctly.

    CS6: http://prodesigntools.com/adobe-cs6-direct-download-links.html

  • Hello my name is Vittorio agoi about 2 years have bought a student teacher licensed cs6 master collection, which has worked fine until recently. I don't know why, but now it stop working and keeps asking for my serial number. When I enter my serial No.

    Hello my name is Vittorio. 2 years ago, I bought the master collection CS6 which worked perfectly until recently.

    Now, I get the question to enter my serial number and when I do this I get the invalid response. But it's the same number that worked before! What can I do to get it working again the CS6?

    Hi Vittorio,.

    We would like to know if you have re-installed your product on this machine. We also want to hear your version of OS.

    Meanwhile, try:

    -Atul Saini

  • Faced with the conversion of an U8 2D array data in a Matlab file format?

    I'm trying to convert a simple 2D array of U8 (3 channels) data in a matlab file format.  I was manipulate the examples in the labview2matlabni record - but I can't read in Matlab - the matrix is not readable - said inconsistent number of columns.

    I have included my vi with a sample data as input.  I'm sure this shouldn't be so hard!

    Thanks in advance - all help is appreciated!

    If you have not already, doen

    You can check this site, http://matio-labview.sourceforge.net/. In my view, there are screws to back up or to import files dull.

    See you soon,.

    McDuff

  • Form Validation failure: "value is not a date and time in the format"

    Hello world

    I am facing a weird problem in my custom OAF page. I'm displaying the records of a particular table through dynamic VO and dynamic array. All records appear correctly. But when I try to click on NEXT 10 records in a table, I get the error like "FAILED FORM VALIDATION: 1000 ORG CUST BO VERSION is not a date and time in the format. Just like in the screenshot below.

    DESKTOP.JPG

    Strange part of the question, if I select the columns to display not related to this day, so I only am not facing problems. If I select only dates to display and also am not facing this problem. If I use the mixture of this type varchar2 and data, I get this error.

    I tried to change the type of data but no use.

    If we close, look at the PARTY_ID error message trying to copy its data to ORG_CUST_BO_VERSION the last column. Why what's happening clue me less. Can anyone guide me on this please?

    The problem is that you use the same name for the creation of the MessageTextInputBean inside the Table.

    The name of MessageTextInputBean make it dynamic.

    ex: -.

    OAMessageTextInputBean oamessage = (OAMessageTextInputBean) createWebBean (pageContext,

    MESSAGE_TEXT_INPUT_BEAN,

    NULL,

    'text' + columnNo);

    See you soon

    AJ

  • Partitioning the table - range on data type (21, 7) number and varchar2

    Hello

    Database version:

    DB: Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    Operating system: HP - UX nduhi18 B.11.31 U ia64 1022072414 unlimited-license user

    APP: SAP - ERP

    I have to the partition of the RANGE on UPDATED_ON or PROFILE is a table that has a structure below:

    Name Null?    Type

    -------------------- -------- --------------

    ------------------

    MANDT NOT NULL VARCHAR2 (9)

    MR_ID NOT NULL VARCHAR2 (60)

    PROFILE NON-NULL VARCHAR2 (54)

    NO_REGISTRE NOT NULL VARCHAR2 (30)

    INTERVAL_DATE NOT NULL VARCHAR2 (24)

    AGGR_CONSUMPTION NOT NULL NUMBER (21.6)

    MDM_VERS_NO NOT NULL VARCHAR2 (9)

    MDP_UPDATE_DATE NOT NULL VARCHAR2 (24)

    MDP_UPDATE_TIME NOT NULL VARCHAR2 (18)

    NMI_CONFIG NOT NULL VARCHAR2 (120)

    NMI_CONFIG_FLAG NOT NULL VARCHAR2 (3)

    MDM_DATA_STRM_ID NOT NULL VARCHAR2 (6)

    NSRD NOT NULL VARCHAR2 (24)

    REASON_CODE NOT NULL VARCHAR2 (9)

    QUALITY_FLAG NOT NULL VARCHAR2 (3)

    METHOD_FLAG NOT NULL VARCHAR2 (6)

    MSATS_UPDATE_DAT NOT NULL VARCHAR2 (24)

    MSATS_UPDATE_TIM NOT NULL VARCHAR2 (18)

    READ_STATUS NOT NULL VARCHAR2 (3)

    LEGACY_FLAG NOT NULL VARCHAR2 (3)

    CREATED_ON NOT NULL NUMBER (21.7)

    CREATED_BY NOT NULL VARCHAR2 (36)

    UPDATED_ON NOT NULL NUMBER (21.7)

    UPDATED_BY NOT NULL VARCHAR2 (36)

    CVERSNO NOT NULL VARCHAR2 (18)

    OLDER_MD_FLAG NOT NULL VARCHAR2 (3)

    TRANSACTION_ID NOT NULL VARCHAR2 (108)

    According to my knowledge, RANGE is better suited for the DATE or NUMBER. and partition INTERVAL is available on the DATE or number.

    PROFILE of column

    I havets is of type VARCHAR2. I know that again I can partition as Oracle convert internally to varchar2 in number when the data is inserted. But the INTERVAL is not possible.  However, so could you please suggest how RANGE partition on PROFILE?

    CREATED_ON column:

    It's the NUMBER with decimals. Could you guide me please?

    Please let me know if you need more information?

    See you soon

    Sameer

    I partitioned table as below:

    PARTITION BY RANGE

    (

    "CREATED_ON".

    )

    SUBPARTITION BY HASH

    (

    'PROFILE '.

    )

    SUBPARTITION TEMPLATE

    (

    TABLESPACE SUBPARTITION 'PROF_SUB01"'PSAPISU."

    TABLESPACE SUBPARTITION 'PROF_SUB02"'PSAPISU."

    TABLESPACE SUBPARTITION 'PROF_SUB03"'PSAPISU."

    TABLESPACE SUBPARTITION 'PROF_SUB04"'PSAPISU."

    TABLESPACE SUBPARTITION 'PROF_SUB05"'PSAPISU."

    TABLESPACE SUBPARTITION 'PROF_SUB06"'PSAPISU."

    TABLESPACE SUBPARTITION 'PROF_SUB07"'PSAPISU."

    TABLESPACE SUBPARTITION 'PROF_SUB08"'PSAPISU."

    TABLESPACE SUBPARTITION 'PROF_SUB09"'PSAPISU."

    TABLESPACE SUBPARTITION 'PROF_SUB10' 'PSAPISU '.

    )

    (

    "BEF12_CP00" VALUES LOWER PARTITION TO (20120101000000),

    "JAN12_CP01" VALUES LOWER PARTITION TO (20120201000000),

    "FEB12_CP02" VALUES LOWER PARTITION TO (20120301000000),

    "MAR12_CP03" VALUES LOWER PARTITION TO (20120401000000),

    "APR12_CP04" VALUES LOWER PARTITION TO (20120501000000),

    "MAY12_CP05" VALUES LOWER PARTITION TO (20120601000000),

    "JUN12_CP06" VALUES LOWER PARTITION TO (20120701000000),

    "JUL12_CP07" VALUES LOWER PARTITION TO (20120801000000),

    "AUG12_CP08" VALUES LOWER PARTITION TO (20120901000000),

    "SEP12_CP09" VALUES LOWER PARTITION TO (20121001000000),

    "OCT12_CP10" VALUES LOWER PARTITION TO (20121101000000),

    "NOV12_CP11" VALUES LOWER PARTITION TO (20121201000000),

    "DEC12_CP12" VALUES LOWER PARTITION TO (20130101000000),

    "JAN13_CP13" VALUES LOWER PARTITION TO (20130201000000),

    "FEB13_CP14" VALUES LOWER PARTITION TO (20130301000000),

    "MAR13_CP15" VALUES LOWER PARTITION TO (20130401000000),

    "APR13_CP16" VALUES LOWER PARTITION TO (20130501000000),

    "MAY13_CP17" VALUES LOWER PARTITION TO (20130601000000),

    "JUN13_CP18" VALUES LOWER PARTITION TO (20130701000000),

    "JUL13_CP19" VALUES LOWER PARTITION TO (20130801000000),

    "AUG13_CP20" VALUES LOWER PARTITION TO (20130901000000),

    "SEP13_CP21" VALUES LOWER PARTITION TO (20131001000000),

    "OCT13_CP22" VALUES LOWER PARTITION TO (20131101000000),

    "NOV13_CP23" VALUES LOWER PARTITION TO (20131201000000),

    PARTITION 'OTHER_CPMAX' VALUES LESS THAN (MAXVALUE)

    )

    works very well.

  • Keep the format when exporting to Excel

    Is it possible to keep the number and width of columns formatting when you export to Excel?

    You also have a possibility to customize your class "export."

    (1) you can set a custom action that does something totally different and make it available to your users. For example, we have done something in the past where a custom window gets arises and you can 'choose' attributes in your grid that you want to be exported, rather than be "linked" to the configured columns.

    (2) you can set the class that makes the export in the control panel under the frame settings. Maybe it's a little less flexible that you will be always tied to the model and the existing export format (it is passed to your class, rather than the CSVExport class), but you would be in full control of output. Like Sasha said, by default, CSV is the output format and things like formatting are obviously not taken in charge.

    I think that #1 would be the way to go because it offers the most flexibility for your users, but there should be a somewhat higher effort.

    # 1, you can see an example of this in action here:

    http://branchbird.com/images/exporting-options.PNG

    Hope that helps.

    Patrick

    Edited by: Branchbird - Pat on 11 October 2012 08:27

Maybe you are looking for

  • STORE. E CANVIO 500 GB: not working + blue light

    Hello I use the HD on my PowerMac for Time Machine. Everything was correct and after 3 days, no answer... My computer does not show me the HD and the HD show a blue led (and no diod white, when it worked fine). What does this blue led? Can I expect a

  • Satellite L300 - 20 d - recovery system disk backup is missing

    I have Norton Protection against viruses and when I backed up my laptop I saved the backup in the D drive which is partition backup drive...I want to factory reset the laptop but I can't do t it says can t find disk backup Is there a CD I can clean t

  • Availability of Vista drivers for Toshiba laptops

    A few months ago, I installed Vista RC1 and it worked well with Vista picking up all the drivers outside the slot for memory card and sound This was not the end of the world. I could just use my camera docking station - although it was not as convini

  • Ah150sa HP Envy: keys HP Envy F

    I'd rather have the default F keys and use "Fn" for the special functions rather than the other way around, as is the default with the laptop I have. If someone knows if it is possible to change them?

  • I can't switch user in Windows 7

    Hello The option for users to switch in Windows 7 is missing or gray. This feature has been removed? How can I get that back? Thank you LD