How to test if a character is a number

Hi all.
Anyone got an idea on what is the most efficient way to test if a character is a numeric character (0...9) in pl/sql.
Thanks

SQL> ed
Wrote file afiedt.buf
  1  with t as (select '0' as chr from dual union all
  2             select '3' from dual union all
  3             select 'A' from dual union all
  4             select 'x' from dual union all
  5             select '8' from dual union all
  6             select 'w' from dual)
  7  -- END OF TEST DATA
  8  select chr
  9        ,CASE WHEN regexp_like(chr,'^[0-9]$') THEN 'Number'
10         ELSE 'Not Number'
11         END as test
12* from t
SQL> /
C TEST
0 Number
3 Number
A Not Number
x Not Number
8 Number
w Not Number
6 rows selected.
SQL>

Similar Messages

  • How to test if particular character is empty in a row

    Hi All ,
    Requirement : To split the input file into two files .
    If the length of the row is 93 characters and the condition is If characters from 28 to 32 are empty then create a file with the name PCO1 .txt else create a file with the name PCO2 .txt
    Please let me know how to test in a row if particular character has certain value or from 28 to 32 are empty .
    Thanks for your help

    hi Sharma,
    IF line+27(5) EQ space.
    ==> positions 28-32 have no value (i. e. all characters are spaces)
    ELSE.
    ==> positions 28-32 have some value
    ENDIF.
    some explanation:
    line+27(5) ==> this means: 5 characters after position 27
    hope this helps
    ec

  • How to test if input is in array + number?

    Hi, I have an array, [0, 1, 2], and also a stored number: 5
    If I ask the user to input a number, how do I make the user continue input until the number is either one of the numbers in the array or the stored number?
    I can do this with a while loop, a for loop, and an if, else loop, but it's too complicated:
                   boolean match = false;
                   DONE: while (match != true) {
                        for (int i =0; i < number; i++) {
                             if (userInput == array[i] || userInput == -1) {
                                  match = true;
                                  break DONE;
                             } else {
                                  match = false;
                        System.err.printf("\nERROR: Input not in array or stored number.\n\n");
                        System.out.printf("Input again:\n    ");
                        userInput = input.nextInt();
                   }Is there an easier method? Could someone point me in the right direction? I'm wondering if it might be faster if I create a new array that includes the original array + the stored number, then test to see if the input is simply in this new array.
    Thanks for any help.
    Edited by: fishy on Feb 23, 2009 11:16 AM

    Hello,
    To check the number against the array, you would have to loop through the entire array checking each element for the input value. A for loop should do the trick:
    private static int checkArray(int [] a, int inputNumber)
    for (i = 0; i < a.length; i++) { 
    if (a[i] == inputNumber)
          return 1;
    return 0;
    }Then you can use a do while for the input:
    do {
       System.out.println("Enter a number: ");
       userInput = sc.nextInt;
    } while ( (checkArray(userInput) == 0) & (number != userInput) ); This should ask the user for input as long as the number they enter is not in the array and it's not the stored number.
    Hope this helps,
    ~Vin

  • How to test a simple PL SQL function from another PL SQL script

    Hi,
    I have created a function. Now i need to test that whether it is returning the correct values or not.
    For that, i have written anothe pl sql script and trying to call this function. Im passing all the IN parameters in that function. I assume here that OUT parameters will provide me the result. Im trying to display the OUT parameter one by one to see my result.
    I'm using toad as sql client here connected with oracle.
    pl sql script:-
    DECLARE
    BEGIN
         DBMS_OUTPUT.PUT_LINE('$$$$$$$ VINOD KUMAR NAIR $$$$$$$');
         FETCH_ORDER_PRODUCT_DATA(320171302, 1006, 6999,
    ODNumber OUT VARCHAR2, Line_Number OUT VARCHAR2,
    ServiceID OUT VARCHAR2, BilltoNumber OUT VARCHAR2,
    AnnualPrice OUT NUMBER, CoverageCode OUT VARCHAR2)
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | ODNumber );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | Line_Number );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | ServiceID );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | BilltoNumber );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | AnnualPrice );
    DBMS_OUTPUT.PUT_LINE('HERE IS THE RESULT ' | CoverageCode );
    END;
    Function:-
    Program Name : SPOT_Order_Product_Data_For_CFS.sql
    Description : Function to Validate parameters from CFS
    By : Vinod Kumar
    Date : 08/19/2011
    Modification History
    By When TAR Description
    CREATE OR REPLACE FUNCTION FETCH_ORDER_PRODUCT_DATA(orderNumber IN VARCHAR2, customerNumber IN VARCHAR2,
    productLine IN VARCHAR2, ODNumber OUT VARCHAR2,
    Line_Number OUT VARCHAR2, ServiceID OUT VARCHAR2,
    BilltoNumber OUT VARCHAR2, AnnualPrice OUT NUMBER,
    CoverageCode OUT VARCHAR2)
    RETURN VARCHAR2 IS
    lv_err_msg VARCHAR2(100) := '';
    lv_bucket_id VARCHAR2(14);
    lv_bill_number VARCHAR2(30);
    lv_anual_price NUMBER;
    lv_coverage_code VARCHAR2(8);
    lv_quote_num NUMBER(10) := NULL;
    lv_line_num NUMBER(5) := 0;
    lv_customer_number VARCHAR2(30) := customerNumber;
    lv_product_id VARCHAR2(14) := productLine;
    lv_count_quote NUMBER := 0;
    lv_quote_status VARCHAR2(5);
    lv_quote_version NUMBER(2):=0;
    BEGIN
    IF INSTR(orderNumber, '-') = 0 THEN
    lv_quote_num := orderNumber;
    ELSE
    lv_quote_num := SPT_Delimiter(orderNumber, 1, '-');
    lv_line_num := SPT_Delimiter(orderNumber, 2, '-');
    END IF;
    --Check status of the quote COM, APP
    SELECT COUNT(*) INTO lv_count_quote FROM sot_order_header WHERE ORDER_NUMBER=lv_quote_num
    AND ORDER_STATUS IN ('APP', 'COM') AND CUSTOMER_NUMBER = lv_customer_number;
    IF lv_count_quote = 0 THEN
    lv_err_msg := 'Invalid Order number';
    RETURN lv_err_msg;
    END IF;
    -- Fetch the latest version on SPOT quote
    SELECT MAX(VERSION_NUMBER) INTO lv_quote_version FROM SPT_QUOTE_HEADER WHERE QUOTE_NUMBER = lv_quote_num
    AND CUSTOMER_NUMBER = lv_customer_number;
    -- If quote is valid fetch the data in OUT parameters
    IF lv_line_num = 0 THEN
    BEGIN
    SELECT a.CUSTOMER_BILLTO_NUMBER,
    b.LINE_NUMBER, b.BUCKET_ID,
    b.ANNUAL_REF_RATE_USD, b.COVERAGE_CODE
    INTO lv_bill_number,lv_line_num,lv_bucket_id,lv_anual_price,lv_coverage_code
    FROM SPT_QUOTE_HEADER a, SPT_QUOTE_LINE b
    WHERE a.QUOTE_NUMBER = lv_quote_num
    AND a.CUSTOMER_NUMBER = lv_customer_number
    AND a.VERSION_NUMBER = lv_quote_version
    AND a.QUOTE_NUMBER = b.QUOTE_NUMBER
    AND a.VERSION_NUMBER = b.VERSION_NUMBER
    AND b.PRODUCT_ID = lv_product_id;
    ODNumber := lv_quote_num;
    BilltoNumber := lv_bill_number;
    Line_Number := lv_line_num;
    ServiceID := lv_bucket_id;
    AnnualPrice := lv_anual_price;
    CoverageCode := lv_coverage_code;
    RETURN '';
    EXCEPTION WHEN OTHERS THEN
    lv_err_msg := 'Multiple PIDs existing in the SPOT order, please provide the SPOT order + line number as input data';
    RETURN lv_err_msg;
    END;
    ELSE
    BEGIN
    SELECT a.CUSTOMER_BILLTO_NUMBER,
    b.BUCKET_ID, b.ANNUAL_REF_RATE_USD,
    b.COVERAGE_CODE
    INTO lv_bill_number,lv_bucket_id,lv_anual_price,lv_coverage_code
    FROM SPT_QUOTE_HEADER a, SPT_QUOTE_LINE b
    WHERE a.QUOTE_NUMBER = lv_quote_num
    AND a.CUSTOMER_NUMBER = lv_customer_number
    AND a.VERSION_NUMBER = lv_quote_version
    AND a.QUOTE_NUMBER = b.QUOTE_NUMBER
    AND a.VERSION_NUMBER = b.VERSION_NUMBER
    AND b.PRODUCT_ID = lv_product_id
    AND b.LINE_NUMBER = lv_line_num;
    ODNumber := lv_quote_num;
    BilltoNumber := lv_bill_number;
    Line_Number := lv_line_num;
    ServiceID := lv_bucket_id;
    AnnualPrice := lv_anual_price;
    CoverageCode := lv_coverage_code;
    RETURN '';
    EXCEPTION WHEN OTHERS THEN
              lv_err_msg := 'Multiple SPOT lines exist with same parameter';
              RETURN lv_err_msg;
    END;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    lv_err_msg := '@@@ EXCEPTION THROWN @@@ '|| SUBSTR(SQLERRM,1,120);
    RETURN lv_err_msg ;
    END;
    Don't look at the function, it might have errors but my primary concern is how to test this function. Once I start doing its testing then only i can understand any bugs(if any).
    My pl sql is not so good. Im still learning. I don't understand IN and OUT parameters are.
    I just know that IN parameters r those whick we pass in to the function wen we call it and OUT parameters are those through which we get the result.
    Thanks in advance
    Vinod Kumar Nair

    20100511 wrote:
    I wondered how I could test the output of the function from within TOAD?I usually create the following function in my developer schema:
    create or replace function BoolToChar( b boolean ) return varchar2 is
    begin
      if b then
        return( 'TRUE' );
      else
        return( 'FALSE' );
      end if;
    end;To test a function like yours, the following will do in SQL*Plus/TOAD/etc:
    begin
      DBMS_OUTPUT.put_line(
        BoolToChar( XCCC_PO_APPROVALLIST_S1.does_cpa_exist(1017934)  )
    end;
    I'm probably doing 101 things wrong here, but thought I'd ask anyway and risk being shouted at.Shout at? You reckon? I thought people risked being beaten with a lead pipe, or pelted with beer cans and stale pretzels - which makes being shouted at a really safe and viable alternative. {noformat};-){noformat}

  • How can I increase the character limit of my text messages for Droid Maxx 4.4?

    How can I increase the character limit of my text messages for Droid Maxx 4.4?

    Send as a MMS.

  • How to add a new character set encoding?

    Hello,
    can anybody please explain to me, how to add a new character set encoding to Mac OS Tiger?
    I have two Mac laptops, a new one with Snow Leopard and an older one with Tiger, and on the old one i cannot use or enable anywhere the "Russian (DOS)" character set encoding, which i need to be able to use some old text files.
    On the Snow Leopard, this encoding is present in the list of available encodings of TextWrangler, but not in TIger.
    If i have understood correctly, this is not a problem of TextWrangler, and the same encodings are available systemwide.
    So, the question is: how to add new encodings to Tiger (or to Mac OS in general)?
    Thanks.

    I think possibly that's in the Get Info window of Finder?
    I don't think either that or the input menu have any effect on available encoding choices. Adding languages to system prefs/international/languages can do that, but once you have added Russian there, I don't know of any way to add an additional Russian encoding (there are quite a number of them).

  • How do I delete a character tag so it does not continue to show up in my designer.

    Hello.
    I have deleted a character tag from the catalog but it keeps showing up in the designer and stays associated with any new paragraph tag I try to create. How can I set the character designer to blank?
    Thanks

    >System Preferences>Mission Control>Show Desktop...should be F11:
    If not, change it.

  • How to test the migrated workflows in SharePoint 2013

    Hi, we are migrated the portal from SharePoint (Moss) 2007 to SharePoint 2013 using Doc Ave tool.
    Now my concern is how to test all (OOTB and SharePoint Designer) workflows are working properly in SharePoint 2013.
    How to approach? Any ideas/help will be appreciated.

    Hi Ashok,
    Have the business users that use them or the folks that created them test them in the DEV environment prior to the PRD migration...
    -Ivan

  • How to test domain controller on upgraded Win Server 2008 R2

    The windows team recently upgraded the development environment for the domain controller from 2003 to Windows 2008 R2 and I am to test the Idm functionality on this upgraded version. Our current configuration is that the DC and Idm gateway runs on different machines. To test this new DC, i want to install the idm gateway on that server and run some onboarding and termination test cases just to make sure if the AD connection is working on the upgraded DC. But i am getting ’Input/output error’ when i try to install the service and from the documentation it says 'The most common cause of this is that you do not have rights to work with this service.'. The server admin tried installing the gateway with his id as well and it failed. He tested installing in on the 2003 version of DC and it worked, so its not a matter of permission (i think..)...
    Does anyone have any better idea on how to test an upgrade of a DC from version 2003 to 2008 R2? Any help in this matter is appreciated. We are running Idm 8.1 on a Windows platform and an upgrade to OW 8.1.1. Patch 2 is also in the works..
    Thanks in advance.

    I may have found a workaround. Can you try to change the "compatibility mode" in 2008 R2 to "Windows XP SP3" and see if it will install?
    Admittedly I have not done this myself so I'm not entirely sure where or how it's done, but I have confirmation it resolves the issue from others who have faced it.

  • How to add A Special Character '&' in CGNode.addData()

    Hi,
    I'm using XML class Generator to create a XML file. When I used CGNode.addData and the data contains "&" character, I got the following error:
    oracle.xml.classgen.InvalidContentException: illegal character '&' in CharData
    at oracle.xml.classgen.CGNode.addData(CGNode.java, Compiled code)
    Does anybody know how to insert this special character in XML Class Generator?
    Thank you in advance!
    weiwei

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by weiwei:
    Hi,
    I'm using XML class Generator to create a XML file. When I used CGNode.addData and the data contains "&" character, I got the following error:
    oracle.xml.classgen.InvalidContentException: illegal character '&' in CharData
    at oracle.xml.classgen.CGNode.addData(CGNode.java, Compiled code)
    Does anybody know how to insert this special character in XML Class Generator?
    Thank you in advance!
    weiwei<HR></BLOCKQUOTE>
    I had the same problem here and the only solution I found, was to turn of the validation using the setValidationMode member function of ClassGenerator.
    Regards,
    Reinhard Schuerer

  • How to allow the special character in folder or filename

    when i add the special character "&" in folder or file name it gives following error
    "The file or folder name "P&A" contains invalid characters. Please use a different name. Invalid characters include the following: ~ " # % & * : < > ? / \ { | }. The name cannot begin or end with dot and cannot contains consecutive dots."
    how can i allow these character in folder or file name.
    waiting

    Hello to everybody
    It's ok for the ~ " # % & * : < > ? / \ { | } characters, they cannot be allowed,
    but in a lot of languages there are letters like  è é à ù ò that are accepted for path and/or filename;
    how to allow these characters? Moss indexes them but when doing some searches and clicking on these files, in the new internet explorer windows the file cannot be opened abd examining the url the è é à ù ò are replaced with other character.
    Thanks in advance to everybody
    Regards to all
    Roberto GerlandoGerly

  • How to test the payload in XI

    Hi all,
    could please explain how to test the payload in xi and with steps.
    Thanks in advance,
    Radhika

    Hi Radhika,
    You can test in three ways.
    1.)  In message mapping directly give the relevant data and then execute.  Here you can test whether the mapping is correct or not.
    2.)  In Integrstion Directory after completing and activating  the Configuration,  in tool you can find the Test Configuration tab. There you can give the sender and receiver details along with payload. Here you can test whether the Configuration is correct or not.
    3.)  In RWB in COmponent monitoring.  Select the Integration Engine Monitoring. Here give the sender and receiver details, Interface name, name space, Quality of service.
    Now give user name and pass word.
    Paste the payload from massage mapping and then press test tab.  Here yoyu can directly send the message from XI server to the receiver system.
    Ok,
    Jeevan

  • How to test the rule if multiline container is passing to the task?

    Hi Experts,
                      I am working on leave workflow. I have to get the approvers based on no of days of leave and leave type. I am getting these details in ITEMS_TAB internal table. I am passing this table to a rule. Now my problem is when I tried to simulate the rule I am not getting any input screen to enter the data.
    ITEMS_TAB is an internal table type of   "PTREQ_ITEMS_WF_TAB_FLAT".
    In the rule I have created a container by selecting the radiobutton "ABAP Dict. Data Type" and entered the above reference parameter is it right way?
    Is it possible to test the rule independently if I use multiline container as import parameter in my rule?  If so can anybody please tell me how to test the rule?
    Thank You.
    Srija.

    Hi Pavan,
                     Thank you.
                     To copy the values I am not getting any input screen to input the values. I observed one thing that the type that I am referring in the Rule is a deep structure. Is this is the reason that I am not getting the input screen to enter the values?
    I tested by creating aother rule by taking a field for that rule I am getting the input screen to simulate the Rule.
    Can you please suggest if the rule will not work then what I have to do? without the rule how can I get the agents?
    Thank you.
    Srija

  • How to escape the special character ' (ascii 39) in a select query?

    Hi,
    does anybody know how to escape the special character ' (ascii 39) in a select query?
    I've tried a lot of ways but nothing seems to work, for example I try to get all
    names in table foo where coloumn name contains a '-sign (ascii 39)
    select name from foo where name like '%\'%';
    select name from foo where name like '%{'}%';
    select name from atg_horse where name like '%chr(39)%'
    ... but neither works, I end up with a ORA-01756: quoted string not properly terminated
    I would apriciate any help
    /Carl-Michael

    friends
    thanks for ur time and effort that u gave to reply to my problem.
    But my main problem is that when my application (VC++ 7) fires the following query in the oracle database , it does not return any rows.
    SELECT count(*) FROM ORGANISATION WHERE UPPER(ORGANISATION.ORGANISATIONNAME)
    LIKE N'&#946;%' ORDER BY ORGANISATION.ORGANISATIONNAME
    the above question in the previous thread was just to check on sql plus as it's editor does not support unicode characters.

  • How to test a plug_in without Adobe Reader Integration Key?

    I havge a project to create a plug_in for acrobat reader with Adobe Acrobat 8.1 SDK. I also apply for the Adobe Reader Integration Key, but I have not it by now. But deadline of the project is coming, is there any one who can tell me how to test the plug_in without Adobe Reader Integration Key?
    I also have another question, does the plug_in I make with Adobe Acrobat 8.1 SDK can be compatible for all the version of Acrobat reader, such as 7.0, 8.0 and so on? Thank you.

    You test the plug-in, as well you can, using Acrobat. You also build
    it using the preprocessor options to build a Reader plug-in, so you
    don't accidentally use an API not in Reader.
    If you are saying, is there w way around the Integration key for
    testing in Reader, the answer is no.
    Different Reader keys and tools are needed for each version of Reader.
    You will probably not get a key for an old version of Reader.
    Aandi Inston

Maybe you are looking for

  • Disk Repair and Corrupt Hard Drive

    I just replaced the hard drive on my iMac because the computer kept hanging and occasionally shutting down.  I've run Disk Utility many times over many months on the old hard drive and the message I received is that the hard drive was corrupt and nee

  • 3 Displays to X220

    Hi , someone tell me please, is it possible to connect three displays to X220 with dock-station? Now I have two attached displays.

  • SSN/SIN Field (PERID) on IT0021 - takes duplicate SSN's

    Hello All, We are on ECC 6.0 with country version 10 (US).   For Infotype 0002, personal data  on he SSN field when infotype is saved it always checks if the same number already exists and gives an error message if a user is trying to enter an alread

  • Files End Up In LH Corner

    I have a 2012 MacBook Pro running 10.7.5 OSX and When I drag files from a folder to the desktop they end up in the top lefthand corner, almost out of sight.  A pain in the butt to have to drag back to the desktop proper so I can see them. I know the

  • How can I restore the adress window in my lap top mac 10.6.8?

    How can I restore the url window in my lap top mac 10.6.8? I accidentally clesed it and I do not know how to rrestore it!!!!