Check if an item's value is numeric or not

Hello all,
does anybody know if there exists a funtion in PLSQL to check wether a string is numeric or not? How can this get implemented?
regards patrick

Thanks Peter, I was not asumming that null was a number...
A got a little modification to the code, that considers null as number (if you want so, if not... just replace "length(nvl(strTMP, 0))" with length(strTMP) ) and accept the decimals and negatives as numbers...
DECLARE
FUNCTION is_number(str IN VARCHAR2)
RETURN BOOLEAN IS
dummy NUMBER;
strTMP varchar(100);
BEGIN
strTMP := translate(str, '1-.,', '1');
--Validating only digits
for i in 1..length(nvl(strTMP, 0)) loop
dummy := TO_NUMBER(substr(strTMP,i,1));
end loop;
--Enforcing number meaning, here 1.2.3 and -126-3 will not pass
dummy := TO_NUMBER(str);
RETURN TRUE;
EXCEPTION
WHEN VALUE_ERROR
THEN
RETURN FALSE;
END is_number;
BEGIN
IF is_number('a') THEN
dbms_output.put_line('a is a number');
else
dbms_output.put_line('a is not a number');
END IF;
IF is_number('343E3') THEN
dbms_output.put_line('343E3 is a number');
else
dbms_output.put_line('343E3 is not a number');
END IF;
IF is_number(null) THEN
dbms_output.put_line('null is a number');
else
dbms_output.put_line('null is not a number');
END IF;
IF is_number(100) THEN
dbms_output.put_line('100 is a number');
else
dbms_output.put_line('100 is not a number');
END IF;
IF is_number('-1234') THEN
dbms_output.put_line('-1234 is a number');
else
dbms_output.put_line('-1234 is not a number');
END IF;
IF is_number('12.34') THEN
dbms_output.put_line('12.34 is a number');
else
dbms_output.put_line('12.34 is not a number');
END IF;
IF is_number('1.2.3.4') THEN
dbms_output.put_line('1.2.3.4 is a number');
else
dbms_output.put_line('1.2.3.4 is not a number');
END IF;
IF is_number('-12-3.4') THEN
dbms_output.put_line('-12-3.4 is a number');
else
dbms_output.put_line('-12-3.4 is not a number');
END IF;
END;
Just a little bit more work...
Regards,
Mike

