Error ORA-01722

I am facing this problem when executing the following query in WHEN-BUTTON-PRESSED trigger.
SELECT COUNT(*) INTO row_count
     FROM SALESCOLLECTION SC, BANKGROUP BKG, BANK B, SALESPOINTSUB SPS
     WHERE SC.SUBPOINT_ID = SPS.SUBPOINT_ID
     AND SPS.BANK_ID = B.BANK_ID
     AND B.BANK_GROUP_ID = BKG.BANK_GROUP_ID
     AND TO_DATE(SC.SALEDATE,'dd-Mon-yy') BETWEEN TO_DATE(vcSaleMonth,'Mon-yyyy') AND LAST_DAY(TO_DATE(vcSaleMonth,'Mon-yyyy'))
     AND SPS.SUBPOINT_ID IN (nSubPointId);
Here nSubPointId is Varchar2 and it is expecting numeric value. How can i handle it here?

Using forms_ddl you could use raise_application_error and pass back the value of row_count in 'sqlerrm'. But I wouldn't recommend that. You'd be better off using either exec_sql in forms or creating a server-side function which uses execute immediate.
However, using dynamic sql for a heavily used process can have an adverse effect on an application because it makes no use of the cache of parsed statements. So the best solution may be to pass the subpointids in a nested table to a function on the database and cast that into a table within the select statement. This article isn't exactly your requirement but it should help.
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:246014735810
'Cast' is the key term.

