ORA-01722: invalid number when performing query

Hi,
I am running SQL Developer on a laptop (XP Pro) accessing Oracle Applications
Product Version     11.5.10.2
Platform     IBM SP AIX
OS Version     AIX
Database     9.2.0.7.0
Support ID     14460365
If I run the following query it works fine -
select
mtrh.request_number
,to_number(mtrh.request_number)
from
mtl_txn_request_headers mtrh
where
to_number(mtrh.request_number) = 135060
and mtrh.request_number = '135060' -- works with this line in!!!!
however if I comment out the last line I get
An error was encountered performing the requested operation :
ORA-01722: invalid number
The field request_number is defined as varchar2(30)
It seems that there is something strange about the way it handles to_number in where clauses.
Thanks
Mick Sulley

You have an invalid number in request_number. If you add "and mtrh.request_number = '135060' ", the result set will be reduced to only those rows which have 135060 in the column and the to_number() will work. WIthout that row, it does to_number(request_number) for all rows in order to identify the one you want. When it comes across a request_number column which contains an invalid number it reports an error.
<preach>
If request_number is a number then it should be stored in a number column. If it isn't, don't try an convert it to a number.
</preach>

Similar Messages

  • ORA-01722: invalid number - when last column has numbers that has a decimal seperator

    Below is the sample data -
    FRT,1.64,VAT,23.36
    FRT,1.64,VAT,23.36
    When I try to convert 1.64 to to_number all is good but when I do the same with 23.36 I get the following error
    ORA-29913: error in executing ODCIEXTTABLEFETCH callout
    ORA-01722: invalid number
    ORA-06512: at "SYS.ORACLE_LOADER", line 52
    I tried this query as well
    select to_number(CONSIGNMENT_NET_VALUE) as Col1 from DUMP_EXT
    select to_number(CONSIGNMENT_NET_VALUE,'9999999999D99999','NLS_NUMERIC_CHARACTERS='',.''' ) as Col1 from DUMP_EXT --> 268906.1
    getting the same error - any help greatly appreciated.
    T.
    Srini

    Hi,
    You can check this test case
    SQL> !cat a.txt
    FRT,1.64,VAT,23.36
    FRT,1.64,VAT,56.36
    FRT,1.64,VAT,23.36
    SQL> create table DUMP_EXT
        Charge_ID_FRT VARCHAR2(50),
        Net_Amount_VAT VARCHAR2(50),
        Charge_ID_VAT VARCHAR2(50),
        Consignment_Net_Value VARCHAR2(50)
    ORGANIZATION EXTERNAL
        (TYPE ORACLE_LOADER
        DEFAULT DIRECTORY DATA_DD_DIR
        ACCESS PARAMETERS
            (RECORDS DELIMITED BY '\n'
            SKIP 1
            BADFILE 'bad_%a_%p.bad'
            LOGFILE 'log.log'
            FIELDS TERMINATED BY ','
            MISSING FIELD VALUES ARE NULL
            REJECT ROWS WITH ALL NULL FIELDS
                Charge_ID_FRT CHAR(50),
                Net_Amount_VAT CHAR(50),
                Charge_ID_VAT CHAR(50),
                Consignment_Net_Value CHAR(50)
        LOCATION ('a.txt')
    reject limit 0;
      2    3    4    5    6    7    8    9   10   11   12   13   14   15   16   17   18   19   20   21   22   23   24   25   26   27   28 
    Table created.
    SQL> select charge_id_frt,net_amount_vat,charge_id_vat,consignment_net_value from dump_ext;
    CHARG NET_AMOUNT_VAT                                     CHARG CONSIGNMENT_NET_VALUE
    FRT   1.64                                               VAT   56.36
    FRT   1.64                                               VAT   23.36
    --- Get Error here
    SQL> select to_number(CONSIGNMENT_NET_VALUE,'99D99','NLS_NUMERIC_CHARACTERS='',.''' ) as Col1 from DUMP_EXT
      2  /
    select to_number(CONSIGNMENT_NET_VALUE,'99D99','NLS_NUMERIC_CHARACTERS='',.''' ) as Col1 from DUMP_EXT
    ERROR at line 1:
    ORA-29913: error in executing ODCIEXTTABLEFETCH callout
    ORA-01722: invalid number
    -- Check the Variable at DB level
    SQL>   SELECT value   FROM NLS_DATABASE_PARAMETERS  WHERE parameter='NLS_NUMERIC_CHARACTERS';
    VALUE
    -- Use the Query like
    SQL> select to_number(CONSIGNMENT_NET_VALUE,'99D99','NLS_NUMERIC_CHARACTERS=''.,''' ) as Col1 from DUMP_EXT;
          COL1
         56.36
         23.36
    HTH

  • ORA-01722: Invalid number when importing .csv file

    Hi,
    I did not find any information regarding my specific problem until now.
    I try to import a *.csv file containing id, double, double, double, double, double (e.g. as a sample line "id_1, 674,6703459157907, 4212,205538937771, 674,6703459158016, 5561,546230769363, 2714,6367797576822") into a table with the following definition:
    CREATE TABLE "foo"."BUILDING_SURFACES"
    (     "ID" VARCHAR2(40 BYTE),
         "AREA1" BINARY_DOUBLE DEFAULT 0,
         "AREA2" BINARY_DOUBLE DEFAULT 0,
         "AREA3" BINARY_DOUBLE DEFAULT 0,
         "AREA4" BINARY_DOUBLE DEFAULT 0,
         "AREA5" BINARY_DOUBLE DEFAULT 0
    ) SEGMENT CREATION IMMEDIATE
    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 FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
    TABLESPACE "USERS" ;
    I am doing it with the help of the importer tool in the SQLDeveloper, by doing a right-click onto the table and selecting import data. In the assistant everything seem to be fine, even the data preview.
    But when I try to import, I get an error: "ORA-01722: Invalid number" and a couple of failure windows appear. These windows display a NullPointerException:
    java.lang.NullPointerException
         at oracle.dbtools.raptor.data.writers.DataTypeFormatterRegistry.getFormattor(DataTypeFormatterRegistry.java:42)
         at oracle.dbtools.raptor.data.writers.ImportGenerator.getBatchForInsert(ImportGenerator.java:1837)
         at oracle.dbtools.raptor.data.writers.ImportGenerator.access$1800(ImportGenerator.java:84)
         at oracle.dbtools.raptor.data.writers.ImportGenerator$1.afterLoopProcessing(ImportGenerator.java:1125)
         at oracle.dbtools.raptor.newscriptrunner.ScriptExecutorTask.loopThroughAllStatements(ScriptExecutorTask.java:220)
         at oracle.dbtools.raptor.newscriptrunner.ScriptExecutorTask.doWork(ScriptExecutorTask.java:165)
         at oracle.dbtools.raptor.data.writers.ImportGenerator$1.doWork(ImportGenerator.java:782)
    If I cancel the task, the insert statements are displayed:
    SET DEFINE OFF
    --Einfügen für Zeilen  1  bis  2  nicht erfolgreich
    --ORA-01722: Ungültige Zahl
    --Zeile 1
    INSERT INTO BUILDING_SURFACES (ID, AREA1, AREA2, AREA3, AREA4, AREA5) VALUES ('BLDG_0003000b002ea10f','674.6703459157907','4212.205538937771','674.6703459158016','5561.546230769363','2714.6367797576822');
    --Zeile 2
    As one can see, the numbers are quoted ('). If I delete the quotes by hand, the insert statement works correctly.
    What can I do, so that the import tool does not quote the numbers?
    Deleting the quotes with the help of a regular expression is not workaround, since a lot of error windows appear, which needs to be closed by hand...
    Thanks in advance,
    Richard
    Some infos about my machine:
    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 12.10
    Release: 12.10
    Codename: quantal
    $ java -version
    java version "1.6.0_38"
    Java(TM) SE Runtime Environment (build 1.6.0_38-b05)
    Java HotSpot(TM) 64-Bit Server VM (build 20.13-b02, mixed mode)
    Oracle SQL Developer 3.2.20.09
    Version 3.2.20.09
    Build MAIN-09.87
    Copyright © 2005, 2012 Oracle. All Rights Reserved. Alle Rechte vorbehalten.
    IDE Version: 11.1.1.4.37.59.48
    Product ID: oracle.sqldeveloper
    Product Version: 11.2.0.09.87

    I solved my problem. :)
    I changed the datatype of the area fields to "NUMBER" and edited my input file in a way, that it is tab separated with "," as decimal sign.
    Richard

  • ORA-01722: invalid number when updating a CMP bean, SP10 WebLogic_RDBMS.jar problem?

    Hi guys
    We are having a problem with the migration to WLCS 3.2 SP2 / WLS 5.1 SP10.
    We are moving from WLCS 3.2 and WLS SP6. Our CMP beans generate errors when
    the container tries to update them. They deploy without error though.
    See below for the stack trace
    We use the recommended weblogic driver for our Oracle 8.1.7.0 database. WL
    runs on w2k, and Oracle on Solaris 7.
    Extract from set-environment:
    SET DB_CLASSPATH=
    SET PATH=%PATH%;%WEBLOGIC_HOME%\bin\oci815_8;%WLCS_ORACLE_HOME%\bin
    SET
    SQLPATH=C:\WebLogicCommerceServer3.2\db\oracle816;C:\WebLogicCommerceServer3
    .2\db\oracle816\event;
    Extract from weblogic.properties:
    weblogic.jdbc.connectionPool.commercePool=\
    url=jdbc:weblogic:oracle,\
    driver=weblogic.jdbc.oci.Driver,\
    I made a few experiments, and I noticed that generating the CMP classes
    (with EJBC) with the old WebLogic_RDBMS.jar (from WLS SP6) is working fine.
    Here is what I mean : ejbc uses the library
    c:\weblogic\lib\persistence\WebLogic_RDBMS.jar And this library has changed
    with SP10. However since that change and after rebuilding our jars, all CMP
    entity beans fail to update.
    If I just replace that WebLogic_RDBMS.jar with the previous one (from SP6),
    and without changing anything else, our CMP beans work fine. I did not
    change any driver or xml deployment descriptor.
    One of the generated files in the jar (for our bean
    VisibilityPSWebLogic_CMP_RDBMS.class) differs, and that seems to be the
    cause of the problem.
    I jadded that class and here is a difference I notice:
    OLD, ejbc ran with SP6 WebLogic_RDBMS.jar : visibilitybean.targetCompanyId =
    (BigDecimal)resultset.getObject(5);
    NEW, ejbc ran with SP10 WebLogic_RDBMS.jar : visibilitybean.targetCompanyId
    = resultset.getBigDecimal(5, 35);
    Similar differences for the SETbigdecimal.
    Dunno if that will help, but I'm attaching the 2 jar files with explicit
    names.
    Damn that was long, I hope someone will read it... Thanks for any help on
    this, see stack trace attached below
    Nicolas Lejeune
    Stack trace:
    mer. oct. 03 12:16:22 CEST 2001:<I> <EJB JAR deployment
    C:/WebLogicCommerceServer3.2/lib/foundation.jar> Exception in
    non-transactional EJB invoke:
    java.rmi.UnexpectedException: Unexpected exception in
    com.b2boost.visibility.VisibilityBean.getVisibilityId():
    java.sql.SQLException: ORA-01722: invalid number
    at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
    at weblogic.jdbcbase.oci.Statement.executeUpdate(Statement.java:980)
    at
    weblogic.jdbc20.pool.PreparedStatement.executeUpdate(PreparedStatement.java:
    47)
    at
    com.b2boost.visibility.VisibilityPSWebLogic_CMP_RDBMS.update(VisibilityPSWeb
    Logic_CMP_RDBMS.java:446)
    at
    com.b2boost.visibility.VisibilityPSWebLogic_CMP_RDBMS.store(VisibilityPSWebL
    ogic_CMP_RDBMS.java:376)
    at
    weblogic.ejb.internal.EntityEJBContext.store(EntityEJBContext.java:192)
    at
    weblogic.ejb.internal.EntityEJBContext.beforeCompletion(EntityEJBContext.jav
    a:227)
    at
    weblogic.ejb.internal.StatefulEJBObject.postInvokeNoTx(StatefulEJBObject.jav
    a:355)
    at
    weblogic.ejb.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:865)
    at
    com.b2boost.visibility.VisibilityBeanEOImpl.getVisibilityId(VisibilityBeanEO
    Impl.java:198)
    at
    com.b2boost.visibility.pipeline.LoadFirstVisibilityRequestPC.process(LoadFir
    stVisibilityRequestPC.java:83)
    at
    com.beasys.commerce.foundation.pipeline.PipelineExecutorImpl.process(Pipelin
    eExecutorImpl.java:193)
    at
    com.beasys.commerce.foundation.pipeline.PipelineExecutorImplEOImpl.process(P
    ipelineExecutorImplEOImpl.java:56)
    at
    com.beasys.commerce.foundation.pipeline.PipelineExecutorImplEOImpl_ServiceSt
    ub.process(PipelineExecutorImplEOImpl_ServiceStub.java:154)
    at
    com.beasys.commerce.webflow.PipelineProcessor.callPipeline(PipelineProcessor
    .java:170)
    at
    com.beasys.commerce.webflow.PipelineProcessor.process(PipelineProcessor.java
    :102)
    at
    com.beasys.commerce.webflow.WebflowAdvisor.handleTarget(WebflowAdvisor.java:
    409)
    at
    com.beasys.commerce.webflow.WebflowAdvisor.processTarget(WebflowAdvisor.java
    :156)
    at
    com.b2boost.framework.B2boostPortalDestinationDeterminer.determineDestinatio
    n(B2boostPortalDestinationDeterminer.java:208)
    at
    com.beasys.commerce.foundation.flow.FlowManager.service(FlowManager.java:438
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :120)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java:922)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java:886)
    at
    weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
    Manager.java:269)
    at
    weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:392)
    at
    weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:274)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:129)
    [Visibility_generated_with_SP6_weblogic_rdbms_jar.jar]
    [Visibility_generated_with_SP10_weblogic_rdbms_jar.jar]

    You are using WebLogic jDriver for Oracle which needs exact version of OCI API, that comes with the Oracle client installation. Ensure that you have installed the right Oracle client version. And updated the PATH properly.
    I notice that you have
    bin/oci815_8
    oracle816
    Thsi looks liek the inconsistency in your environment.
    What you need to do is
    1. find oci817_8 and place that in the PATH.
    2. install oracle 817 and use that client and set the ORACLE_HOME environment variable and the PATH properly.
    Try this and see if it helps.
    BTW - WLS 5.1 is EOL

  • 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

  • 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)

  • Encountered ORA-01722 Invalid number when query doc from  view

    Hi all,
    I have the following view.
    Select item, to_number(wo) a
    from tablea
    union all
    select item, wo
    from tablebb
    The problem rise ( ORA-01722) when I try to search for wo from the view after the view has been created. The wo field in tablea was varchar2 where user will key in the number only. And wo in tabebb is number, I can't change the column format as it is belong the my standard application table. How to solve this problem ?
    Thanks
    Lim

    sm**** wrote:
    I try to simplified my query. In fact, there are several where clause for both tables. The reason is because of the varchar2 field in WO at tablea versus the numeric field in WO for tableb. OK. The problem then is almost certainly that you have non-numeric characters in the column but you don't happen to have non-numeric characters in the columns that match all the other predicates.
    Oracle is free to apply the TO_NUMBER function before it applies some or all of the predicates you specify in your WHERE clause. If it happens to apply the TO_NUMBER on a row that has non-numeric data before it applies the condition in the WHERE clause that filters out that particular row, you'll get an error. If, on the other hand, Oracle happens to filter out the row before applying the TO_NUMBER, you'll get the results you expect. It all comes down to which plan Oracle picks. But, in general, there is no guarantee about whether you'll get an error or whether you'll get the data you want.
    You can define your own function
    CREATE OR REPLACE FUNCTION my_to_number( p_str IN VARCHAR2 )
      RETURN number
    IS
      l_num NUMBER;
    BEGIN
      l_num := to_number( p_str );
      RETURN l_num;
    EXCEPTION
      WHEN others THEN
        RETURN null;
    END;and use that instead of to_number in your query. That will catch the exception if the function is applied to a row before one of the predicates is applied.
    Justin

  • Error: ORA-01722: invalid number performing List of Values query.

    when i created a cascading select list, For the first time it worked properly then little later
    it is giving this error.
    Error: ORA-01722: invalid number performing List of Values query: "select distinct cl_name d, cl_no r from Kclient where gr_no = :P1_GRNO order by 1
    could any one please solve the problem?
    2. when i run the application. in all the items edit button is automatically seen
    including in the login screen.
    could any one identify what is the error and give me a solution.

    Is this better?
    select DISTINCT FIRST_NAME||' '||LAST_NAME display_value
          , ROW_ID return_value
      from "PSA_RESOURCE_MANAGER"
    where PSA_RESOURCE_MANAGER.ACTIVE_FLAG='Y'
       AND :P117_REPORTING_MANAGER = PSA_RESOURCE_MANAGER.REPORTING_MANAGER
       AND :P117_REPORTING_MANAGER <> -1 order by 1or
    select DISTINCT FIRST_NAME||' '||LAST_NAME display_value
          , ROW_ID return_value
      from "PSA_RESOURCE_MANAGER"
    where PSA_RESOURCE_MANAGER.ACTIVE_FLAG='Y'
       AND :P117_REPORTING_MANAGER = PSA_RESOURCE_MANAGER.REPORTING_MANAGER
       AND :P117_REPORTING_MANAGER != '-1' order by 1Is ROW_ID a column in your table by the way? If not, you should use ROWID (without the underscore)

  • ORA-01722: invalid number performing List of Values query

    I have a situation here where I want to pass string value(available in search field) to POP up key LOV on another page as default value.
    I passed item value in default field in POPup key LOV item.I am able to see string value but It also gave me following error.
    Error: ORA-01722: invalid number performing List of Values query: "select CUSTOMER_NAME, CUSTOMER_ID from (select customer_name, customer_id from hed_customers) wwvlovinlineviewname where CUSTOMER_ID = :WWV_LOV_RETURN_KEY_UTIL_1111".
    Without Default value, it work like champ.
    Please suggest how to get rid of this error
    Thanks in advance

    I hit the same problem.
    The thing is that, in APEX, a 'null' value in a form is not really null but gets passed on as '%'.
    When that gets compared to a number, 01722 will occur.
    A workaround is to define a 'value if null' that is an implicit number, like '-1'.
    And lets hope no one ever uses that as a real ID...
    Cheers
    Peter

  • Query gives me ORA-01722 invalid number

    I'm on Release 12 and when I run this query I get ORA-01722 invalid number:
    select api.invoice_num,
    to_char(api.invoice_date,'MM/DD/YYYY'),
    to_char(api.terms_date,'MM/DD/YYYY'), to_char(glh.posted_date,'MM/DD/YYYY'),
    NVL(glj.entered_dr,0)-NVL(glj.entered_cr,0) expense,
    cc.segment1 BFY, cc.segment2 FUND,cc.segment3 ORG, cc.segment4 PROG, cc.segment5 BOC,
    cc.segment6 GL_ACCT, cc.segment7 ACT, cc.segment8 PROJ,glj.period_name
    from gl.gl_je_headers glh, gl.gl_je_lines glj, ap.ap_invoices_all api, gl.gl_code_combinations cc
    where glj.code_combination_id = cc.code_combination_id
    and glh.je_header_id = glj.je_header_id
    and api.invoice_id(+) = glj.reference_2
    and cc.segment6 = '9235423';
    But when I comment out the api.invoice_num it runs fine:
    select --api.invoice_num,
    to_char(api.invoice_date,'MM/DD/YYYY'),
    to_char(api.terms_date,'MM/DD/YYYY'), to_char(glh.posted_date,'MM/DD/YYYY'),
    NVL(glj.entered_dr,0)-NVL(glj.entered_cr,0) expense,
    cc.segment1 BFY, cc.segment2 FUND,cc.segment3 ORG, cc.segment4 PROG, cc.segment5 BOC,
    cc.segment6 GL_ACCT, cc.segment7 ACT, cc.segment8 PROJ,glj.period_name
    from gl.gl_je_headers glh, gl.gl_je_lines glj, ap.ap_invoices_all api, gl.gl_code_combinations cc
    where glj.code_combination_id = cc.code_combination_id
    and glh.je_header_id = glj.je_header_id
    and api.invoice_id(+) = glj.reference_2
    and cc.segment6 = '610001';
    I don't get it because ap.invoice_num is a character field, so why would it be checking to see if it's a number? What could be the problem?

    Welcome to the forums !
    Pl post details of database version, along with an explain plan for this statement (with and without the first field being selected)
    Master Note: Recommended Method for Obtaining a Formatted Explain Plan (Doc ID 235530.1)
    https://supporthtml.oracle.com/ep/faces/secure/km/DocumentDisplay.jspx?id=235530.1&h=Y
    HTH
    Srini

  • 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]

  • 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?

  • ORA-01722: invalid number error - column data type is date

    Hi all,
    When I perform this statement everything is ok, but some of clientbirthday values are null:
    select d.id, d.name, d.contragenttypeid, d.reestrtypeid, d.clientbirthday
    from creator.contragent d
    where d.contragenttypeid = 3
      and d.reestrtypeid in (2,4) When I'm trying to get "d.clientbirthday is not null" I receive error:
    select d.id, d.name, d.contragenttypeid, d.reestrtypeid, d.clientbirthday
    from creator.contragent d
    where d.contragenttypeid = 3
      and d.reestrtypeid in (2,4)
      and d.clientbirthday is not null ORA-01722: invalid number
    What is wrong? Why does it say "number" when clientbirthday column datatype is date ?

    Can you make a desc creator.contragent

  • ORA-01722: invalid number - Error during implicit conversion (10g vls 11g)

    I am facing oracle error for few SELECT queries in 11g which were working fine in 10g environment.
    Oracle Version:
    10g - 10.2.0.5.0
    11g - 11.2.0.3.0
    We are storing numeric values under CHAR or VARCHAR2 column in few tables. This is known design issue & it can't be changed for now.
    I know this will work fine until all the data is numeric in those columns for respective table. Because by some reason, if any row got character value for that column then implicit string to number conversion will fail and this error can occur. But I have verified that there is no data issue.
    But I can see difference in the execution plan! But not able to recognize the reason issue.
    Any other pointers on why the queries are failing in 11g would be of great help..
    Example SQL:
    Note that table structure and data is same in both the environments.
    View Definition -
    CREATE OR REPLACE FORCE VIEW CIMSOS.LC_LOCATIONS
    (   COUNTRY_ID,    PRODUCTID,
       LANGUAGE_ID,   LOCATION_NAME,
       LOCATION_SHORT_NAME,   TAG_ID,   LOCATION_DEFINITION,
       COMPOSITEKEY,   GLOBAL_LOCATION_KEY,
       CPRODUCTKEYID,   CMODVERSION)
    AS
       SELECT
              CCOUNTRY_ID AS COUNTRY_ID,
              CPRODUCTID AS PRODUCTID,
              CLANGUAGE_CODE AS LANGUAGE_ID,
              CLOCATION_NAME AS LOCATION_NAME,
              CLOCATION_SHORT_NAME AS LOCATION_SHORT_NAME,
              CTAG_ID AS TAG_ID,
              CLOCATION_DEFINITION AS LOCATION_DEFINITION,
              CCOMPOSITEKEY AS COMPOSITEKEY,
              CGLOBAL_LOCATION_KEY0 AS GLOBAL_LOCATION_KEY,
              cproductkeyid,
              cmodversion
         FROM mct_35193, goldencopy
        WHERE     cproductkeyid = productkey
              AND cmodversion = version
              AND catalogid = 35193;Facing issue for SQL query based on above view:
    ** In 10g Env
    SELECT * FROM LC_LOCATIONS WHERE productid = 75;
    -- It executes successfully and provide required results.
    Explain Plan:
    SELECT STATEMENT  ALL_ROWSCost: 12  Bytes: 416  Cardinality: 4                 
         4 NESTED LOOPS  Cost: 12  Bytes: 416  Cardinality: 4            
              1 INDEX RANGE SCAN INDEX CIMSOS.GOLDENCOPY_INDX1 Cost: 10  Bytes: 30,225  Cardinality: 2,015       
              3 TABLE ACCESS BY INDEX ROWID TABLE CIMSOS.MCT_35193 Cost: 1  Bytes: 89  Cardinality: 1       
                   2 INDEX UNIQUE SCAN INDEX (UNIQUE) CIMSOS.XPK_MCT_34342 Cost: 0  Cardinality: 1  ** In 11g Env
    SELECT * FROM LC_LOCATIONS WHERE productid = 75;
    ORA-01722: invalid number
    Explain Plan:
    SELECT STATEMENT  ALL_ROWSCost: 40  Bytes: 8,692  Cardinality: 82            
         3 NESTED LOOPS  Cost: 40  Bytes: 8,692  Cardinality: 82       
              1 TABLE ACCESS FULL TABLE CIMSOS.MCT_35193 Cost: 22  Bytes: 819  Cardinality: 9 
              2 INDEX RANGE SCAN INDEX CIMSOS.GOLDENCOPY_INDX1 Cost: 2  Bytes: 135  Cardinality: 9 
    -- Executes when value is passed as character.
    SELECT * FROM LC_LOCATIONS WHERE productid = '75';

    The problem doesn't appear to be related to the Oracle version, at least not directly. If your query plan does the string to number conversion before eliminating the rows that have non-numeric data, you'll get an error. If the query plan eliminates the rows that have non-numeric data before doing the conversion, the query will succeed. It is entirely possible that you'd get the "bad" plan in 10g or the "good" plan in 11g.
    You can capture the query plans from your 10g database and move them over to the 11g database. Oracle has a nice white paper on upgrading from 10g to 11g that walks you through that process.
    Of course, you really don't want to be dependent on the optimizer picking the "right" plan, you really want to fix the underlying data model issue.
    Justin

  • 'ORA-01722: Invalid number' error message in BeX

    Hi Gurus,
    We have a new report built on top of a DSO. When I run this report, I get the message  'ORA-01722: invalid number'. On furthur testing, I found that when I move two objects 'Date Changed' & 'Time Changed' [both are 'Z' objects we created] from the 'Rows' to 'Free Characteristics', the report runs as expected. So the issue seems that it is with these two objects. One of them is of type 'DATS' & the other of type 'TIMS'. These two are mapped to respective 'Date' & 'Time' fields in SAP R3.
    SID's exists in the Master Data tables for both these objects. The data for both the fields contains the normal 'Date' & 'Time' values.Running the query using RSRT shows the same error message. The RSRV check on this report says that 'Query execution not possible as the variables contain invalid values'.
    I have seen a couple of other posts in SDN with similar issues but none of them have a solution identified so far. Just wanted to check if anyone who has experienced this issue have been successfully able to resolve it?
    Thanks
    Arvind

    Hi Ravi,
    Thanks for your prompt reply. Yes, the 'Date' & 'Time' objects have 0DATE & 0TIME as reference objects.
    I couldn't find any invalid vallues for these date and time fields. If invalid values were present, wouldn't the DSO activation have failed?
    Thanks
    Arvind.

