Function to extract only numeric value

Hi
I have a column which contains alphanumeric number like LAX4308720
Is there any function in oracle so that I could extract only the numeric values like
4308720 from that string..?
Please provide me some solutions
Shelly

You can use translate as demonstrated above.
You just have to make sure you translate out all the characters that you don't want that may appear in the string. e.g. if the only other characters are uppercase A-Z then you can just use:
SQL> ed
Wrote file afiedt.buf
  1* select replace(translate('LAX4308720', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789','??????????????????????????0123456789'),'?') from dual
SQL> /
REPLACE
4308720
SQL>

Similar Messages

  • Function module to validate numeric values

    Hi all.
    Can some one please tell me Is there any Function Module to validate only numeric values?
    Like in year variable, it can never contain alphanumeric values or special symbols?
    Is there any function module to check, wheather the variable contains only numeric values, no alphanumeric value or special symbol?
    If there is no as such function module then what is the alternative approach we can take?
    Plz help me .
    Regards
    Dipankar

    Function Module NUMERIC_CHECK for Editing and checking numeric fields ( i.e. Num validations)
    Check using the Function Module "NUMERIC_CHECK".
    CALL FUNCTION 'NUMERIC_CHECK'
    EXPORTING
    STRING_IN = X
    IMPORTING
    STRING_OUT = X
    HTYPE = H_TYPE.
    if h_type = 'CHAR'.
    WRITE:/ 'Not Numeric'.
    else.
    write:/ 'Numeric'.
    ENDIF.
    REWARDS IF USEFUL
    GAURAV J.
    Edited by: GAURAV on Feb 3, 2008 2:19 PM

  • How to restrict the user to enter only numeric values in a input field

    How to restrict the user to enter only numeric values in a input field.
    For example,
    i have an input field in that i would like to enter
    only numeric values. no special characters,alphabets .
    reply ASAP

    Hi Venuthurupalli,
    As valery has said once you select the value to be of type integer,once you perform an action it will be validated and error message that non numeric characters are there will be shown. If you want to set additional constraints like max value, min value etc you can use simple types for it.
    On the project structure on left hand side under local dictionary ->datatypes->simple types create a simple type of type integer
    The attribute which you are binding to value property ;make its type as simple type which you made
    Hope this helps you
    Regards
    Rohit

  • Output only numeric values

    CREATE TABLE XYZ( A1 VARCHAR2(10));
    Inserting value in table
    SELECT * FROM XYZ;
    A1
    1
    999
    45
    $
    ^
    +
    =
    How get output only numeric values ?

    Hmm..
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for Linux: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Elapsed: 00:00:00.01
    satyaki>
    satyaki>
    satyaki>CREATE TABLE XYZ( A1 VARCHAR2(10));
    Table created.
    Elapsed: 00:00:00.07
    satyaki>
    satyaki>insert into XYZ values('&val');
    Enter value for val: 1
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('1')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: 999
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('999')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: 45
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('45')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: !
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('!')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: @
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('@')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: $
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('$')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: #
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('#')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: ^
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('^')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: &
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('&')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: *
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('*')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: (
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('(')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: )
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values(')')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: -
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('-')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: +
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('+')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>/
    Enter value for val: =
    old   1: insert into XYZ values('&val')
    new   1: insert into XYZ values('=')
    1 row created.
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>commit;
    Commit complete.
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>
    satyaki>select * from XYZ;
    A1
    1
    999
    45
    $
    ^
    A1
    +
    =
    15 rows selected.
    Elapsed: 00:00:00.01
    satyaki>
    satyaki>
    satyaki>
    satyaki>select * from XYZ
      2     where regexp_like(A1,'[[:digit:]]');
    A1
    1
    999
    45
    Elapsed: 00:00:00.00
    satyaki>
    satyaki>Regards.
    Satyaki De.

  • Extracting only Scale value ..how to do this

    Hi,
    How to fetch only scale value from a number value..?
    example from 1000.1212 i have to select 1212 only..
    I want any oracle supplied function to do this..
    i tried substr and instr but i want can we do this a function available in oracle
    Thanks
    asp

    No you have to use the existing sql functions:
    SQL> select to_char(sysdate,'YYYY') from dual;
    TO_C
    2006
    SQL> select to_char(to_date('2003-08-22','YYYY-MM-DD'),'YYYY') from dual;
    TO_C
    2003
    which you can include in your own function:
    create or replace function extract (p_1 in varchar2,p2 in varchar2) return integer is
    begin
      declare v_return varchar2(30);
      begin
        if p_1 = 'YEAR FROM DATE' then
          select to_char(to_date(p2,'YYYY-MM-DD'),'YYYY')
          into v_return
          from dual;
        end if;
        return to_number(v_return);
      end;
    end;
    /SQL> select extract('YEAR FROM DATE','2003-08-22') from dual;
    EXTRACT('YEARFROMDATE','2003-08-22')
    2003

  • SUBSTR function to extract an specific value

    I have data like this in a columnn
    RA&(44)RC&(44)RF&(44)RJ&(44)RN&(44)RU
    RI&(44)RQ&(44)RR&(44)RS
    RQ&(44)RR&(44)RS
    RG&(44)RP
    I want to be able to ectract just the values RA,RC,RF ETC..ETC...
    I try substr does not work:
    SELECT SUBSTR(szcasup_activities,1,2),
          SUBSTR(szcasup_activities,8,9) ,
          SUBSTR(szcasup_activities,15,16)
          FROM szcasup
    {code}
    I also try
    {code}
    SELECT
         REGEXP_REPLACE (szcasup_activities,
                                             '&(44)',
                                             NULL)
                                             FROM szcasup
    {code}
    to eliminate &(44) does not work
    Any ideas?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Not sure how you'd expect your final output, so maybe
    SQL>  with t as (
    select 'RA&(44)RC&(44)RF&(44)RJ&(44)RN&(44)RU' szcasup_activities from dual union all
    select 'RI&(44)RQ&(44)RR&(44)RS' from dual union all
    select 'RQ&(44)RR&(44)RS' from dual union all
    select 'RG&(44)RP' from dual
    select regexp_substr(szcasup_activities,'[[:alpha:]]+',1,1) a1,
           regexp_substr(szcasup_activities,'[[:alpha:]]+',1,2) a2,
           regexp_substr(szcasup_activities,'[[:alpha:]]+',1,3) a3,
           regexp_substr(szcasup_activities,'[[:alpha:]]+',1,4) a4,
           regexp_substr(szcasup_activities,'[[:alpha:]]+',1,5) a5,
           regexp_substr(szcasup_activities,'[[:alpha:]]+',1,6) a6
    from t
    A1  A2  A3  A4  A5  A6
    RA  RC  RF  RJ  RN  RU
    RI  RQ  RR  RS        
    RQ  RR  RS            
    RG  RP                
    4 rows selected.

  • Validation on numerical values in webdynpro

    Hi Friends,
    I am facing one probelem with  validation on numerical values. In my application there is a scenario.. Input fields are  Mibile number  and  email id.
    when i enter the invalid phone  number like : 09988wertyy    it should throw the error like  enter  only numerical values.
    In the same way  i should  validate the email id with format .. like  ratnakar.alwala@ accenture.com. if it is in valid then it should throw the error.
    could  any body  please give me the approach.
    Thanks and Regards
    Ratnakar reddy alwala

    Hi Ratnakar,
    For number validation, what I did was :
    1. Bind a context variable (Say Number) of type String to the input Field
    2. At the time of submission, do the following
    String num=wdContext.xurrentContextElement().getNumber();
    if(num!=null)
      try
            double num=new Double(amnt.trim()).doubleValue();
      catch(NumberFormatException exc)//IF AMOUNT ENTERED IS NOT VALID
       wdComponentAPI.getMessageManager().reportException("Invalid Number",true);
    Regards
    Fahad Hamsa

  • Limiting entry in a JTextField to numeric value and "%" value

    Hi,
    I want to allow the user to enter numeric value and % value
    How can I limit the user to make such a entry in JTextField

    Use the code given below to make your textfield accept only numeric values. You can modify itto include % values too.
    textField.setDocument( new TextFieldVerifier() );     
    class TextFieldVerifier extends PlainDocument {
    public void insertString( int offset, String str, AttributeSet attSet ) throws BadLocationException {           
    boolean valid = false;          
    if ( str == null ) {
    return;
    String old = getText( 0, getLength() );
    /* insert the new string at the given offset, into the old string */     
    String newStr = old.substring( 0, offset ) + str + old.substring( offset );
    try {
    /* check if the new string is a valid integer */
    Integer.parseInt( newStr );               
    valid = true;
    } catch ( NumberFormatException ne ) {          
    /* invalid, if not an integer */
    valid = false;
    Toolkit.getDefaultToolkit().beep();           
    if ( valid ) {
    super.insertString( offset, str, attSet );
    }

  • Need to extract non empty value thru MDX

    Hi All,
    I have a requirement where there are 2 measures A and B.. I need to populate the first non-missing value from a layer from A in to B..
    tried using HEAD function however looks like in ASO MDX member formulas does not support this ..
    Any help would be highly appreciated
    Thnks,

    I believe the issue is that the formula you are using returns a set and you are looking for a value. Therefore, you need to use the Head function with a function that returns a numeric value (ie: Sum, Max, Avg, etc). In instances like this I typically use the Sum function. Depending on your cube and the rest of your formula, you may need to put some additional work into the formula so that the Sum returns just the value you need, but it just requires getting more specific in your arugments.
    The Head formula will bring back the first member or tuples specified, but won't evaluate for non-missing. You may need to also combine the Head forumla with the Filter formula. ex: Sum(Head(Filter([Dimension or Member].SetFunction,[A] <> Missing)),1) You will mostly need to select some other dimension to apply the filter to (like period or scenario). Examples of the SetFunction are Children, Members, Levels(0), etc. If you end up going this route you may want to write out your Sum(Head()) function and and Sum(Filter()) function and validate each independently and then merge. I find this helps when trying to build larger nested functions.
    Hope this helps!
    Jen

  • Plsql query converts numeric value or currency(rupees) to English words

    Hi,
    I Need a plsql procedure/function query that converts numeric value or currency(rupees) to English words.
    Please help .that is very very important and urgent for me.
    Thanks in advance.
    Regards,
    Karthik T

    that is very very important and urgent for me. Then help yourself by looking on all over internet :
    http://www.google.nl/search?hl=nl&q=oracle+numeric+word&meta=
    Or by using the search feature against the forum :
    http://forums.oracle.com/forums/search.jspa?threadID=&q=%2Bnumber+%2Bword&objID=f75&dateRange=all&userID=&numResults=15
    That would be faster.
    Nicolas.

  • Query only non numeric values in a column

    How to query only non numeric values in a cloumn.
    For example:
    Table1 has a column1(col1)
    Values:
    Row Value
    1 27376
    2 47D99
    3 83039
    4 DKFI*
    5 3J6
    Query should retrieve only rows(2,4,5).
    Thanks! for help
    Murali

    Version 2(PL/SQL) above is not clear enough, It can be tuned to the following:
    -- Create a function
    Create or replace function IsVARCHAR(pCol VARCHAR2) return VARCHAR2
    AS
    vNumber NUMBER := 0;
    begin
      vNumber := to_number(pCol);
      RETURN NULL;
    Exception
      When Others Then
        RETURN pCol;
    End;
    -- To See VARCHAR values (alpha-numeric) only!
    SELECT col1 FROM tab1
    WHERE IsVARCHAR(col1) IS NOT NULL;
    -- To See NUMBER values only!
    SELECT col1 FROM tab1
    WHERE IsVARCHAR(col1) IS NULL;Versatility here with PL/SQL, but I personally like SQL versions.
    Thx,
    SriDHAR

  • Function to check whether a value is NUMERIC

    Hi
    I have a requirment, where I need to check for a field whether it contains a valid numeric value or not.
    Could you please suggest a function.
    If I use TO_NUMBER(VAL1) it throws an exception in case of an non_numeric value.
    The requirement is as follows.
    If the field 'val1' contains a numeric value then the function should return the coressponding nueric value. If it is not,then return a boolean value are a return code instead of exception.
    Is there are built in function in ORACLE to acheive the same , please advice.

    Hi,
    The best way to do it is using User Defined Function, i have written a function as per your Requirement...It is give the data if it is numeric else it will return FALSE
    create table Testdata
    as
    select '10' n from dual
    union all
    select 'xx' from dual
    union all
    select '20' from dual
    union all
    select '3YY' from dual;
    CREATE OR REPLACE FUNCTION IsNumeric
    (p_col_value IN VARCHAR2)
    RETURN     VARCHAR2
    AS
    v_val NUMBER;
    BEGIN
    v_val := TO_NUMBER (p_col_value);
    RETURN 'TRUE';
    EXCEPTION
    WHEN VALUE_ERROR THEN
              RETURN 'FALSE';
         WHEN OTHERS THEN
              RETURN 'FALSE';
    END IsNumeric;
    Select Decode(IsNumeric(n),'TRUE',n,'FALSE') from Testdata
    Regards
    kamal

  • Function module to convert character value of month into numeric value?

    Hi Experts,
                     I need to convert a character value of a month in three alphabets to its numeric value.
    e.g. 'jun' should be converted into '06' and 'jan' into '01' using a function module.Can anybody please provide me a similar function module?
    TIA
    Abhishek

    try this code:
    DATA: text(20) TYPE c,
    date TYPE sy-datum.
    text = '06. Jul 06'.
    TRANSLATE text TO UPPER CASE.
    TRANSLATE text USING '. '.
    CONDENSE text NO-GAPS.
    CALL FUNCTION 'CONVERSION_EXIT_SDATE_INPUT'
    EXPORTING
    input = text
    IMPORTING
    output = date.
    WRITE date USING EDIT MASK '__.__.____'.
    Regards,
    Dara.

  • How to 'Only' allow Numeric value in the Edit Box in AcroDialogs

    Hi all,
    I've create an AcroDialog wizard, I need to allow onlu numeric values in the Edit Box. Can someone please help me with this validation?
    Regards,
    Chris

    There isn't a keystroke event for custom JavaScript dialogs, or any proper interactive events for the fields.  You can validate fields when the user presses OK, and you can test fields when the user changes focus by setting the "Action" property for the field.  But the only practical way to restrict user input to numbers is to use George's suggestion.  There is a number property for the fields but it has an undesirable side affect and I never use it.
    Thom Parker
    The source for PDF Scripting Info
    pdfscripting.com
    The Acrobat JavaScript Reference, Use it Early and Often
    http://www.adobe.com/devnet/acrobat/javascript.html
    Then most important JavaScript Development tool in Acrobat
    The Console Window (Video tutorial)
    The Console Window(article)

  • How do I copy/paste full numerical-only account strings into the Projects WebADI template when the account segment fields in the template require use of the dropdown because they're formatted as alpha-numeric values?

    How do I copy/paste full numerical-only account strings into the Projects WebADI template when the account segment fields in the template require use of the dropdown because they're formatted as alpha-numeric values? I'm using the Integrator named "Projects - Transaction Import" and a custom Layout created based on the seeded Layout named "Transaction Import - Accounted". Do I need to somehow change my Layout to make the Document accept numerical values instead of requiring alpha-numeric values? I need to be able to populate the Document with a large amount of transactions and cannot feasibly go through every transaction to add the alpha-valued name of the account segment to every segment that requires it. The segments in particular causing the problem are "Expnd Type" and "Organization Name" which are both alpha-numeric and as such contain the segment number and name; I need to be able to only have to enter the Natural Account Number (6-digit number only) and the Organization Number (5-digit number only).

    How do I copy/paste full numerical-only account strings into the Projects WebADI template when the account segment fields in the template require use of the dropdown because they're formatted as alpha-numeric values? I'm using the Integrator named "Projects - Transaction Import" and a custom Layout created based on the seeded Layout named "Transaction Import - Accounted". Do I need to somehow change my Layout to make the Document accept numerical values instead of requiring alpha-numeric values? I need to be able to populate the Document with a large amount of transactions and cannot feasibly go through every transaction to add the alpha-valued name of the account segment to every segment that requires it. The segments in particular causing the problem are "Expnd Type" and "Organization Name" which are both alpha-numeric and as such contain the segment number and name; I need to be able to only have to enter the Natural Account Number (6-digit number only) and the Organization Number (5-digit number only).

Maybe you are looking for

  • Why can't I access the internet and e-mail on wifi in my house, but, I can if I turn wifi off?

    Why can't I access the internet and e-mail on wifi in my house, but, I can if I turn wifi off?

  • .m4v movies on external drive not showing in my library?

    Some movies held on external drive are not showing in my library. I can open them with iTunes through Finder but they still don't appear in my library. Any ideas why. All my iTunes downloaded movies are there but the .m4v that I have loaded are missi

  • Call a Social application

    Hello, i use a transactiontyp soa ( Sozial application) of sap. After the configuration i want to test about the web interface. But i don' t can create a social application with a service member. So my question is : About which service menu can i cre

  • Help!!!! my iphone wont hold a charge!!??!!

    my iphone 4 s wont hold a charge, battery is always dead. only time it stays charged is if i keep it plugged into a charer, how do i fix my batery drainage?

  • "Water" live wallpaper

    A couple of my friends have Android phones with a live wallpaper called "Water." It's the one that looks like a pond with leaves floating on it, and you can touch the "water" and make it ripple. It is unbelievably cook, and the first time I saw it wa