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...

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)

  • 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

  • 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

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

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

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

  • EXECUTE IMMEDIATE ORA-01722 invalid number

    hi all
    i have a plsql procedure in which the following statement which gives this error ORA-01722: invalid number
    sql_stmt :='UPDATE Student set '||stu_gradefor||'=TO_NUMBER('||stu_marks||') where UserID='||stu_UID;
    EXECUTE IMMEDIATE sql_stmt;
    here all variables (stu_marks,stu_gradefor and stu_UID) are varchar2 coming from different procedure(form) but in the table named Student column HW1 (stu_gradefor) is of datatype number.
    I have tried a lot but could not make it to work. Is it that we cannot enter an number through EXECUTE IMMEDIATE? If Possible can somebody help me with this?
    Thanks a lot.
    Regards
    Jyoti

    create table Student(UserID varchar2(8) not null, HW1 number(3) , HW2 number(3) , PA1 number(3) , ................);
    create table Domain(R_Domain varchar2(11) not null, R_Status char(1) not null, R_Date Date null,R_Value varchar2(11) null, R_Mean varchar2(300) not null);
    insert into Domain( R_Domain, R_Status, R_Value, R_Mean )values(
         'Term','t','PA1','First Programming Assignment');
    Full names for HW1, HW2, PA1....are in the Domain table. so in variable stu_gradefor we get the R_Value.
    this is true :variable stu_marks is not actually a number, so the TO_NUMBER is causing the error. stu_marks is of datatype varchar2 but the field HW1,.. are all expecting a numeric value.
    i tried SELECT TO_NUMBER(stu_marks) INTO gmark FROM DUAL;
    sql_stmt :='UPDATE Student set '||stu_gradefor||'=(:1) where UserID='||stu_UID;
    EXECUTE IMMEDIATE sql_stmt using gmark;
    where gmark is a number but noting works.same error
    This can be true:the column userid is a varchar2 column with a mix of numeric and alpha numeric values. userid value that i inserted was'12345678'
    i there any other way to handle this situation?
    Thanks for replying
    Jyoti

  • 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

  • Oracle SQL Developer 1.1.1.25.14, I rror ORA-01722 Invalid Number

    I have installed the new version of Oracle SQL Developer 1.1.1.25.14, I use Oracle 9.2. When I browse in the tree of the stored procedures and compile I obtain Error ORA-01722 Invalid Number. The previous version does not give this error. I have tried to change the decimal separator to comma ',' and point '.' but this error always appears.

    create or replace
    PROCEDURE getAge (
    dtmDataStart_in IN DATE,
    dtmDataEnd_in IN DATE,
    intYears_out OUT NUMBER,
    intMonths_out OUT NUMBER,
    intDays_out OUT NUMBER) AS
    -- Calcola il numero di anni, mesi, giorni intercorsi
    -- dalla data iniziale alla data finale.
    -- Se la data iniziale è > della data finale, le due date
    -- vengono scambiate e le variabili di output vengono ritornate
    -- con segno negativo.
    --==================================================
    -- Data Ultima Modifica: 31/07/98
    -- Aggiunta procedura per il calcolo della differenza tra
    -- due date dello stesso anno.
    --==================================================
    -- DICHIARAZIONE VARIABILI INIZIO --------------------------------------------------------
    intYMDStart NUMBER(10);
    intYMDEnd NUMBER(10);
    intYMD NUMBER(10);
    intDiffAnni NUMBER(5);
    intDiffMesi NUMBER(5);
    intDiffGiorni NUMBER(5);
    intMeseStart NUMBER(5);
    intAnnoStart NUMBER(5);
    intTotGiorniMeseStart NUMBER(5);
    ysnNegativo NUMBER(5);
    -- DICHIARAZIONE VARIABILI FINE ----------------------------------------------------------
    BEGIN
    intYMDStart := TO_NUMBER( TO_CHAR(dtmDataStart_in,'YYYYMMDD'));
    intYMDEnd := TO_NUMBER( TO_CHAR(dtmDataEnd_in,'YYYYMMDD'));
    ysnNegativo := 0;
    IF intYMDStart = intYMDEnd THEN
    intYears_out := 0;
    intMonths_out := 0;
    intDays_out := 0 ;
    ELSE
    IF intYMDStart > intYMDEnd THEN
    intYMD := intYMDStart;
    intYMDStart := intYMDEnd;
    intYMDEnd := intYMD;
    ysnNegativo := -1;
    END IF;
    intDiffAnni := TO_NUMBER(TO_CHAR(dtmDataEnd_in,'YYYY')) - TO_NUMBER(TO_CHAR(dtmDataStart_in ,'YYYY'));
    intDiffMesi := TO_NUMBER(TO_CHAR(dtmDataEnd_in,'MM')) - TO_NUMBER(TO_CHAR(dtmDataStart_in ,'MM'));
    intDiffGiorni := TO_NUMBER(TO_CHAR(dtmDataEnd_in,'DD')) - TO_NUMBER(TO_CHAR(dtmDataStart_in ,'DD'));
    -- I valori cosi' calcolati di intDiffAnni, intDiffMesi e intDiffGiorni vanno bene
    -- ad eccezione dei seguenti casi:
    -- Sistemo intDiffAnni
    IF (intDiffMesi > 0 OR (intDiffMesi = 0 AND intDiffGiorni >= 0)) THEN
    -- intDiffAnni e' OK
    intDiffAnni := intDiffAnni;
    ELSE
    -- non e' ancora arrivato il giorno del compleanno
    intDiffAnni := intDiffAnni-1;
    END IF;
    -- Sistemo intDiffMesi
    IF (intDiffMesi > 0 AND intDiffGiorni < 0) THEN
    intDiffMesi := intDiffMesi-1;
    ELSIF (intDiffMesi < 0 ) THEN
         if(intDiffGiorni<0) THEN
         intDiffMesi := intDiffMesi+11;
    else
         intDiffMesi := intDiffMesi+12;
    END IF;
    ELSIF (intDiffMesi=0 AND intDiffGiorni<0) THEN
         intDiffMesi:=11;
    END IF;
    -- Sistemo intDiffGiorni
    -- Calcolo i giorni come (TotGiorniMeseIniziale - GiornoIniziale) + (GiornoFinale - 0)
    -- che e' uguale a fare TotGiorniMeseIniziale + (GiornoFinale-GiornoIniziale)
    IF intDiffGiorni < 0 THEN
    intMeseStart := TO_NUMBER(TO_CHAR(dtmDataStart_in ,'MM'));
    IF intMeseStart IN (1,3,5,7,8,10,12) THEN
    intTotGiorniMeseStart := 31;
    ELSIF intMeseStart = 2 THEN
    -- Da enciclopedia: sono bisestili gli anni multipli di 4
    -- esclusi i secoli che non sono multipli di 400 (Parte commentata).
    intAnnoStart := TO_NUMBER(TO_CHAR(dtmDataStart_in ,'YYYY'));
    if (intAnnoStart MOD 4) = 0
    -- AND NOT ((intAnnoStart MOD 100) = 0 AND (intAnnoStart MOD 400) <> 0)
    Then
    intTotGiorniMeseStart := 29;
    else
    intTotGiorniMeseStart := 28;
    end if;
    ELSIF intMeseStart IN (4,6,9,11) THEN
    intTotGiorniMeseStart := 30;
    END IF;
    intDiffGiorni := intDiffGiorni + intTotGiorniMeseStart;
    END IF;
    IF ysnNegativo = 0 THEN
    intDays_out := intDiffGiorni;
    intMonths_out := intDiffMesi;
    intYears_out := intDiffAnni;
    ELSE
    intDays_out := intDiffGiorni * (-1);
    intMonths_out := intDiffMesi * (-1);
    intYears_out := intDiffAnni * (-1);
    END IF;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
    RAISE;
    END getAge;
    The output result of compilation is "GETAGE Compiled", I think the 01722 error is not caused from an sql syntax error, but probably caused from an invalid or unsupported or 'strange' configuration on nationalization... the fact surprises me that the previous version did not give problems
    THANKS SO MUTCH
    */

  • SQL*Loader- Records Rejected - Error on table ORA-01722: invalid number

    Getting the following errors :
    Please tell me where I am going wrong?
    Attached is the log file and snippets of datafile along with the control file !!
    Also please direct me how can i upload 4900 records at one go?
    SQL*Loader: Release 11.1.0.7.0 - Production on Fri Oct 14 03:06:06 2011
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    Control File: sample.ctl
    Data File: Cities.csv
    Bad File: Cities.bad
    Discard File: none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array: 64 rows, maximum of 256000 bytes
    Continuation: none specified
    Path used: Conventional
    Table CITY, loaded from every logical record.
    Insert option in effect for this table: INSERT
    Column Name Position Len Term Encl Datatype
    ID FIRST * , CHARACTER
    NAME NEXT 35 , ' CHARACTER
    COUNTRYCODE NEXT 3 , ' CHARACTER
    POPULATION NEXT * WHT CHARACTER
    Record 1: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 2: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 3: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 4: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 5: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 6: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 7: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 8: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 9: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 10: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 11: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 12: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 13: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 14: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 15: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 16: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 17: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 18: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 19: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 20: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 21: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 22: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 23: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 24: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 25: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 26: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 27: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 28: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 29: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 30: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 31: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 32: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 33: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 34: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 35: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 36: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 37: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 38: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 39: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 40: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 41: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 42: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 43: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 44: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 45: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 46: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 47: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 48: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 49: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 50: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    Record 51: Rejected - Error on table CITY, column POPULATION.
    ORA-01722: invalid number
    MAXIMUM ERROR COUNT EXCEEDED - Above statistics reflect partial run.
    Table CITY:
    0 Rows successfully loaded.
    51 Rows not loaded due to data errors.
    0 Rows not loaded because all WHEN clauses were failed.
    0 Rows not loaded because all fields were null.
    Space allocated for bind array: 35840 bytes(64 rows)
    Read buffer bytes: 1048576
    Total logical records skipped: 0
    Total logical records read: 64
    Total logical records rejected: 51
    Total logical records discarded: 0
    Run began on Fri Oct 14 03:06:06 2011
    Run ended on Fri Oct 14 03:06:12 2011
    Elapsed time was: 00:00:06.18
    CPU time was: 00:00:00.03
    my control file (sample.ctl):
    load data infile 'Cities.csv'
    into table city
    fields terminated by ','
    (id integer external,
    name char(35) enclosed by "'",
    countrycode char(3) enclosed by "'",
    population integer external terminated by '\n'
    my datafile (Cities.csv) (it contains 4900 records, but I am showing here just 4 records for ease)
    3830,'Virginia Beach','USA',425257
    3831,'Atlanta','USA',416474
    3832,'Sacramento','USA',407018
    3833,'Oakland','USA',399484
    Thanks in advance!!

    Look that when I change a little bit your datafile as follows
    1,'Kabul','AFG',1780000
    2,'Qandahar','AFG','237500'
    3,'Herat','AFG','186800'  I got the same error (2 last rows rejected for the same error invalid number)
    mhouri > select * from cities;
            ID NAME                                COU POPULATION
             1 Kabul                               AFG    1780000
    SQL*Loader: Release 10.2.0.3.0 - Production on Fri Oct 14 10:38:06 2011
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Control File:   cities.ctl
    Data File:      cities.dat
      Bad File:     cities.bad
      Discard File:  none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array:     64 rows, maximum of 256000 bytes
    Continuation:    none specified
    Path used:      Conventional
    Table CITIES, loaded from every logical record.
    Insert option in effect for this table: INSERT
       Column Name                  Position   Len  Term Encl Datatype
    ID                                  FIRST     *   ,       CHARACTER           
    NAME                                 NEXT    35   ,    '  CHARACTER           
    COUNTRYCODE                          NEXT     3   ,    '  CHARACTER           
    POPULATION                           NEXT     *  WHT      CHARACTER           
    Record 4: Rejected - Error on table CITIES, column ID.
    Column not found before end of logical record (use TRAILING NULLCOLS)
    Record 2: Rejected - Error on table CITIES, column POPULATION.
    ORA-01722: invalid number
    Record 3: Rejected - Error on table CITIES, column POPULATION.
    ORA-01722: invalid number
    Table CITIES:
      1 Row successfully loaded.
      3 Rows not loaded due to data errors.
      0 Rows not loaded because all WHEN clauses were failed.
      0 Rows not loaded because all fields were null.
    Space allocated for bind array:                  35840 bytes(64 rows)
    Read   buffer bytes: 1048576
    Total logical records skipped:          0
    Total logical records read:             4
    Total logical records rejected:         3
    Total logical records discarded:        0
    Run began on Fri Oct 14 10:38:06 2011
    Run ended on Fri Oct 14 10:38:06 2011
    Elapsed time was:     00:00:00.23
    CPU time was:         00:00:00.09Population value within the data file should be a number
    Best regards
    Mohamed Houri

  • 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