Maybe you are looking for

  • More than one iPod with iTunes

    I have an iPod classic for my car, I'm thinking of getting an iPod shuffle for when I go to the gym, and and I'm thinking of getting iPhone which also has an iPod feature in it. Can all of these be hooked up to my iTunes account? Can I pick and chose

  • How can I remove wireless passwords from my iPhone 4?

    I have an iPhone 4 and need to remove a couple of the cached (remembered) passwords from the iPhone memory. In other words, I would like to get to the point where the phone asks me for the network password instead of using the one saved to the phone.

  • Have a problem selecting wallpaper picture in ios8

    I recently installed ios8 and reset the settings.  When I did my wallpaper changed from a picture on my camera roll to one of the generic wallpapers.  I went to the selection screen to choose new wallpaper and under Photos, it only showed the most re

  • Launch Adobe Connect from Application

    I have a custom C#/WPF application that allows a user to interact with a remote traveler.  The application will do the following things: Launch Adobe Connect Login to  an Adobe Connect account Send the remote traveler a link to that  Adobe Connect se

  • Red Light, No Audio, Realtek

    The Problem When I run Windows Vista a red light appears in my audio port and the sound, no surprisingly, doesn't work. The Computer Macbook Pro running the latest MAC OS and Windows Vista Ultimate. What I did - I installed Windows using Boot Camp 2.