Varchar to number returns a ORA-01722-Invalid Number error

I have a script where i am converting a varchar to number to be compared against a number.
(To_Number(p.result_value,'999999.99') < 0 OR p.result_value < 0)
this particular line is causing the error ORA-01722-Invalid Number.
Is there any ideas as to why this happens and how I can resolve?
Thanks in advance!

The result_value column in Pay_Run_Result_Values is a varchar2 field.
So you need to put in some additional logic to make sure that the row is having numbers alone before doing to_number.
Cheers
Ganesh

Similar Messages

  • User Accounts and ORA-01722: invalid number error

    Hello,
    I have been using Express for a month or so now but have very limited knowledge of how it works.
    My Problem:
    I have a listing screen for user records which creates records in table QAS_USERS.
    When I add a record it saves the data OK and put the record in the list.
    When I click on the record in the list it takes me to the edit screen and I can change
    the details and it works OK and all the changes get saved to the database.
    On the data entry screen I have a list of the User Groups so I can select what group
    the user will be in, usual details in username, fullname, email address, password etc..
    I then added a routine to create a USER in the APEX Manage USERs.
    It creates the record in my table QAS_USERS and it creates a APEX User Account with
    the correct details and the record is displayed in the list.
    So far so good.
    Now the errors start:
    1. When I look at the User Account in Administration -> Manage Application Express Users
    most of the details have been added but the User Group does not get allocated.
    2. The record I created in QAS_USERS appears in the list on my listing screen but when
    I click on the Edit Icon on the left of the list I get the following error appear
    when the screen changes to the edit screen:
    ORA-01722: invalid number
    Unable to fetch row error
    QAS_USER Table:
    ID NUMBER
    CREATED_ON DATE
    CREATED_BY VARCHAR2(10)
    CHANGED_ON DATE
    CHANGED_BY VARCHAR2(10)
    ACTIVE VARCHAR2(3)
    USERNAME VARCHAR2(10)
    FULLNAME VARCHAR2(30)
    TEAMLEADER VARCHAR2(3)
    TEAMLEADER_ID NUMBER
    LAB NUMBER
    DIRECTOR VARCHAR2(3)
    ACTION_MANAGER VARCHAR2(3)
    SDM VARCHAR2(3)
    GM VARCHAR2(3)
    EMAIL_ADDRESS VARCHAR2(50)
    PASSWORD VARCHAR2(12)
    SDTL VARCHAR2(3)
    FIRSTNAME VARCHAR2(30)
    LASTNAME VARCHAR2(30)
    GROUP_ID NUMBER
    USER_ID VARCHAR2(20)
    Process Script to create the Express User Account:
    Declare
    group_id NUMBER;
    BEGIN
    group_id := APEX_UTIL.get_group_id (:P15_GROUP_ID);
    APEX_UTIL.CREATE_USER (
    P_USER_NAME => :P15_USERNAME,
    P_FIRST_NAME => :P15_FIRSTNAME,
    P_LAST_NAME => :P15_LASTNAME,
    P_WEB_PASSWORD => :P15_PASSWORD,
    P_EMAIL_ADDRESS => :P15_EMAIL_ADDRESS,
    p_developer_privs => 'ADMIN',
    p_group_ids => group_id);
    END;
    If any one has any ideas I would be very grateful.
    Regards,
    Simon.

    Hi,
    It could be that this is because you are using SYSDATE which contains the time as a fraction rather than TRUNC(SYSDATE) which just contains the current time. It could be that your working_dates_between raises this error.
    However, your formula is far more complicated than it needs to be.
    Firstly, you want to look at the date window ADD_MONTHS(TRUNC(SYSDATE), -6) to TRUNC(SYSDATE). Then you want to look at the portion of the absence that falls in the date window. This is GREATEST(Absence Attendance.Actual Start Date, ADD_MONTHS(TRUNC(SYSDATE), -6)) to LEAST(NVL(Absence Attendance."Actual End Date",TRUNC(SYSDATE)), TRUNC(SYSDATE)). You may need to add 1 to the absence end date because this is the last day of their absence rather than the date they return. It depends how you calculate the days between the start and end
    date of the absence. You can create calculations for the start and end date of the absences within the 6 months time window. Create calculation AbsenceStart as
    GREATEST(Absence Attendance.Actual Start Date, ADD_MONTHS(TRUNC(SYSDATE), -6))
    and AbsenceEnd as
    LEAST(NVL(Absence Attendance."Actual End Date",TRUNC(SYSDATE)), TRUNC(SYSDATE))
    Then you need to only pick up absence that a part of the absence in your 6 month date window. You can use a condition in the workbook or a condition in a case statement to do this. You then need to calculate the difference between these dates and SUM all the values.
    SUM(CASE WHEN AbsenceEnd >= AbsenceStart THEN WORKING_DAYS_BETWEEN(AbsenceStart, AbsenceEnd) END)
    That's it. Not so complicated after all.
    Rod West

  • ORA-01722: invalid number error when trying to pass a list of values

    Gurus
    We are using a function like so
    The usage for the function below is
    Select fn_st_bb_nm_uc (‘1232131312, 123213312’) from dual;
    SQL> /
    Select fn_st_bb_nm_uc ('1232131312, 123213312') from dual
    ERROR at line 1:
    ORA-01722: invalid number
    It’s giving an invalid number error. When we pass one value it is working fine but when we pass a string of values it gives this error. I have opened an SR around this but would greatly appreciate your help
    Acc_blackbar is the table and acc_blkbr_id is of type number.
    FUNCTION fn_st_bb_nm_uc (pBB_ID_LIST VARCHAR2)
    RETURN VARCHAR2 IS
    vspcm_typ_nm_uc VARCHAR2 (2000);
    CURSOR stname
    IS
    SELECT distinct st.spcm_typ_nm_uc
    FROM
    acc_blackbar abb,
    acc_specimen_type ast, acc_procedure apr,
    acc_specimen_part asp,
    specimen_type st, procedure pr,
    proc_proc_family ppf
    WHERE abb.ACC_BLKBR_ID = apr.ACC_BLKBR_ID
    AND apr.ACC_SPCM_PART_ID = asp.ACC_SPCM_PART_ID
    AND asp.ACC_SPCM_TYP_ID = ast.ACC_SPCM_TYP_ID
    AND ast.ACC_SPCM_TYP_SPCM_TYP_ID = st.SPCM_TYP_ID
    AND apr.procdr_id = pr.PROCDR_ID
    AND pr.PROCDR_ID = ppf.PROCDR_ID
    AND abb.acc_blkbr_id in (pBB_ID_LIST) ;
    BEGIN
    DBMS_OUTPUT.PUT_LINE(' BB LIST : ' || pBB_ID_LIST);
    FOR st IN stname
    LOOP
    vspcm_typ_nm_uc := vspcm_typ_nm_uc || ',' || st.spcm_typ_nm_uc;
    END LOOP;
    vspcm_typ_nm_uc := SUBSTR (vspcm_typ_nm_uc, 2);
    RETURN vspcm_typ_nm_uc;
    END;

    This ask tom thread covers multiple solutions:
    [http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425]

  • Classic ASP - "ORA-01722: invalid number" using OraOLEDB.Oracle driver

    I am working on doing some maintenance updates to a Classic ASP website, and I need to be able to run an insert/update statement for putting values into a lookup table. I am currently running into an "ORA-01722: invalid number" error when trying to use ADO and bind variables for my insert statement.
    Below is an example of a table that I am having problems with:
    CREATE TABLE "MATMGR"."TEST_SWING_TABLE"
    (     "TABLE1_ID" NUMBER(4,0) NOT NULL ENABLE,
         "TABLE2_ID" NUMBER(4,0) NOT NULL ENABLE,
         CONSTRAINT "TEST_SWING_TABLE_PK" PRIMARY KEY ("TABLE1_ID", "TABLE2_ID")
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS" ENABLE
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS" ;
    Here is some snippet code of the basic functionality I am trying to get to work:
    ''START CODE''
    Dim connDb, cmdDoseInsert
    Set connDb = Server.CreateObject("ADODB.Connection")
    connDb.CursorLocation = adUseClient ' Setup to return RecordSet
    connDb.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source={host};User ID={user id};Password={password}"
    connDb.Open()
    Set cmdDoseInsert = Server.CreateObject("ADODB.command")
    Set cmdDoseInsert.ActiveConnection = connDb
    cmdDoseInsert.CommandType = adCmdText
    cmdDoseInsert.NamedParameters = true ' Set the command object to use named parameters
    cmdDoseInsert.Prepared = true
    cmdDoseInsert.CommandTimeout = 0
    cmdDoseInsert.CommandText = "INSERT INTO TEST_SWING_TABLE (TABLE1_ID, TABLE2_ID) VALUES (:P_TABLE1_ID, :P_TABLE2_ID)"
    cmdDoseInsert.Prepared = true
    cmdDoseInsert.Parameters.Append cmdDoseInsert.CreateParameter("P_TABLE1_ID", adNumeric, adParamInput)
    cmdDoseInsert.Parameters.Append cmdDoseInsert.CreateParameter("P_TABLE2_ID", adNumeric, adParamInput)
    '... START: While Looping
         cmdDoseInsert.Parameters(0).Value = {some numeric value}
         cmdDoseInsert.Parameters(1).Value = {some numeric value}
         cmdDoseInsert.Execute
    '... END: Looping
    ''END CODE''
    What I have been able to find out so far is that there is some type of issue with numeric values getting translated right when sending two and retrieving from Oracle in ASP. So, does anyone have any thoughts on how to resolve this as I would like to use parameterized SQL to improve application performance?
    I am connecting to a developmental server running Oracle 9.2

    Ok, in my slightly larger example I found out that for what ever reason my named parameters are not being enforced, and so I had to make sure that the parameters were in the same order as they appeared in the SQL. To be on the save side, I did this when they were added as well as when I was assigning values to them.
    Can anyone tell me if this is an Oracle issue or a ASP issue?

  • ORA-01722: invalid number

    Hi,[email protected]
    we are working on Import tool, which takes a CSV file and inserts in Oracle
    DB.I am using PLSQL UTL_File.Please look into the PLSQL file and clarify my
    Queries.
    If the Last column is a Varchar field, we are able to insert Records
    comfortably. but we get the Following Error when the last column in CSV file
    is a Number field.
    Error Generated:
    ORA-01722: invalid number 12242, ,
    Praveen, Reddy, Chitti, Praveen Reddy Chitti, ,700,
    ORA-01722: invalid number 12242, ,
    Abhishek, C, Singh, Abhishek C Singh, ,700,
    ORA-01722: invalid number 12243, , Paul,
    K, Jak, Paul K Jak, ,700,
    15 ORA-01722: invalid number 12242, ,
    Praveen, Reddy, Chitti, Praveen Reddy Chitti, ,700,
    Expecting reply from u in this regard.
    Regards,
    Mahi
    Sample table Structure:
    CREATE TABLE EMPM(
    CMPCD NUMBER (10) NOT NULL,
    LCTCD NUMBER (10),
    EMPCD NUMBER (10) NOT NULL,
    REFNO VARCHAR2 (51),
    USRID NUMBER (10),
    PREFX VARCHAR2 (10),
    FNAME VARCHAR2 (51) NOT NULL,
    MNAME VARCHAR2 (51),
    LNAME VARCHAR2 (51) NOT NULL,
    FULNM VARCHAR2 (201) NOT NULL,
    EMPSX VARCHAR2 (1),
    SSNUM VARCHAR2 (16),
    NTLTY NUMBER (10),
    STSCD NUMBER (10),
    TCODE NUMBER (10),
    JDATE DATE,
    TDATE DATE,
    ACDOB DATE,
    ADATE DATE,
    DSGCD NUMBER (10),
    DPTCD NUMBER (10),
    MGRCD NUMBER (10),
    REFBY NUMBER (10),
    WPHON VARCHAR2 (25),
    MPHON VARCHAR2 (16),
    RPHON VARCHAR2 (16),
    PGRNO VARCHAR2 (16),
    WKFAX VARCHAR2 (16),
    RSFAX VARCHAR2 (16),
    WKEML VARCHAR2 (256),
    PEML1 VARCHAR2 (256),
    PRLN1 VARCHAR2 (256),
    PRLN2 VARCHAR2 (256),
    PRCCD VARCHAR2 (256),
    PRSCD NUMBER (10),
    PRSIN VARCHAR2 (51),
    PRCTR NUMBER (10),
    PRZIP VARCHAR2 (15),
    PMLN1 VARCHAR2 (256),
    PMLN2 VARCHAR2 (256),
    PMCCD VARCHAR2 (256),
    PMSCD NUMBER (10),
    PMSIN VARCHAR2 (51),
    PMCTR NUMBER (10),
    PMZIP VARCHAR2 (15),
    LOADN NUMBER (10),
    RESF1 VARCHAR2 (256),
    RESF2 VARCHAR2 (256),
    RESF3 VARCHAR2 (256),
    RESF4 VARCHAR2 (256),
    RESF5 VARCHAR2 (256),
    OWNER VARCHAR2 (4000),
    NOTES VARCHAR2 (401),
    DFLAG VARCHAR2 (10) DEFAULT '0' NOT NULL,
    MODBY NUMBER (10) NOT NULL,
    MODON DATE NOT NULL,
    PRIMARY KEY("CMPCD", "EMPCD"))

    we get the Following Error when the last column in CSV fileis a Number field.
    Clearly one or more records has a value in the last column that is non-numeric. Broadly speaking, a number consists of characters 0123456789, with optional minus sign and decimal point (scientific notation is also allowed). Just about anything else is not a number. 934-89 is not a number. 786.567.765 is not a number. A NULL should not throw ORA-1722 but spaces will.
    So, check your data. You find it necessary to employ an intermediary table and cleanse the data there. Alternatively, yell at the people who produce the extract. Or change your schema definition. Whatever's right.
    Cheers, APC

  • ORA-01722: invalid number while using TO_CHAR function.

    Hi All,
    I was using this query from around past 1 year and everything was working fine.
    select to_char ( '2012/12/23','YYYY/MM/DD') from dual;
    how ever from monday onwards , this is returning me with the following error.
    ORA-01722: invalid number
    The NLS_DATE_FORMAT is DD-MON-RR in my oracle 11g version.
    Please help me regarding this.

    Your date is in literal & your intended format so no need to format it again.
    select to_char ( '2012/12/23','YYYY/MM/DD') from dual;
    same as
    select '2012/12/23' from dual;I don't know your need so same code to work!!!
    select to_char(to_date('2012/12/23','YYYY/MM/DD'),'DD/MM/YYYY') from dualsunnymoon wrote:
    where vale for ? is coming as '2011/12/23' from java.
    the whole application has to be changed and retested.
    >
    It it comes as a text convert it to date TO_DATE('2011/12/23','YYYY/MM/DD') to use in comparison operators like =, != , > , < etc. Comparison operators used taking date as literal will give you wrong result.
    Better to do it right even it takes huge effort.
    Edited by: Lokanath Giri on ३ जनवरी, २०१२ १२:०६ अपराह्न

  • ORA-01722: invalid number for getting PR information

    This is a query ran on Oracle Purchasing database, I want to select all those purchase requisitions which have accounting segment3 value between 100000 and 199999. The query errors out.
    As in the below query, even though I said "to_number(ccds.segment3) account_seg" in the inner select query but when I give a where condition "account_seg between 150000 and 160000" in the outer query, the sql errors out with "ORA-01722: invalid number" error.
    By commenting out statement "where account_seg between 150000 and 160000", I checked the values returned for segment 3 are all digits and no alphabets.
    Whats can be the issue ?
    ERROR at line 16:
    ORA-01722: invalid number
    select requisition_header_id from
    select
    prls.requisition_header_id requisition_header_id
    ,to_number(ccds.segment3) account_seg
    from
    PO_REQUISITION_headers_all prhs
    ,PO_REQUISITION_LINES_all prls
    ,PO_REQ_DISTRIBUTIONS_ALL prds
    ,gl_code_combinations_kfv ccds
    where
    prhs.requisition_header_id=prls.requisition_header_id
    and prls.requisition_line_id=prds.requisition_line_id
    and prds.code_combination_id=ccds.code_combination_id
    where account_seg between 150000 and 160000

    Hi this error comes because of data problem.
    Some value in segment3 is having alphanumeric data. Check it i am sure about this, i verified!
    Adding more info:
    Some of the alphanumeric data that i found in my database are:
    X00050
    F5000
    Let us replicate your error:
    1. This will run fine:
    SELECT segment3
    FROM gl_code_combinations_kfv
    WHERE segment3 = 'F5000';
    SEGMENT3
    F5000
    But when we say TO_NUMBER of this value, see what happens:
    SELECT TO_NUMBER(segment3)
    FROM gl_code_combinations_kfv
    WHERE segment3 = 'F5000';
    SELECT TO_NUMBER(segment3) FROM gl_code_combinations_kfv WHERE segment3 = 'F5000'
    ERROR at line 1:
    ORA-01722: invalid number
    Error proved!
    Thanks,
    Jithendra
    Error Proof added
    Jithendra

  • TO_NUMBER and ORA-01722 invalid number pls delete

    I cannot see where to delete a post I made. I found out my problem. It was in my NLS settings. Decimals were set to be commas instead of periods.
    please disregard this post, and delete if you are a moderator
    I recently tried to bring in lat/long coordinates from a VARCHAR2 field (and even as a flat file) into a NUMBER field with a setup of NUMBER(20,13) to ensure I'd capture all of the signifigant digits.
    I even ran this through a procedure to check if the data is a number first, and update only. I've found however that I keep getting the ORA-01722 invalid number error.
    So I started testing out some points, and came across this:
    select to_number('-79.662965387') from dual;
    this query results in the invalid number error. I don't want to have to load these as an SDO GEOMETRY object, has anyone encountered this scenario before?
    Or is my choice of 13 decimal places too high for Oracle?

    I just ran that code in my database (10g) and it returned this
    select to_number('-79.662965387') from dual;
    TO_NUMBER('-79.662965387')
                    -79.662965
    1 row selected.Message was edited by:
    Tridith

  • Microsoft Access shows "ORA-01722: Invalid number"

    Hi,
    I have seen a previous post on this problem, but none of the tips applied to my situation, so I'm asking again.
    I'm accesing Oracle 8i Personal (German Version) with Access 2002 (latest SP, on a computer with Windows 2000). Please note that I installed the latest ODBC driver from Oracle (8.1.7.6.0). When I create a table which has, say, a NUMBER(10,3) field in it, and I link it into Access using the ODBC driver, I cannot enter numbers like "1,23" into the table. The error "ORA-01722: Invalid number" is shown and the INSERT fails. If I enter the numbers like "1.23", the resulting field value is "123". The
    problem occurs, whether I use the table view, a form or VBA via ADO. Pass-Through queries (over ADO's QueryDef facility) work, however. The decimal separator is "," in both Windows and Oracle. With normal NUMBER fields everything works fine.
    When looking at the SQL log it turns out, that Access hands out a string to the ODBC driver and relies on the driver to convert it to a number. Regardless of the locale set in Windows, Access uses the dot ('1.23') as decimal separator for this string. The German version of oracle wants a comma as decimal separator as in "INSERT INTO TEST VALUES ('1,23')". From a previous post I know that ODBC specifies that all numbers must use the dot, regardless of the locale setting. So it turns out, the Oracle ODBC driver is causing the problem, not Access. But, anyway, this problem could easily be fixed by adding a "Workaround option" to the ODBC driver, that always converts dots in numbers to commas before handing it out to the backend. Another option would be, that the ODBC driver does this decision automatically by asking the backend, which separator it wants.
    Any comments greatly appreciated.
    Best regards
    Markus

    This is actually a duplicate of bug# 1938991 which says:
    "A 'Numeric settings' option has been added to the Application Options page of the ODBC Configuration screen so that the user can choose what numeric settings will be used in receiving and returning numeric data that is bound as strings. This option allows the user to choose Oracle NLS settings (the default setting and the behavior in former releases), Microsoft default regional settings (to provide a way to mirror the Oracle OLE DB driver's behavior for greater interoperability) and US numeric settings, which are necessary when using MS Access or DAO in non-US environments. In this case, setting the Numeric settings to US settings should resolve the issue, since DAO is expecting the data in US format."
    Apparently the fixed release is 9.2.0.2, 9.0.1.4 or 8.1.7.7 depending on your client version.

  • ORA-20006: ORA-01722: invalid number ORA-06512: at "APPS.WF_NOTIFICATION"

    Hi,
    I am having a wft program, which checks a function activity and depending on the value returned sends difference notifications.
    The package body completed successfully from backend and while running the workflow program it sends a notification also. But while opening the notification it gives the following error,
    ORA-20006: ORA-01722: invalid number ORA-06512: at "APPS.WF_NOTIFICATION", line 5328 ORA-06512: at line 5
    I have 3 procedures in my package body and all the 3 procedures have exceptions defined as follows, if they are using any workflow activities.
    ==========================================================
    EXCEPTION
         WHEN OTHERS THEN
              WF_CORE.context (
              'WFCustCheck',
              'MisCustDataFromTableDoc',
              document_id,
              display_type,
              document,
              document_type,
              SQLERRM
    RAISE_APPLICATION_ERROR (-20006, SQLERRM);
    ==========================================================
    But I am not able to figure out what is causing this error. What does this "line 5328 ORA-06512: at line 5" in the error message indicate?. My package body has only 600 lines. And why is the error message not displaying the procedure name? though I have defined the procedure name in the exception.
    What is the best way to get the procedure name in the error message? So that it becomes easier for identifying which procedure is causing the erro?
    Please let me know.
    Thanks

    Hi,
    Instead of the RAISE_APPLICATION_ERROR command, just replace that with RAISE;
    The error is coming out of the package that is sending the notification (WF_NOTIFICATION), which is invoked when you open the notification. I'm guessing that line 5 is the line in your code though.
    Are you using documents to send the notification, or are they purely defined in the .wft file?
    Matt
    Alpha review chapters from my book "Developing With Oracle Workflow" are available on my website:
    http://www.workflowfaq.com
    http://forum.workflowfaq.com
    NEW! - WorkflowFAQ Blog at http://thoughts.workflowfaq.com

  • OracleDataAdapter ORA-01722: Invalid Number

    I am Using .NET petshop Architecture and in this architecture oraHelper class have following code.
    public static DataTable ExecuteReader(string cmdText)
                   //Create the command and connection
                   OracleCommand cmd = new OracleCommand();
                   OracleConnection conn = new OracleConnection(CONN_STRING_NON_DTC);
                   try
                        PrepareCommand (cmd, conn, null, CommandType.Text ,cmdText ,null);
                   OracleDataAdapter sda = new OracleDataAdapter(cmd) ;
                        DataTable dt = new DataTable() ;
                        sda.Fill (dt);
                        conn.Close ();
                        return dt;
                   catch(Exception e )
                        conn.Close();
                        throw e ;
    I am getting error on FILL method as under
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: Oracle.DataAccess.Client.OracleException: ORA-01722: invalid number.
    Could anyone tell me whats goign wrong.
    Regards
    Uzma

    Complete Exception trace is as under
    Oracle.DataAccess.Client.OracleException ORA-01722: invalid number at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure) at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src) at Oracle.DataAccess.Client.OracleDataReader.Read() at System.Data.Common.DbDataAdapter.FillLoadDataRow(SchemaMapping mapping) at System.Data.Common.DbDataAdapter.FillFromReader(Object data, String srcTable, IDataReader dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDataReader dataReader) at Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataTable dataTable, IDataReader dataReader) at Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) at odptest.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\odptest\webform1.aspx.cs:line 66

  • ORA-01722: Invalid number when implementing the Ruby article sample

    Hi all,
    When I implemented the Ruby on Rails article posted in http://www.oracle.com/technology/pub/articles/haefel-oracle-ruby.html, I found the following problem:
    Everything was fine until I decided to test my application. When my web app tried to access some record of the table, the following error happened:
    OCIError: ORA-01722: invalid number: select * from (select raw_sql_.*, rownum raw_rnum_ from (SELECT * FROM comics WHERE (comics.id = '2.0') ) raw_sql_ where rownum <= 1) where raw_rnum_ > 0
    F:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract_adapter.rb:120:in `log'
    F:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/oracle_adapter.rb:277:in `execute'
    F:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/oracle_adapter.rb:477:in `select'
    F:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/oracle_adapter.rb:268:in `select_all'
    F:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:390:in `find_by_sql'
    F:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:924:in `find_every'
    F:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:918:in `find_initial'
    F:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:952:in `find_one'
    F:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:941:in `find_from_ids'
    F:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb:382:in `find'
    #{RAILS_ROOT}/app/controllers/comics_controller.rb:16:in `show'
    The problem was related with the way RoR is accessing my table. I don't know the reason, but RoR is automatically building the SELECT sentence declaring my 'id' column as VARCHAR, so the sentence includes the expression " comics.id = '2.0' ".
    I would like to hear the advice from more experienced RoR developers in order to solve this little issue... (I believe this is more a RoR problem than an Oracle one, but I didn't find anything useful in Rail forums).
    Thank you very much in advance for your help.
    Gregorio

    Are you saying that if you do not modify the WHERE condition and run the SELECT as-is (as in your original post) in SQL*Plus, you get the same error?
    Can you post a test case? I'm not getting any error in example below.
    SQL> create table comics (id number) ;
    Table created.
    SQL> insert into comics values ('2.0') ;
    1 row created.
    SQL> insert into comics values ('2') ;
    1 row created.
    SQL> insert into comics values (2.0) ;
    1 row created.
    SQL> insert into comics values (2) ;
    1 row created.
    SQL> commit ;
    Commit complete.
    SQL> select * from comics WHERE (comics.id = '2.0') ;
            ID
             2
             2
             2
             2
    4 rows selected.
    SQL> drop table comics ;
    Table dropped.
    SQL> create table comics (id varchar2(10)) ;
    Table created.
    SQL> insert into comics values ('2.0') ;
    1 row created.
    SQL> insert into comics values ('2') ;
    1 row created.
    SQL> insert into comics values (2.0) ;
    1 row created.
    SQL> insert into comics values (2) ;
    1 row created.
    SQL> select * from comics WHERE (comics.id = '2.0') ;
    ID
    2.0
    1 row selected.
    SQL>Message was edited by:
    Kamal Kishore

  • Recieving ORA-01722 invalid number error while creating a materialized view

    Hi,
    I am receiving a ORA-01722 invalid number error while creating a materialized view. when run the select statement of the view i don't get any error, but when i use the same select statement to create a materialized view i receive this error. Could any please help in resolving this error. Here is the code i am using to create a materialized view.
    CREATE MATERIALIZED VIEW MV_EBS_CH_CLOSED
    REFRESH FORCE ON DEMAND
    AS
    SELECT DISTINCT kr.request_id, org.org_unit_name,
    ebs_ch_ticket_type (kr.request_id) ticket_type,
    DECODE
    (kr.status_code,
    'CLOSED_SUCCESS', kr.last_update_date,
    'IN_PROGRESS', (SELECT MAX (start_time)
    FROM ebs_ch_datastore ecd1
    WHERE kr.request_id = ecd1.request_id
    AND workflow_step_name =
    'Final BA Review and Deployment Exit Criteria')
    ) closed_date,
    substr(krhd.visible_parameter12,1,10) siebel_start_date,
    kr.creation_date itg_start_date
    FROM kcrt_requests kr,
    kcrt_request_types krt,
    kcrt_req_header_details krhd, kcrt_request_details krd1,
    (SELECT koum.user_id user_id,
    DECODE (koup.org_unit_name,
    'IT Implementations', 'CHS - Service Management BA',
    koup.org_unit_name
    ) org_unit_name
    FROM krsc_org_unit_members koum, krsc_org_units koup
    WHERE 1 = 1
    AND 'Y' = koup.enabled_flag
    AND koum.org_unit_id = koup.org_unit_id
    AND EXISTS (
    SELECT 'X'
    FROM krsc_org_units kouc
    WHERE koup.org_unit_id = kouc.org_unit_id
    START WITH kouc.parent_org_unit_id =
    ANY (SELECT org_unit_id
    FROM krsc_org_units krsc_org_units1
    WHERE 'Clearinghouse' =
    org_unit_name)
    CONNECT BY kouc.parent_org_unit_id =
    PRIOR kouc.org_unit_id)
    UNION
    SELECT kou.manager_id user_id,
    DECODE
    (kou.org_unit_name,
    'IT Implementations', 'CHS - Service Management BA',
    kou.org_unit_name
    ) org_unit_name
    FROM krsc_org_units kou
    WHERE 'Y' = kou.enabled_flag
    START WITH kou.parent_org_unit_id =
    (SELECT org_unit_id
    FROM krsc_org_units krsc_org_units2
    WHERE 'Clearinghouse' = org_unit_name)
    CONNECT BY kou.parent_org_unit_id = PRIOR kou.org_unit_id) org
    WHERE krt.request_type_id = kr.request_type_id
    AND krt.request_type_name IN ('Bug Fix', 'IT Enhancement')
    and kr.REQUEST_ID = krd1.request_id
    and krd1.batch_number = 1
    AND kr.request_id = krhd.request_id
    AND org.user_id in (krd1.parameter4, krd1.parameter5, krd1.parameter7)
    AND ( 'CLOSED_SUCCESS' = kr.status_code
    OR 'IN_PROGRESS' = kr.status_code
    AND kr.request_id IN (
    SELECT request_id
    FROM (SELECT DISTINCT request_id,
    MAX
    (start_time)
    closed_date
    FROM ebs_ch_datastore
    WHERE 'Final BA Review and Deployment Exit Criteria' =
    workflow_step_name
    GROUP BY request_id))
    Thanks,
    Shaik Mohiuddin

    This error occurs when you try to create a materialized view , but if you run the sql the results are perfectly fine. Well it happend to me also and to fix this I made sure all the coulmns have the same data type which are used in joins or in where clause.
    use
    where
    to_number(col1)=to_number(col2) and to_number(col3)=to_number(col4)
    hope this helps..

  • Error Message - ORA-01722 Invalid Number

    Hello:
    I have the following situation. When I create an organization, a record is inserted into the following table, AGREEMENTS, and populates four fields.
    I have an update form which selects the organization from the AGREEMENTS table so the user can populate the rest of the table. In addition, on this form, there is a drop-down box which allows the user to select the name of a legal document along with the version of the document in which the user needs to select. This select list is created via an LOV joining three tables. The item name for this select list is :P6_DOCUMENT.
    The code for the LOV is:
    SELECT S.DOC_NAME||' - '|| O.VERSION_NO AS DOC, O.ORG_DOC_CURR_KEY
    FROM SUPPORTING_DOCS S,
         ORG_DOC_CURR_VER O,
         AGREEMENTS H
    WHERE
        S.DOC_TYPE = 'HISA'
    AND S.SUPPORTING_DOC_KEY = O.SUPPORTING_DOC_KEY
    AND H.ORG_KEY_LE = O.ORG_KEY
    AND O.ORG_KEY=:P6_ORG_KEY_LEWhen the user completes the form, the SUBMIT process is a PL/SQL block consisting of an UPDATE statement to update the AGREEMENTS table based on the selected organization and an INSERT statement to insert a record into the AGREEMENTS_DOC table to store the value stored in :P7_DOCUMENT.
    Ok, now here is where my problem starts.
    When I first bring up the form and I select the organization I want to update, I click the Search button to find the organization and I receive the following error message: ORA-01722 Invalid Number.
    At this point all I'm doing is a basic search. There is no insert/update or anything going on. I'm not understanding why I would be receiving this error message.
    The search is based on the database column ORG_KEY_LE whose datatype is NUMBER.
    In my application, the item assigned to ORG_KEY_LE is P6_ORG_KEY_LE.
    I have a PL/SQL block process created (On Load-Before Header) in the Page Rendering area of my page definition. The PL/SQL code that is written is:
    BEGIN
    IF :P6_SEARCH_ORG != '0' THEN
    :P6_ORG_KEY_LE := :P6_SEARCH_ORG;
    END IF;
    END;I then have an Item created, :P6_SEARCH_ORG, which is a Select List. In the LOV portion of the page for this item, I have the following:
    select ORG_KEY_LE display_value, ORG_KEY_LE return_value
    from AGREEMENTS
    order by 1The reason for using this table is because this table contains the newly created organization which needs to be updated with the remaining columns of data.
    I then have a Search button in the Button area which has the following settings:
    Button Position: Region Template Position #CHANGE#.
    Condition Type: Value of Item in Express 1 is NULL.
    Expression 1: :P6_ORG_KEY_LE.
    To troubleshoot this problem, I created two pages, one page to do the UPDATE and the second page to do the INSERT.
    The SEARCH functionality in both pages are identical.
    When I run my UPDATE page, which only involves updating the missing fields, the process works. I have my search box, I'm able to search for the organization, make my updates, and I'm good.
    When I run my INSERT page, which involves inserting the record with the assigned document, I receive the error message after I click the SEARCH button. In order to INSERT the record into this table, I first need to SELECT the organization that was UPDATED in the AGREEMENTS table (using the UPDATE page described in above paragraph). When I select the organization, the user can then assign the appropriate legal document to the organization and insert the record into the AGREEMENTS_DOC table.
    Can someone help me with this error message? I'm not sure why I am able to perform my SEARCH on a page with the UPDATE statement, not able to perform the SEARCH on the page with my INSERT statement, and not be able to perform the SEARCH on the page that combines the UPDATE and INSERT statements.
    I did some more troubleshooting and I do believe my SUBMIT process which contains the INSERT statement is the issue. I created a fourth page which doesn't have a SUBMIT process. I brought up the form, searched for my organization and the information for that organization appeared. The problem is definately with my UPDATE/INSERT process.
    The PL/SQL block for the Submit process is the following:
    BEGIN
    update
        MDD.HISA_AGREEMENTS
         set
           LAST_UPDATED_BY=V('APP_USER'),
           APPROVER_SALUTATION=:P6_APPROVER_SALUTATION,
           APPROVER_FIRST_NAME=:P6_APPROVER_FIRST_NAME,
           APPROVER_MIDDLE_INITIAL=:P6_APPROVER_MIDDLE_INITIAL,
           APPROVER_LAST_NAME=:P6_APPROVER_LAST_NAME,
           APPROVER_NAME_SUFFIX=:P6_APPROVER_NAME_SUFFIX,
           APPROVER_EMAIL_ADDR=:P6_APPROVER_EMAIL_ADDR,
           SPONSOR_EMAIL_ADDR=:P6_SPONSOR_EMAIL_ADDR,
           APPROVER_TITLE=:P6_APPROVER_TITLE
    where
          ORG_KEY_LE=:P6_ORG_KEY_LE
    INSERT INTO
        HISA_AGREEMENT_DOCS
          (HISA_AGREEMENT_DOC_KEY,
           ORG_KEY_LE,
           APPLICATION_KEY,
           STATUS,
           STATUS_DATE,
           CREATED_BY,
           ORG_DOC_CURR_KEY)
    VALUES
          (HISA_AGREEMENT_DOC_KEY_SEQ.NEXTVAL,
           :P6_ORG_KEY_LE,
           :P6_APPLICATION_KEY,
           'C',
           SYSDATE,
           V('APP_USER'),
           :P6_DOCUMENT)
    END;There is something wrong with the above statement and I do not understand what it could be. Can someone help?
    Thanks for the help.

    Hi,
    I believe you are on to something.
    The select list for item :P6_DOCUMENT appears when I first bring up the form. When I select my organization and receive the error message, I clicked on the Session in the Developer's bar. The value in item/field :P6_DOCUMENT shows %null%.
    This is the path in which my user would like to accomplish her task:
    1. Select an organization
    2. Display the information for that organization from the AGREEMENTS table
    3. Enter the data for the remaining fields in the AGREEMENTS table
    4. Select the document (:P6_DOCUMENT) from the drop-down.
    5. Click Submit
    6. Update the AGREEMENTS table with data entered in #3.
    7. Insert a record into the AGREEMENTS_DOC table with the selection from #4.
    Somehow I need the :P6_DOCUMENT field not to show the %null% during the SEARCH functionality. I think that is causing the problem.
    How do I fix this?

  • Error Message (ORA-01722: invalid number) when add amount into Number field

    I am using VB.net, trying to insert data into a field called amt with Data Type 'Number'.
    my vb.net code is as follows
    Dim oradb As String = DatabaseConnectionString
    Dim AmountValue As Decimal = 123.45
    'get the connection
    Dim conn As New OracleConnection(oradb)
    'open the database connection
    conn.Open()
    'create oracle command
    Dim cmd As New OracleCommand("INSERT INTO TBL1 (AMT) VALUES (:AMT)", conn)
    cmd.CommandType = CommandType.Text
    cmd.Parameters.Add(":AMT", OracleDbType.Decimal, AmountValue, ParameterDirection.Input)
    'Execute
    cmd.ExecuteNonQuery()
    I got error message "ORA-01722: invalid number". Please help

    Did you also change the below line before inserting Integer 123:
    cmd.Parameters.Add(":AMT", OracleDbType.Decimal, AmountValue, ParameterDirection.Input)
    to
    cmd.Parameters.Add(":AMT", OracleDbType.Integer, AmountValue, ParameterDirection.Input)

Maybe you are looking for

  • High Def HM DVR capacity

    I am a new user.  First STB was 7216 showed a capacity of 40 hours recording only SD.  Called and complained that capacity should be closer to 80 hours.  Agent agreed and reset the box remotely then later changed the STB to 6416.  I lost all recordin

  • Can i merge two Apple ID's?

    can i merge two Apple ID's? I have one with me.com and one neutral one. would love to have just the me.com Apple ID. How do I merge??

  • I have a different iPhone, and now it won't sync with my iTunes.

    I have a different iPhone, and now it won't sync with my iTunes.

  • Application crashes nearing 28 concurrent transactions

    Its been a while folks.... I used to post and answer allot here back in the day when i was coding in CF daily. Here is the problem... more details will follow when I get them. I was tasked by my director to look into a problem for an application on t

  • Recovery options in Mac OS X Lion

    What options are available if your system crashes, and you lose your hard drive? You buy another hard drive, put it in your system and you need to reinstall Mac OS X Lion. Do you have to put Snow Leopard back on, and then update to Lion? Will you be