Similar Messages

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

  • Insert into table error - ora-01722 invalid number

    Need some assistance with inserting data into a table. The date column keeps on failing to insert.
    here is my insert statement
    insert into tab_mod_history (TABLE_OWNER, TABLE_NAME, PARTITION_NAME, SUBPARTITION_NAME, INSERTS, UPDATES, DELETES, TIMESTAMP, TRUNCATED)
    values ('$i_owner','$i_table','$i_part_name','$i_subpart_name','$i_ins','$i_upd','$i_del','$time','$trunc');Script loads data for partition tables, but not normal tables with the timestamp column
    I select the data using this select statement:
    select table_owner, table_name, partition_name, subpartition_name, inserts, updates, deletes, timestamp, truncated
    from dba_tab_modifications
    where table_owner in ('scott','MAC')
    order by table_name;

    ok here are the errors:
    values ('MAC','WC_MST','11','1','1','12/04/2011','NO','','')
    ERROR at line 2:
    ORA-01722: invalid number
    Session altered.
    values ('MAC','WF_05A','208','128','208','18/02/2011','NO','','')
    ERROR at line 2:
    ORA-01722: invalid numberHere is the table structure
    SQL> desc tab_mod_history
    Name                                      Null?    Type
    TABLE_OWNER                                        VARCHAR2(30)
    TABLE_NAME                                         VARCHAR2(30)
    PARTITION_NAME                                     VARCHAR2(30)
    SUBPARTITION_NAME                                  VARCHAR2(30)
    INSERTS                                            NUMBER
    UPDATES                                            NUMBER
    DELETES                                            NUMBER
    TIMESTAMP                                          DATE
    TRUNCATED                                          VARCHAR2(3)
    DROP_SEGMENTS                                      NUMBERI used the column names to create the variables..that is why $time was used.
    How else could I have done it????
    thought this was easy..but to my dismay...

  • Htmldb_item.select_list_from_query-report error: ORA-01722: invalid number

    Hi, i am trying to create a tabular form
    with one of the item's value depending on another item's value, but i have an ORA-01722: invalid number error
    my application is:
    DESC AC6LIS
    ACLIS_SEQ_ID NOT NULL NUMBER(10)
    ACLIS_TSG_ID NOT NULL VARCHAR2(5)
    ACLIS_EDZ_ID NOT NULL VARCHAR2(3)
    DESC VE1EDZ
    EDZ_TSG_ID NOT NULL VARCHAR2(5)
    EDZ_ID NOT NULL VARCHAR2(3)
    EDZ_DESCRIZ VARCHAR2(50)
    select ACLIS_TSG_ID, htmldb_item.select_list_from_query(2,ACLIS_EDZ_ID,'select EDZ_DESCRIZ, EDZ_ID from ve1edz where ve1edz.EDZ_TSG_ID ='||ac6lis.ACLIS_TSG_ID) edz_select_list from ac6lis
    Any Help?
    Thans in advance
    Costantino

    When your inner SELECT statement is firing it is doing a type conversion. It is seeing a number value in 'ac6lis.ACLIS_TSG_ID' and trying to do a number comparison with 've1edz.EDZ_TSG_ID'. 've1edz.EDZ_TSG_ID' has a non-numeric value in one of the rows which results in your error. To correct this place quotes around the value of 'ac6lis.ACLIS_TSG_ID' like:
    select ACLIS_TSG_ID,
           htmldb_item.select_list_from_query(2,ACLIS_EDZ_ID,'select EDZ_DESCRIZ, EDZ_ID from ve1edz where ve1edz.EDZ_TSG_ID ='''||ac6lis.ACLIS_TSG_ID||'''') edz_select_list
      from ac6lisMike

  • Error ORA-01722: invalid number

    Hi,
    I am using Apex 3.2 on Oracle 11g (Enterprise Edition).
    I am new to Apex and I am using an imported application and editing its features to match my requirements.
    While uploading a CSV file, I am getting error as :ORA-01722: invalid number"
    Can someone help me where I am wrong or where I need to modify something?
    Thanks in advance.
    Regards
    Sharath

    Hi Littlefoot,
    Another set of information which I felt could be useful.
    In "Home>Application Builder>Application 1000>Page 71>Edit Page Process", under the tab 'Source', I could see the below code. I think I need to make changes here. Please correct me if I am wrong here.
    I need your help to modify this code (as this is an imported application, this code might be written keeping in mind the previous application).
    --PLSQL code for uploading server details
    DECLARE
    v_blob_data      BLOB;
    v_blob_len      NUMBER;
    v_position      NUMBER;
    v_raw_chunk      RAW(10000);
    v_char           CHAR(1);
    c_chunk_len           NUMBER:= 1;
    v_line           VARCHAR2 (32767):= NULL;
    v_data_array      wwv_flow_global.vc_arr2;
    v_rows           NUMBER;
    v_count           NUMBER;
    --for editing
    v_sr_no          NUMBER:=1;
    v_last_char          varchar2(2);
    BEGIN
    -- Read data from wwv_flow_files
    SELECT blob_content INTO v_blob_data FROM wwv_flow_files
    WHERE last_updated = (SELECT MAX(last_updated) FROM wwv_flow_files WHERE UPDATED_BY = :APP_USER)
    AND id = (SELECT MAX(id) FROM wwv_flow_files WHERE updated_by = :APP_USER);
    v_blob_len := dbms_lob.getlength(v_blob_data);
    v_position := 1;
    -- For removing the first line
    WHILE ( v_position <= v_blob_len )
    LOOP
    v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
    v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
    v_position := v_position + c_chunk_len;
    -- When a whole line is retrieved
    IF v_char = CHR(10) THEN
    EXIT;
    END IF;
    END LOOP;
    -- Read and convert binary to char
    WHILE ( v_position <= v_blob_len )
    LOOP
    v_raw_chunk := dbms_lob.substr(v_blob_data,c_chunk_len,v_position);
    v_char := chr(hex_to_decimal(rawtohex(v_raw_chunk)));
    v_line := v_line || v_char;
    v_position := v_position + c_chunk_len;
    -- When a whole line is retrieved
    IF v_char = CHR(10) THEN
    --removing the new line character added in the end of each line
    v_line := substr(v_line, 1, length(v_line)-2);
    --removing the double quotes
    v_line := REPLACE (v_line, '"', '');
    --For checking the absense of data in the end of line
    v_last_char:= substr(v_line,length(v_line),1);
    IF v_last_char = CHR(44) THEN
         v_line :=v_line||'-';
    END IF;
    -- Convert each column separated by , into array of data
    v_data_array := wwv_flow_utilities.string_to_table (v_line, ',');
    -- Insert data into target tables
    --Checking whether the data already exist
    SELECT COUNT(SERVERID) INTO v_count FROM REPOS_SERVERS WHERE SERVERNAME=v_data_array(1);
    IF v_count = 0 THEN
    EXECUTE IMMEDIATE 'INSERT INTO
    REPOS_SERVERS (SERVERID,SERVERNAME,IPADDRESS,OS,SERVER_MODEL,CPU,MEMORY,PLATFORM_TYPE, MACHINE_TYPE,CLUSTERED,LAST_UPDATE_BY,LAST_UPDATE_DATE,REMARKS) VALUES(:1,:2,:3,:4,:5,:6,:7,:8,:9,:10,:11,:12,:13)'
    USING
    SERVERS_SEQ.NEXTVAL,
    v_data_array(1),
    v_data_array(2),
    v_data_array(3),
    v_data_array(4),
    to_char(NVL(v_data_array(5),NULL)),
    v_data_array(6),
    v_data_array(7),
    v_data_array(8),
    v_data_array(9),
    v_data_array(10),
    v_data_array(11),
    v_data_array(12);
    END IF;
    -- Clearing out the previous line
    v_line := NULL;
    END IF;
    END LOOP;
    END;
    Regards
    Sharath

  • Oralce Error - ORA-01722 WARN  [org.hibernate.dialect.Oracle9Dialect]

    Hi.
    i want to know meaning of following Error and how to remove it.
    ORA-01722
    WARN [org.hibernate.dialect.Oracle9Dialect] The Oracle9Dialect dialect has been deprecated; use either Oracle9iDialect or Oracle10gDialect instead
    Regards,
    Pradeep Kr. Sharma
    Edited by: user13389551 on Jul 12, 2010 11:27 PM
    Edited by: user13389551 on Jul 13, 2010 3:26 AM

    ORA-01722: invalid number
    Cause: The attempted conversion of a character string to a number failed because the character string was not a valid numeric literal. Only numeric fields or character fields containing numeric data may be used in arithmetic functions or expressions. Only numeric fields may be added to or subtracted from dates.
    Action: Check the character strings in the function or expression. Check that they contain only numbers, a sign, a decimal point, and the character "E" or "e" and retry the operation.

  • Shared Services JDBC error ORA-01722 after restart

    Help me please...
    I have this configuration:
    - Red Hat EL5.0
    - Oracle DB 10.2.0.1
    - WebLogic 9.2 MP3
    - Hyperion 9.3.1
    Hyperion Shared Services install and configured - properly (without any exceptions and errors). Than I setup and config Essbase and Administration Services, externalize users and all this worked properly. I have projects and users in Shared Services and I can do anything with Essbase applications and cubes.
    When restart Shared Services and other services I have error when Shared Services started:
    org.apache.slide.store.impl.rdbms.StandardRDBMSAdapter - ERROR - SQL error 1722 on /1238771509551.56: [Hyperion][Oracle JDBC Driver][Oracle]ORA-01722: invalid number
    and after that Shared Services - worked but I didn't find any users and projects in Shared Services.
    Thanks

    Hi dzianis ,
    I`m haveing the same problem, I tried this solution but it didn`t work.
    You set it at the user instance or at the SGBD?
    Regards,
    Marcelo

  • Error: ORA-01722 while connecting oracle using OCCI

    Please help,
    I get exception 1722 ORA-01722 Invalid Number while selecting records from oracle database using simple select statement.
    I have allready installed oracle 10.2.0.3.0 Patch 13 from oracle.com.
    Environment: win2k3 (sp2-32 bit), Oracle 10.2.0.3.0, VC++ 2005 (VC8)
    Dump of file vc8test.exe
    File Type: EXECUTABLE IMAGE
    Image has the following dependencies:
    MSVCR80.dll
    MSVCP80.dll
    oraocci10.dll
    KERNEL32.dll
    Summary
    1000 .data
    1000 .rdata
    1000 .rsrc
    2000 .text

    thanx for the reply, here is the source code:
    I am unable to connect to oracle, i have tried every possible combination.
    i had tested using vc++ 2005 and with vc++ 6.0
    The below code is tested on visual c++ 2005 and from oracle 10.2.0 client.
    #include <iostream>
    #include <occi.h>
    using namespace oracle::occi;
    using namespace std;
    class occidml
    private:
         Environment *env;
         Connection *conn;
         Statement *stmt;
    public:
         occidml(string user, string passwd, string db)
              env=Environment::createEnvironment(Environment::DEFAULT);
              conn=env->createConnection(user,passwd, db);
         ~occidml()
              env->terminateConnection(conn);
              Environment::terminateEnvironment(env);
         void displayAllRows()
                   string sqlStmt="select * from tcm_ref_city";
                   stmt=conn->createStatement(sqlStmt);
                   ResultSet *rset=stmt->executeQuery();
                   try{
                        while(rset->next()){
                             cout<< rset->getString(1)<<"\t"<<rset->getInt(2)<<endl;                         
                        }catch(SQLException ex){
                             cout<< "Exception\t"
                                  <<ex.getErrorCode()<<"\t"
                                  <<ex.getMessage()<<endl;
                             stmt->closeResultSet(rset);
                             conn->terminateStatement(stmt);
         int main(void)
              string usr="stltc";
              string pass="stltc";
              string db="stltc";
              int xx;
              cout<<"hello this is rakesh";
              occidml *demo=new occidml(usr,pass, db);
              demo->displayAllRows();
              cin>>xx;
              /*Environment *env1 ;
              Connection *conn;
              env1=Environment::createEnvironment(Environment::DEFAULT);
              Connection conn=env1->createConnection("STLIUC", "STLIUC","IAD");  /
              return 0;
    ******************************************************************************

  • Getting ORA-01722 - Invalid number error in SQL

    I am trying to run a query like
    SELECT NVL (ic.industryclassdesc, 'NULL') industryclass,
    NVL (hci.updated_by, 'NULL') updatedby,
    NVL (hci.operation, 'NULL') operation,
    hci.audittimestamp audittimestamp
    FROM xxx_company_inxxxx hci, xxx_industry ic
    WHERE hci.company_id = 9079496
    AND ic.industryclassid = hci.industryclass_id
    ORDER BY DECODE (hci.operation, 'D', 'X', hci.operation), hci.audittimestamp
    And getting the error - ORA-01722 - Invalid number.
    But the columns - ic.industryclassid, hci.industryclass_id and also hci.company_id are 'Number' datatype and also not nullable.
    Can anyone suggest a approch

    SELECT NVL (ic.industryclassdesc, 'NULL')
    > industryclass,
    NVL (hci.updated_by, 'NULL') updatedby,
    NVL (hci.operation, 'NULL') operation,
    hci.audittimestamp audittimestamp
    xxx_company_inxxxx hci, xxx_industry ic
    WHERE hci.company_id = 9079496
    AND ic.industryclassid = hci.industryclass_id
    BY DECODE (hci.operation, 'D', 'X', hci.operation),
    hci.audittimestamp
    And getting the error - ORA-01722 - Invalid number.
    Do not enter 'String' in the nvl function,if the column is number datatype,
    venki
    null

  • 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

  • ORA-00979: not a GROUP BY expression ORA-01722: invalid number error

    This is my follwing code:
    select isin,nomenclature,sum(total_balance),c_itd_rddt,c_itd_intrrt from
    select distinct instru.c_int_isin isin,
    instru.c_int_longdesc nomenclature,
    to_char(abs(acpos.acp_totbal),
    '999999999999,99,99,990.00')total_balance,
    c_itd_rddt,
    c_itd_intrrt
    from cs_instru_t instru,
    cs_instrudetls_t insdtls,
    cs_acpos_t acpos
    where instru.c_int_instruid = insdtls.c_itd_instruid
    and acpos.acp_instruid = instru.c_int_instruid
    and acpos.acp_acntnum = 'SG030001'
    and instru.c_int_instypid in (1)
    and insdtls.c_itd_rddt > ('31-Dec-2010')
    and instru.c_int_isin not in
    (select spsec.c_ssg_isinno from cs_splsecgrp_t spsec) and acpos.acp_totbal!=0
    group by instru.c_int_instruid,
    instru.c_int_longdesc,
    insdtls.c_itd_rddt,
    instru.c_int_insstts,
    instru.c_int_isin,
    insdtls.c_itd_rddt,
    acpos.acp_totbal,c_itd_intrrt
    --order by extract(year from  c_itd_rddt),c_itd_intrrt
    union
    select c_srm_prntisin isin,c_int_longdesc nomenclature,to_char(abs(acpos.acp_totbal),
    '999999999999,99,99,990.00') total_balance,c_itd_rddt,
    c_itd_intrrt from cs_instrudetls_t insdtls,cs_strmap_t map,cs_instru_strips instru,cs_acpos_t acpos
    where c_int_instruid=c_srm_prncplinsid
    and c_itd_instruid=c_int_instruid
    and c_srm_prncplinsid=acp_instruid
    and acp_acntnum='SG030001'
    )view1
    group by isin
    I want to group by isin only as only isin is same and the rest of the fields are different.But I want to display all the fields.Please Help
    I am getting the following errors:
    ORA-00979: not a GROUP BY expression
    ORA-01722: invalid number

    wat abt the other error ora-01722 not a valid number. How to take sum of total_balance which is to_char

  • ORA-01722: invalid number error coming in Oracle 10g.

    Hi,
    We are getting the error "ORA-01722: invalid number" while opening a cursor using CURSOR FOR LOOP.
    This error has started coming only after we have migrated to Oracle 10g from Oracle 9i. Earlier the same code used to work properly. And also on Oracle 10g, its not happening every time. Sometimes it gives error while sometimes it works.
    Does anybody know about any such bug in Oracle 10g. Our cursor is a parametrized cursor accepting a VARCHAR2 parameter and the value we are passing to it is also character.
    Our database is Oracle 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production and is running on UNIX server.

    And also on Oracle 10g, its not happening every time. Sometimes it gives error while sometimes it works. This is typically due to
    a) environment settings that differ from session to session
    b) or more often, data
    The actual error means that Oracle expects a number and is unable to obtain a number from the input (data or SQL or bind variables) supplied. I agree with William that it looks a lot like an implicit TO_NUMBER() conversion failing.
    Why not add a debug exception handler to the code? When that exception occurs, dump the PL/SQL call stack and values of all variables and parameters to a debug/logging table (using an autonomous transaction).

  • ORA-01722 Error

    Hi,
    I'm creating a search page with 4 fields. 3 of the fields come directly from the database so those pose no problem. The last field is a custom field (say month number) which indirectly searchs a field in the DB. I'd like to pull out all records that contain a given month number - the field in the database would contain the full date.
    In the view object, I've added a transient field to contain my custom field (called SearchMonth). In the query, I have added this:
    ... to_number(extract(MONTH FROM BilledSplitInfoRptHdr.CYCLE_DATE)) = to_number(:1)
    In the view controller, I've bound my variable ${binding.SearchMonth}.
    When I execute, I get an error ORA-01722 which states that the number was an invalid number...
    I'm not sure if I"m binding incorrectly, or the custom search field is being found but crashing in the conversion? Any help is appreciated.
    Thanks.

    Jason,
    Some debugging should help here. For starters you could go to the Project Properties => Runner, and in the Java Options field fill in:
    -Djbo.debugoutput=console
    In the (large amount) of additional logging you should be able to identify the value for the bind parameter.
    Of course you could also try a simple breakpoint on the get/setSearchMonth and run the application using 'debug' instead of 'run'.
    Hope this helps,
    Peter Ebell
    JHeadstart Team

  • Getting error as ORA-01722: invalid number

    Hi below is my query
    select count(1) from table1 where table1.rqstid = '83041' AND table1..score_name = 'Small Business Credit Risk Score' AND
    to_number(table1.total_score) >= '70' and rownum<2
    I tried to convert '70' to 70, but still I got ame error.
    In table1 total_score is varchar2(30) data type, but for this rqstid the data is 420, so it should convert 420 to number and compare with 70.
    But why I am getting this error? Please help.
    If I remove to_number conversion fot total score then this error is not coming, but this will not give correct result for me.
    Thanks.

    CREATE TABLE SBE_SCORE (
    RQSTID VARCHAR2 (30) NOT NULL,
    SCORE_NAME VARCHAR2 (300),
    TOTAL_SCORE VARCHAR2 (30),
    RISKLEVEL VARCHAR2 (30),
    SUBSCRIBER_ID NUMBER (10))
    INSERT INTO SBE_SCORE ( RQSTID, SCORE_NAME, TOTAL_SCORE, RISKLEVEL,
    SUBSCRIBER_ID ) VALUES (
    '83041', 'Small Business Credit Risk Score for Financial Services', '420', NULL, NULL);
    My Query was
    SELECT
    count(1)
    FROM
    sbe_score
    WHERE
    sbe_score.rqstid = '83041' AND
    sbe_score.score_name = 'Small Business Credit Risk Score for Financial Services' AND
    to_number(sbe_score.total_score) >= '70' and
    rownum<2
    Error:ORA:01722 Invalid Number
    Now I have modified as below and I am able to get correct results
    SELECT
    count(1)
    FROM
    sbe_score
    WHERE
    sbe_score.rqstid = '83041' AND
    sbe_score.score_name = 'Small Business Credit Risk Score for Financial Services' AND
    to_number(translate(lower(sbe_score.total_score),'abcdefghijklmnopqrstuvwxyz@._','0'))>= 70 and
    rownum<2
    I I omit r in the translate function then I am getting same error Invalid number, So just I want to know whether the data 420 for total_score is taking "r" internally? withou our knowledge?

  • 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

Maybe you are looking for