Similar Messages

  • How to check value is numeric or not

    hi how to check whether a value is numeric or not.
    example.  data : x type n.
              x = 12345.
    Now how to check whether X contains numeric value or not.

    Hi,
         If your type is 'N' there is no way that 'X' can have any value apart for numberics (i.e. 0 - 9).
    You can also check that as follows.
    Data: num_list(10) type c value '0123456789',
          x type n.
    X = '12345'.
    This is more useful if your X is of type C.
    if X CO num_list.
    Its only numeric
    else.
    its contains non numeric
    endif.
    Regards,
    Sesh

  • How to make a select list to return value to numeric column?

    I do have a select list with static values (STATIC:01;0,02;1,03;2,04;3,05;4,06;5,07;6,08;7,09;8,10;9). The problem is that I am returning a value to a numeric column. Therefore I have set 'Post Calculation Computation' as "to_number(:P73_MRGRATING, 9);" however I am getting ORA-01722: invalid number. How, (or when and where) to properly convert a character from a select list representing a numeric value into column of NUMBER data type?
    Thank you for your time.
    DanieD

    Sergio,
    It is because I am not able convert a value in a page item (:P73_ID) to number. On a page before, I have assigned a value to an application item (APPL_ID). On page 73, I want to assign the value in APPL_ID to the page item P73_ID . The value assigned to APP_ID is numeric. On a page 73 I also have a computation in Page processing section. It is an 'After Submit' processing of a static assignment of application item APPL_ID to page item P73_ID. Unfortunately it does not work. (ORA-01722: invalid number). I have tested this also with a 'Post Calculation Computation' on page item P73_ID (to_number(:P73_ID, 9999999999);) and I am still getting ORA... error. Only way I can make it work is to create a page item P73_ID as a text field, then when I run page 73 and enter a value into P73_ID manually - then it works and I can save the values from the form into database...
    The strange thing is that I am using application item APPL_ID on a couple of pages, in where clauses and it always works, even when I am comparing APPL_ID against a numeric value like select * from a_table where some_number = :APPL_ID, this works. But when I would like to create an entry form and assign application item APPL_ID to the page item P73_ID that is referencing a numeric table column – then I am getting ORA-01722…
    Is there any application (sample application) that is doing this and it works so I can check it and learn how to create this process appropriately?
    Thank you for your time.
    DanielD

  • Could not find selected item matching value "New" warning message in ADF

    Hi,
    I have a selectOneChoice1 for a field which has the following fixed values in it. And while creating it, I selected the 'SelctionRequired' option so that this field will always have a value.
    New
    Pending
    Completed.
    While navigating to this page, I am trying to set the value to 'New' (Retrieved from the DB) in the backing bean. But when the page is rendered, the above field is empty with the above options in the list and jdev has the follwing error message in its log.
    WARNING: Could not find selected item matching value "New" in CoreSelectOneChoice[UIXEditableFacesBeanImpl, id=selectOneChoice1]
    Can any one help me with this issue?
    Thanks,
    Priya

    The value of a list binding is the zero-based integer position in the list that is selected, not the actual underlying value.
    The simplest way to set the value of an attribute is to use an attribute binding (which can be bound to the same attribute as the list binding). When you set the value of an attribute binding, it sets the value as you supply it. Otherwise, you'd need to set the list binding's value to the numerical "slot" number of the one you want to change the value to.

  • To check the Free item check box in PO number

    Hi All,
    In the Purchase Order at line item level we have the check box Free item to make Material qty as 0.
    Here my requirement is, to check the check box automatically when the order is created from ME58 transaction for particular vendor. When i checked the fields its showing UMSON but no where its storing the value in the database.
    Please suggest me any user exit or BADI for checking this check box by defualt. Please let me know if any table which holds this value.
    Thanks in advance..
    Regards,
    Sreekala

    hi,
    you can find the chnages made by selecting the condition type and going for the header menu environment--->Header changes.
    this will show the changes made at the header level.
    Regards,
    velu

  • Main Item net value showing as zero by condition type R100.

    Hi Experts,
    I am configured free goods, maintained condition record for exclusive free goods.
    but in sales order free goods item is not populating and when i see the analysis the requirement 55 not met.
    I removed the requirement 55 and i saved it.
    Still in the sales order the  free goods exclusive item not populating.
    and i find that main Item net value showing as zero by condition type R100.
    Why system showing the main item amount as zero by condition type R100?
    Thanks in advance.

    HI ram reddy
    you have to maintain R100 requirement -55 it should be there
    also Alternative Condition Base value - 28(100% discount)
    check your main pricing procedure having conditon type R100 or not if it is not there then maintain
    conditon record in VBN1 for NA00 check all the setting(calculation rule)
    activate free goods pricing correctly(NA0001)
    save it now try
    Regards,
    Krishna.
    Edited by: kris_hna on Jul 14, 2011 11:13 AM
    Edited by: kris_hna on Jul 14, 2011 11:31 AM

  • Change the Purchase Order : Item - Conditions value

    Hi,
    How to change the Purchase Order : Item - Conditions value.
    In my PO, Item conditions shows the SKTO - Cash Discount value is 0. I want to change the Discount value 10.
    How can i change it??

    Hi,
    Goto the Transaction code MN05 and give the CONDITION TYPE SKTO and change the value
    MN05 is the Transaction code for Purchase order  condition types.
    Please check and revert back if you need more details.
    regards,
    santosh

  • Want  to check whether input field in selection-screen is numeric or not

    i have a select -option in  selection-screen  in which user enters a value.i just want to check if this value is numeric then it should  be 18 positions prefixed with zeroes if numeric like 000000000000400000  and needs to be left justified if not numeric like G0032-BTI.
    i check the fourm also but it didn't helped me.
    i m using the code.
    SELECT-OPTIONS : S_MAT FOR CDHDR-OBJECTID,
    LOOP AT S_MAT.
    if  S_MAT ca sy-abcde  .
      shift s_mat left deleting leading space.
    else.
        SHIFT s_mat RIGHT DELETING TRAILING SPACE.
        TRANSLATE s_mat USING '0'.
    ENDIF.
    endloop.
    can anybody help.
    <REMOVED BY MODERATOR>
    thanks
    Edited by: Alvaro Tejada Galindo on Jan 17, 2008 4:00 PM

    I have a solution for you! Try this code below, just copy/paste "as-it-is".
    TABLES: cdhdr.
    DATA: gv_type TYPE dd01v-datatype.
    SELECT-OPTIONS : s_mat FOR cdhdr-objectid.
    AT SELECTION-SCREEN.
      LOOP AT s_mat.
        CLEAR gv_type.
        IF NOT s_mat-low IS INITIAL.
          CALL FUNCTION 'NUMERIC_CHECK'
            EXPORTING
              string_in = s_mat-low
            IMPORTING
              htype     = gv_type.
          IF gv_type NE 'NUMC'.
            MESSAGE e016 WITH 'Not Numeric'.
          ELSE.
            SHIFT s_mat-low LEFT DELETING LEADING: '0', space.
            CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
              EXPORTING
                input  = s_mat-low
              IMPORTING
                output = s_mat-low.
            MODIFY s_mat TRANSPORTING low.
          ENDIF.
        ENDIF.
        IF NOT s_mat-high IS INITIAL.
          CALL FUNCTION 'NUMERIC_CHECK'
            EXPORTING
              string_in = s_mat-high
            IMPORTING
              htype     = gv_type.
          IF gv_type NE 'NUMC'.
            MESSAGE e016 WITH 'Not Numeric'.
          ELSE.
            SHIFT s_mat-high LEFT DELETING LEADING: '0', space.
            CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
              EXPORTING
                input  = s_mat-high
              IMPORTING
                output = s_mat-high.
            MODIFY s_mat TRANSPORTING high.
          ENDIF.
        ENDIF.
      ENDLOOP.
    I hope this solves your problem.
    Cheers,
    Sougata.

  • MIGO: perform a check of all items on Check or Post

    Hello,
    I need to implement the following requirement:
    - Checking all items at the same time when using MIGO for goods reception (on click of "Check" or "Post");
    For this purpose I need that my implementation (regardless of the technology used), can reach all the items in the same call, since I need to compare fields of different items.
    I read the documentation of MB_MIGO_ITEM_BADI and MB_MIGO_ITEM_BADI - it appears that in none of these the items are available at the same time in any of the methods.
    Can anybody suggest a solution for this requirement?
    Regards,
    Joao

    Hello, Vivek
    My requirement is as follows:
    1 - We are implementing SAP for MILL products in a Cable Industry company;
    2 - We use MIGO for goods reception of reels of cable, the cable being the material that will subject to goods movement;
    3 - Each item is a different reel of cable. For each item, we must enter in the batch configuration the material code and batch of the reel (the reels are also materials). The configuration values are kept by MIGO in the GOITEM structure, on special /SAPMP/ append fields (max 10 characteristics);
    The validation that must be made is this:
    4 - We have to be sure that every batch of cable has a different reel in its configuration data. For that, we need to check all the item lines for the material code/batch entered in the configuration;
    5 - If we find that the same reel (material/batch) has been entered in more than one item's configuration, a message has to be displayed;
    Regards,
    Joao

  • Validation check for an item

    I am not sure about how to use regular expression for a validation check for an Item
    I might need to check for an item for the below format -
    1 , XXX-XXXXX-## ( "3 alphanumeric" , "middle score" , "5 alphanumeric" , "2 digit year" )
    2, XX##-### ("2 alphabets ", "2 digit number", " middle score ",3 digit number

    Lucy,
    Create an item level validation of type regular expression, and use the following for the respective Regular Expression values:
    1) ^[[:alnum:]]{3}-[[:alnum:]]{5}-[[:digit:]]{2}$
    2) ^[[:alpha:]]{2}[[:digit:]]{2}-[[:digit:]]{3}$I'm only very new to regular expressions, so I welcome being corrected if there's a more efficient way of declaring this. But this works.
    Anthony.

  • Cannot secure delete items from trash: 180 items (pictures, files, folders) remain even if I check "remove all items"

    I cannot secure delete items from trash: 180 items (pictures, files, folders) remain even if I check "remove all items".  Macbook Pro, 10.6.8

    Maybe the items are locked.
    Mac OS X 10.6 Help: Shortcuts for working with items in the Finder
    Shortcuts for working with items in the Finder Command (⌘)-Shift-DeleteEmpty the Trash without any warning or when it contains locked filesCommand (⌘)-Shift-Option-Delete
    http://docs.info.apple.com/article.html?path=Mac/10.6/en/cdb_cpmvfky.html

  • Check/Validate Line item Amount against Credit Balance of Customer in FBL5N

    Hi ,
    I need to Check/Validate Line item Amount BSEG -WRBTR (Screen 301, Prg. SAPMF05A ) in F-02 against Credit Balance of Customer in FBL5N.If amount entered in F-02 with posting key 01 and same company code is greater than total credit balance with customer ,then i need to pop up error message.
    I have tried this with GGB0 using my own exit incl & including ZRGGBR000 in neccesay customization.Still not working.
    Pls suggest a solutiion for this
    Regds,
    abhee
    Edited by: abheesawant on Jul 29, 2010 6:59 AM

    HI,
    To trigger user exit form pool (ZRGGBR000) you need to do setting in OB28 and activate it.
    Regards,
    Sri

  • Authorization check on Function module return values

    Hi,
    I have a tricky situation. In our BW implementation, many of the FI infoobjects are authorization relevent. One of the objects is 0COSTCENTER.  A user has been assigned with authorization profile, in which the user is authorised for COST CENTER = A* and #.  All planning templates were working nice.
    We were on SP 12 earlier, now we upgraded to SP 20. Now came a issue, the user gets error that user is not authroised for the data. After our analysis, we found nothing wrong as such, so contacted SAP. They came back with a root cause
    In my planning function, an ABAP function module is used. The function module returns a COSTCENTER value. This return value is then assigned to a variable, this variable is of type 0COSTCENTER.
    SAP said there was a bug in their own design. The bug was, if the cost center value is directly used in planning function for other calculations, it will throw an authorization error.  But, if the COST CENTEr value is given to a variable and that variable is used for other calculations,  it works fine. Thats why it worked for us earlier.
    Now, they have removed that bug, so variables are also checked against authorizations and they said we need to either change the code or give * for the COST CENTER authorization.
    So we have a problem. It is not straight forward to give * for COSTCENTER in FI BW implementation. SAP theory is that they cannot say which value the functional module will return. So they will check against ALL the values for COSTCENTER but not the authorised values.
    Has anyone seen this issue before? is it only specific to planning function or its just ABAP concept? Any suggesations to come out this problem?

    Bindu, thanks,
    The error is coming at the program compile level itself i.e. before executing the planning group itself. As per the F1 help on forumla editor and from their support, the system reads all the reference data,  So when it sees the function module and its export parameter, it captures all the data for COST CENTER as reference data.
    Thus even I am sure that the return value will be always authorized, the reference data is checked for the full authorization. Thus its failing

  • Get previous items unique value in new add item form

    Hi
    I have on list having items related to multiple locations.
    Every location is related to one user.
    When user logs in it filters the list with that users location.
    Now when user click on add new item I want to get the data related to his location using item event listener.
    But in new item form there is no way to get the location of that user in event listener as its new item.
    So I passed the qury string parameter form list and changed the add item form link and form to get the query string paramter as default value in Add new Item form.
    But again when user clicks on save button it redirects to original url without paramter. 
    How to redirect user to url with parameter on click on Save/Cancel.
    Is there any other way to get the previous item unique value in add new item from before executing the event listener?

    Hi,
    According to your post, my understanding is that you wanted to redirect user to url with parameter on click on Save/Cancel.
    You need to modify the onclick event need to as below:
    javascript: {{ddwrt:GenFireServerEvent('__redirect={{Home.aspx?Participant={@Participant}&amp;@Activity={@Activity}}}')}}
    Here is a similar thread for your reference:
    http://social.technet.microsoft.com/Forums/en-US/b506cfe5-650e-4017-b470-9ca0a75cd390/sharepoint-2010-list-how-to-pass-parameters-in-a-url-to-another-page?forum=sharepointcustomizationprevious
    In addition, you can creating an intermediate page which just finds the filed value with a DVWP and then redirect to RedirectURL with the filed value on the Query String.
    For more information, you can refer to:
    Redirect to Another Page from NewForm.aspx with the New Item’s ID
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Could not find selected item matching value "null" in CoreSelectOneRadio

    Hello,
    I get the following error with my selectOneChoice components:
    WARNING Could not find selected item matching value "null" in CoreSelectOneRadio[UIXEditableFacesBeanImpl, id=dyna_2709976_11]
    It seem that the component looks for a selectItem object qith its value set to null, so I tried to add one with a null value to no avail. The error don't cause any problem on the rendered page but it might spam the log when many users will be connected. Anyone every got this error and found a fix to stop it from appearing?
    Regards,
    Simon Lessard

    you said you're using selectOneChoice but the error says radio. Is the information correct?

Maybe you are looking for

  • How can I convert my imovie from ipad to burn dvd on PC

    I have produced a 30 minute video for my son's football team using Imovie on my ipad.  I do not have an apple computer and need to convert the imovie to my PC in order to burn DVD's.  This process seems impossible.  I have read many forums and am try

  • Cant establish secure connection

    when I try to login to my google email, or login to Youtub via Chrome I get this message: SSL connection error Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication cer

  • Trying to install... it says i need to be adobe administrator

    how do i install the photo elements 13 when it tells me i need to be an administrator

  • SAP Standard report for Purchase order Amendments

    Hello MM Gurus,         Kindly let me know whether any standard report available in SAP on Purchase order amendments. Regards Yoga

  • How to clean the screen?

    I wanted to see what you guys(and girls) had to say about cleaning your imac's screen. mine has a couple fingerprints on it and it drives me CRAZY cuz you can see it when the screen is displaying dark colors(like black). i dont think i can just throw