TO_NUMBER gives invalid number

Hello
I'm trying to compare varchar2 (250) field with numeric field and it gives me the error invalid number when I run this query.
There are some alphanumeric values in field varchar2 which I imagine causing problem. Not sure how to check if a field value is numeric or Alpha numric.
So I need TO_NUMBER only if the t.interface_header_attribute1 value is NUMERIC. I don't know how to do this.

SELECT T.trx_number TransactionRef,
ca_ship.Account_Number ship_to_CUSTOMER_AC,
Decode(TP.type,'INV','0','CM','1') TransactionType,
OE.order_number,
t.trx_date,
P.AMOUNT_DUE_ORIGINAL,
OE.cust_po_number
OF ra_customer_trx_all t.
ra_cust_trx_types_all tp,
OE OE_ORDER_HEADERS_ALL,
hz_cust_site_uses_all su_ship,
hz_cust_acct_sites_all sa_ship,
hz_cust_accounts ca_ship,
AR_PAYMENT_SCHEDULES_ALl p
WHERE t.status_trx = "OP" - close
and t.cust_trx_type_id = tp.cust_trx_type_id

and to_number (nvl (trim (t.interface_header_attribute1),'0 ')) = oe.order_number - to_number causing an error invalid number

and p.TRX_NUMBER = t.trx_number
-ship to a/c
and su_ship.site_use_id (+) = t.ship_to_site_use_id
AND su_ship.cust_acct_site_id = sa_ship.cust_acct_site_id (+)
AND sa_ship.cust_account_id = ca_ship.cust_account_id (+);

Any help will be much appreciated.

Thank you

VJ

Hello

and     regexp_like(t.interface_header_attribute1, '^[0-9]+') -- excludes rows where non digits occur in this column

Not quite true.

with data as(
select '123' x from dual union all
select 'a234f' x from dual union all
select 'a234' x from dual union all
select '12d34' x from dual union all
select '123df5' x from dual)

select
*
from data
where
regexp_like(x, '^[0-9]+')

Kind regards
Bobin

Tags: Database

Similar Questions

  • Invalid number when you use to_number function

    Hello
    Both in SQL * more and SQL Deveoper when I type and run

    Select to_number ('1234.64 ','9999.9 ') of double;

    I get ORA-01722: invalid number error. What can be the reason for this error?

    Mikhail says:
    SQL > select to_number('1234.64','9999D9') from double;
    Select double to_number('1234.64','9999D9')
    *
    ERROR on line 1:
    ORA-01722: invalid number

    You pass it a string ("1234.64'") with two digits to the right of the decimal separator, but you tell it that you have only one digit to the right of the decimal separator ('9999 D 9')

  • TO_CHAR function gives an error "Invalid number" - ORA - 01722

    I will execute under query in Oracle 11 g.

    Select to_char (nvl ("2013-08-12', to_date (1 January 1924 ',' DD-MON-YY')"), ' mm/dd/yyyy') FROM dual;

    But I got error below.

    ORA-01722: invalid number

    01722 00000 - "invalid number."

    * Cause:

    * Action:

    A know all work around that. Your help is very appreciated.

    Like this.

    SELECT TO_CHAR)

    NVL (TO_DATE ('2013-08-12', 'YYYY-MM-DD'),)

    TO_DATE (1 JANUARY 1924 ', 'DD-MON-YYYY')),

    'mm/dd/yyyy')

    conv_to_char

    FROM DUAL;

    -----------------------------------------

    CONV_TO_CHAR

    -------

    12/08/2013

    See you soon,.

    Manik.

  • More than 1 SQL query with checkbox and error invalid number report

    Hi all

    I have two SQL query reports that each has an apex_item.checkbox and two processes for each report.  A report/process works very well.  It gives me an error of invalid number.

    In addition, another query SQL (editable report) gives me the following error when using the Multi line process, delete.

    ORA-06502: PL/SQL: digital or value error: character number conversion
    error ORA-06502: PL/SQL: digital or value error: character number conversion
    error
    Ok

    When I got a report from SQL query (with box and a process) and the query SQL (editable report) everything worked.  It stopped working when I added another SQL query report (with box and a process).

    A SQL query has the following in my query: apex_item.checkbox(3,email_id,'UNCHECKED') ""

    The other SQL query has the following: apex_item.checkbox(2,b.file_id,'UNCHECKED') ""

    Any help will be greatly appreciated,

    Sylvia

    Hi Reema,

    I've recreated the region and now it works!

    Thank you for this, looking at

    Sylvia

  • ORA-01722: invalid number in SQL Loader

    Hi all

    CREATE TABLE SAMPL_TABLE

    (

    ITEM_CATEGORY VARCHAR2 (30 BYTES),

    ITEM_NO VARCHAR2 (240 BYTES),

    ITEM_DESCRIPTION VARCHAR2 (240 BYTES),

    CLIENT_NAME VARCHAR2 (240 BYTES),

    CUSTOMER_NO VARCHAR2 (240 BYTES),

    VALID_AMOUNT_MONTH1 NUMBER,

    VALID_UNITS_MONTH1 NUMBER,

    VALID_BUDGET_AMOUNT_MONTH1 NUMBER,

    VALID_BUDGET_UNITS_MONTH1 NUMBER,

    ATTRIBUTE1 VARCHAR2 (240 BYTES),

    ATTRIBUT2 VARCHAR2 (240 BYTES),

    NUMBER OF VALID_RATE

    );

    Control file

    Options (Errors = 10000, Skip = 3)

    DOWNLOAD THE DATA

    INFILE ' / home/appltest/Sheet1.csv'

    BADFILE "sample.bad."

    DISCARDFILE 'sample.dsc '.

    REPLACE

    IN THE TABLE sampl_table

    fields completed by «,»

    surrounded of possibly "" "

    trailing nullcols

    (

    client_name TANK NULLIF client_name = BLANKS "RTRIM(:customer_name)."

    customer_no NULLIF CHAR customer_no = BLANKS "RTRIM(:customer_no)."

    item_no NULLIF TANK item_no = BLANKS "RTRIM(:item_no)."

    valid_amount_month1 "to_number (: valid_amount_month1, '999,999,999.99')."

    valid_units_month1 "to_number (substr (: valid_units_month1, instr(:valid_units_month1,'$') + 1), '999,999,999.99')."

    valid_budget_units_month1 "to_number (: valid_budget_units_month1, '999,999,999.99')."

    valid_budget_amount_month1 "to_number (trim (substr (: valid_budget_amount_month1, instr(:valid_budget_amount_month1,'$') + 1)), '999,999,999.99')."

    valid_rate NULLIF CHAR valid_rate = BLANKS 'RTRIM(:valid_rate) '.

    )

    Sheet1.csv

    Name of the custCust #.Article no.Item DescCategoryAmount – month 1Units - month 1Act earlyAct earlyBudget - months 1Budget - unit - months 1Rate
    Name of the custCust #.Article no.Item DescCategoryAmount – month 1Units - month 1Act earlyAct earlyBudget - months 1Budget - unit - months 1Rate
    Name of the custCust #.Article no.Item DescCategoryAmount – month 1Units - month 1Act earlyAct earlyBudget - months 1Budget - unit - months 1Rate
    REYNU1001ABC001ABC RenyuABC82611
    REYNU11028ABC123ABCRenyu123ABC29514691
    REYNU21028ABC344ABC Renyu 344ABC227063351


    Get error below

    Sheet 1: Rejected - error on the table SAMPL_TABLE, column VALID_RATE.

    ORA-01722: invalid number

    Sheet 2: Rejected - error on the table SAMPL_TABLE, column VALID_RATE.

    ORA-01722: invalid number

    Sheet 3: Rejected - error on the table SAMPL_TABLE, column VALID_RATE.

    ORA-01722: invalid number

    Sheet 1: Rejected - error on the table SAMPL_TABLE, column VALID_AMOUNT_MONTH1 .

    ORA-01722: invalid number

    Sheet 2: Rejected - error on the table SAMPL_TABLE, column VALID_AMOUNT_MONTH1 .

    ORA-01722: invalid number

    Sheet 3: Rejected - error on the table SAMPL_TABLE column VALID_AMOUNT_MONTH1

    ORA-01722: invalid number

    Can you help me please?

    Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production

    Hello

    No sign of setting shaped or ' $' is seen in the data, which is the reason why I guess you used the conversions in the * ctl file.

    What is the problem with this symbol $ in the code?

    No problem with the ' $'-what I mean is that it is not necessary.

    Looking for him "$" field and exclude it from your text/number (SUBSTR) and if there is no "$" in your file, this additional training is not mandatory - why clutter up your code with unnecessary functions?

    Regarding the error you get, it is related to the format mask, you provide:

    Message #20:

    Select to_number (substr (146, instr(146,'$') + 1), '999,999,999.99') of double

    o/p: 146

    Select to_number (substr (1469, instr(1469,'$') + 1), '999,999,999.99') of double

    Error: ORA-01722: invalid number

    1. you must use "146" (text) and no 146 (number).

    2. ' 146' works because it "fits" the format mask you supplied: 999 999,999. 99. " but '1469' does not like the format mask expects one ',' as the delimiter of thousands, that is, "1 469'."

    Select to_number (substr (1, 469', instr('1,469','$') + 1), '999,999,999.99') twice;

    Similarly, in the #22 Post:

    to_number (substr (' 752,3308', instr ('752.3308', ' $') + 1), 999, 999 999,99') of double

    4 decimals are consistent with the format DP 2 mask.


    Simply remove all masks of format.

  • ORA-01722: invalid number

    I get the error: ORA-01722: invalid number during the execution of the SQL statement.

    SELECT

    TO_NUMBER (TO_CHAR ((TRUNC(:P_DATE1,'MM')-1), "MM")) LAST_MON

    OF THE DOUBLE

    Sanjay

    I'll guess that you write an APEX application.

    In the APEX, the variables are always strings.  If you want to interpret as dates, you should pack them with a call TO_DATE and a format mask.  Assuming that you stated your control APEX of date in MM/DD/YYYY format, it would mean that the SQL, you would need is

    SELECT
      TO_NUMBER(TO_CHAR((TRUNC( TO_DATE(:P_DATE1, 'MM/DD/YYYY'),'MM')-1),'MM')) LAST_MON
    FROM DUAL
    

    Of course, if you're just trying to extract the month to date and subtract 1, I just have

    SELECT extract( month from to_date( :p_date1, 'MM/DD/YYYY') ) - 1
    FROM dual
    

    Justin

  • ORA-01722: invalid number - when the last column has numbers that have a decimal separator

    Here are examples of data-

    FRT, 1.64, VAT, 23,36

    FRT, 1.64, VAT, 23,36

    When I try to convert 1.64 to_number everything is good, but when I do the same thing with 23,36 I get the following error

    ORA-29913: error in executing ODCIEXTTABLEFETCH legend

    ORA-01722: invalid number

    ORA-06512: at "SYS." ORACLE_LOADER', line 52

    I tried this query example

    Select to_number (CONSIGNMENT_NET_VALUE) as Col1 of DUMP_EXT

    Select to_number (CONSIGNMENT_NET_VALUE, '9999999999D' 99999', NLS_NUMERIC_CHARACTERS = ",". ") as Col1 DUMP_EXT-> 268906.1

    make the same mistake - any help greatly appreciated.

    T.

    Srini

    Try using:

    RECORDS DELIMITED BY newline

    Instead of:

    RECORDS DELIMITED BY '\n'


    on your table to create, in addition to just help to_number or to_number return with ' NLS_NUMERIC_CHARACTERS = ".," ' in your query, in the period before the comma as decimal separator comes before the grouping separator.

    What is probably happening is that your return to the line of the system data come from different East of your new line on the system that you load in.  You may need to experiment and

    Select dump (consignment_net_value) in the dump_ext;

    to determine what additional invisible characters, such as Chr (10) and Chr (13) can be added at the end of the number that you have to cut, so just using line feed does not work.  This is why it only happens with the numbers at the end of the line.

    Post edited by: BarbaraBoehmer

  • Regular expression for invalid number

    Hello world

    I use version oracle as follows:

    SQL > select * from v version $;

    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - production
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    AMT for 32-bit Windows: release 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production

    ------------------------------------------------------------------------

    I use a regular expression to replace invalid values in a table.

    I got oracle error 'ORA-01722 invalid number '.

    My query looks like this:

    SELECT DISTINCT

    MRC_KEY,

    PURPOSE_CD,

    RESIDENCE_DESC,

    TO_NUMBER (regexp_replace (ICAP_GEN_MADAPTIVE, "..?")) 0? 0? (\d+) [-.] ((?', '\1')) as ICAP_GEN_MADAPTIVE,

    Of

    MRRC_INT

    I don't know what are invalid values in the table, so I can write regexp accordingly.

    Any guidance is appreciated!

    Thanks in advance

    J

    Hello

    Whenever you have a problem, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.  View of the code which is not what you want can be useful, but there niot enough by itself.
    See the FAQ forum: https://forums.oracle.com/message/9362002

    Let's look at what you do:

    REGEXP_REPLACE (icap_gen_madaptive

    , '[+. ]' || -exactly 1 of these characters

    '?0?0?' || -up to 2 ' 0 '

    '(\d+)' || -some numbers (it comes to \1)

    '[-.]?'    -0 or 1 of these characters

    , '\1'

    )

    Is it really what you want?  A group of figures don't match, as the patten must start with a sign more, a point or a space.  You want to allow a decimal point at the beginning and at the end, as in "." 9. '?  If there are numbers before and after the decimal point, as in "1.2", you want only the digints before the comma?  You never said what you want, but I'm guessing that these are things that you don't want.

    If the pattern is found, this changes only the schema, so a string like "FU + 123 BAR" more than the model + 9 "" changed to "9" and the resulting string. "" "" FU9BAR"would be passed TO_NUMBER.

    If the pattern is not found, as in "FOO", nothing is changed, and the entire string is passed to TO_NUMBER.

    I suspect you want to use instead of REGEXP_REPLACE REGEXP_SUBSTR, or, if there is stuff to ignore before and/or after the number you want to include in the model, so that REGEXP_REPLACE will be replaced by nothing.

    This looks like a good argument to use the NUMBER of columns to store numbers.

  • How can I activate the software with an invalid number of adobe?

    Adobe gives me the invalid number to validate the software after that I entered the serial number it accepts. What should I do?

    1, this program has another forum http://forums.adobe.com/community/premiere/premierepro_previous

    2nd, read below for the version, you MUST download and install instead of 1.5

    CS2 (or earlier version) l http://helpx.adobe.com/x-productkb/policy-pricing/creative-suite-2-activation-end-life.htm activation server

  • Please help: instruction box - ORA-01722: invalid number error

    Hi all
    I am trying to use the Case statement to recode the status canceled in two groups
    "Reject" If the difference between the date of the first and the last date is less than 29 and
    'Accept' if the difference between the date of the first and the last date is greater than 30

    Here's my data 'test'

    STATUS FIRST_DATE LAST_DATE

    Transfer / / 10/08/2011-10/09/2011
    Mover 10/08/2011-15/09/2011
    Cancel the 16/09/2011 10/08/2011
    Cancel the 10/08/2011 5/09/2011

    Here's the syntax

    Select a.*,
    (CASE WHEN a.STATUS = 'Cancel' CAN (round(a.LAST_DATE-a.FIRST_DATE))
    0 OTHERWISE
    END CAN_DAYS),
    (BOX WHEN "CAN_DAYS" > 29 THEN "reject"
    WHEN "CAN_DAYS" < 30 THEN "accept."
    Reject_Accept END)
    try one

    The first CASE statement works very well and gives me this
    STATUS FIRST_DATE LAST_DATE CAN_DAYS

    Transfer 0 10/08/2011-10/09/2011
    Mover 0 10/08/2011-15/09/2011
    Cancel the 37 16/09/2011 10/08/2011
    Cancel the 26/10/08/2011 5/09/2011

    but the LATTER product ORA-01722: invalid number error. It's something to do with the type of data CAN_DAYS, Oracle does not see in the Numeric form I think.
    I want to see result
    STATUS FIRST_DATE LAST_DATE CAN_DAYS Reject_Accept

    Transfer 0 10/08/2011-10/09/2011
    Mover 0 10/08/2011-15/09/2011
    Accept to cancel 37 10/08/2011-16/09/2011
    Refuse to cancel the 26/10/08/2011 5/09/2011

    Could someone please help me fix the syntax?
    Thank you in advance,

    Hello

    The error is due to the fact that you are trying to compare "CAN_DAYS", which cannot be regarded as a number, a number.
    You can try this option for your results:

    select A.STATUS, A.FIRST_DATE, A.LAST_DATE,case
                                                when a.status ='Cancel' then round(a.last_date - a.first_date)
                                                else 0
                                                end as can_days,
                                                case
                                                when (a.status ='Cancel'  and round(a.last_date - a.first_date) > 29) then 'Reject'
                                                when (a.status ='Cancel'  and round(a.last_date - a.first_date)< 30) then 'Accept'
                                                else null
                                                end as Accept_Reject
    from test a 
    
  • We get a "invalid number" error when the Xref database of fill

    Hi all

    My table (XREF_DATA) target has the following parameters and its respective data types: -.

    XREF_TABLE_NAME
    XREF_COLUMN_NAME
    ROW_NUMBER
    VALUE
    IS_DELETED
    LAST_MODIFIED
    LAST_ACCESSED

    All are varchar2

    But when I am executing the interface and observing the results then this error pops up:-1722: 42000: java.sql.SQLException: ORA-01722: invalid number to the stadium
    Insert flow I$ Table(I$_XREF_DATA)

    I used CKM, LKMSql for Oracle and the incremental update of the IKM Oracle)


    My target table has all the varchar2 data type, then why it gives this error number invalid?



    Kind regards
    Sourav

    Hello

    You can copy the SQL code generated by ODI (for the stage which gives this error) and then try to run it through any SQL client like toad / developer sql etc.
    This will help you find erroneous data.

    Also is LAST_MODIFIED and LAST_ACCESSED have as VARCHAR2 data type? The name it seems that it is lying do DATE.

    Thank you
    Fati

  • Invalid number when reading a flat file

    Hello Experts,

    I have the following flat file format and I want to insert it into a table
    I have an error invalid number.

    How can I stop reading the file when it reaches the empty line before the grand total

    file
    ----------------------------------------------------------------------------------------------------------------------------------
    
                       TOTAL        PAID       TOTAL     EXPIRED       TOTAL    FRAC OUTSTANDING
                     WINNERS       TODAY        PAID       TODAY     EXPIRED   ROUND
        DRAW/SET      AMOUNT      AMOUNT      AMOUNT      AMOUNT      AMOUNT  AMOUNT      AMOUNT
    ------------ ----------- ----------- ----------- ----------- ----------- ------- -----------
        1/     1  6857068.00        0.00  5879902.00        0.00   977166.00    0.00        0.00
        2/     1  5907322.00        0.00  5463759.00        0.00   443563.00    0.00        0.00
        3/     1  7277181.00        0.00  6551708.00        0.00   725473.00    0.00        0.00
        4/     1 37503734.00        0.00 36656046.00        0.00   847688.00    0.00        0.00
        5/     1  4879934.00        0.00  4293514.00        0.00   586420.00    0.00        0.00
        6/     1 15604133.00        0.00 15172198.00        0.00   431935.00    0.00        0.00
        7/     1  4943514.00        0.00  4425254.00        0.00   518260.00    0.00        0.00
        8/     1  6493874.00        0.00  5745660.00        0.00   748214.00    0.00        0.00
        9/     1 23195487.00        0.00 22279945.00        0.00        0.00    0.00   915542.00
        10/    1  5480445.00        0.00  4981615.00        0.00        0.00    0.00   498830.00
        11/    1  5421101.00        0.00  4852814.00        0.00        0.00    0.00   568287.00
        12/    1 22644465.00        0.00 21987329.00        0.00        0.00    0.00   657136.00
        13/    1  6310425.00        0.00  5582127.00        0.00        0.00    0.00   728298.00
        14/    1  5986847.00        0.00  5471429.00        0.00        0.00    0.00   515418.00
        15/    1  6699299.00        0.00  6080687.00        0.00        0.00    0.00   618612.00
        16/    1  7549513.00        0.00  6842058.00        0.00        0.00    0.00   707455.00
        17/    1 43951014.00        0.00 42538841.00        0.00        0.00    0.00  1412173.00
        18/    1  6275029.00        0.00  5608261.00        0.00        0.00    0.00   666768.00
        19/    1 34023432.00      100.00 33066516.00        0.00        0.00    0.00   956916.00
        20/    1  5496324.00        0.00  5029237.00        0.00        0.00    0.00   467087.00
        21/    1  5791146.00        0.00  5281256.00        0.00        0.00    0.00   509890.00
        22/    1  7121128.00        0.00  6419500.00        0.00        0.00    0.00   701628.00
        23/    1 36121507.00        0.00 35211831.00        0.00        0.00    0.00   909676.00
        24/    1 10137379.00        0.00  9660197.00        0.00        0.00    0.00   477182.00
        25/    1  4267656.00      200.00  3875040.00        0.00        0.00    0.00   392616.00
        26/    1  8656241.00      561.00  7744762.00        0.00        0.00    0.00   911479.00
        27/    1 10023865.00      400.00  9070015.00        0.00        0.00    0.00   953850.00
        28/    1 15201340.00     1188.00 13795352.00        0.00        0.00    0.00  1405988.00
        29/    1 83052341.00     2773.00 80673373.00        0.00        0.00    0.00  2378968.00
        30/    1  7137232.00     1000.00  6459875.00        0.00        0.00    0.00   677357.00
        31/    1 25472826.00     1700.00 24487312.00        0.00        0.00    0.00   985514.00
        32/    1  5679593.00     4398.00  5094378.00        0.00        0.00    0.00   585215.00
        33/    1 19360140.00    32659.00 18144162.00        0.00        0.00    0.00  1215978.00
        34/    1  5350117.00  1059167.00  1059167.00        0.00        0.00    0.00  4290950.00
    
    GRAND TOTAL  ########.##  1104146.00 ########.##        0.00  5278719.00    0.00 25108813.00
    
    End of Report
    code
    declare
    l_start_file_name varchar2(50) := 'liab_report_summary_p008_c';
    l_end_file_name varchar2(50)   := '_english.rep';
    l_file_name varchar2(100);
    l_sql varchar(32767);
    refresh_cdc varchar2(10) := '00540';
    
    Begin
    
    l_file_name := l_start_file_name||REFRESH_CDC||l_end_file_name;
    
     l_sql := 'create or replace directory GTECHFILES as ''/ftpfiles/gtechfiles/acct_'||REFRESH_CDC||'''';
      execute immediate l_sql;
    
    
    l_sql :=  ' CREATE TABLE LOTO_LIABILITY_REPORT_temp             '||
              ' (                                                   '||
              '  draw_number       varchar2(50),                    '||
              '  total_winners_amt number,                          '||
              '  paid_today_amt    number,                          '||
              '  total_paid_amt    number,                          '||
              '  expired_today_amt number,                          '||
              '  total_expired_amt number,                          '||
              '  frac_round_amt    number,                          '||
              '  outstanding_amt   number                           '||
              ' )                                                   '||
              ' ORGANIZATION EXTERNAL                               '||
              '   (  TYPE ORACLE_LOADER                             '||
              '     DEFAULT DIRECTORY GTECHFILES                    '||
              '     ACCESS PARAMETERS                               '||
              '       ( records delimited by newline                '||
              '      LOGFILE TEMPDIR:''loto_liability_report.log''  '||
              '      SKIP 8                                         '||            
              '      FIELDS LDRTRIM                                 '||
              '      MISSING FIELD VALUES ARE NULL                  '||
              '       (                                             '||
              '  draw_number       (1:11)  char(11),                '||
              '  total_winners_amt (14:24) char(11),                '||
              '  paid_today_amt    (26:36) char(11),                  '||
              '  total_paid_amt    (38:48) char(11),                  '||
              '  expired_today_amt (50:60) char(11),                  '||
              '  total_expired_amt (62:72) char(11),                  '||
              '  frac_round_amt    (74:80) char(11),                  '||
              '  outstanding_amt   (82:92) char(11)                   '||
              '       )                                             '||
              '   )                                                 '||
              '     LOCATION ('''||l_file_name||''')                '||
              ' )                                                   '||
              ' REJECT LIMIT UNLIMITED                              '||
              ' NOPARALLEL                                          '||
              ' NOMONITORING                                        ';
    
             execute immediate l_sql; 
     
     l_sql := ' insert into LOTO_LIABILITY_REPORT '||
     ' ( draw_number             , '||
     '   total_winners_amt       , '||
     '   paid_today_amt          , '||
     '   total_paid_amt          , '||
     '   expired_today_amt       , '||
     '   total_expired_amt       , '||
     '   frac_round_amt          , '||
     '   outstanding_amt         , '||
     '   source                  , '||
     '   inserted_DATE           , '||
    -- '   UPLOADED                 ,'||
     '   CDC                       '||
     ' )                           '||
     '   SELECT                    '||
     '       draw_number    , '||
     '       TO_NUMBER(total_winners_amt,''999,999,999.00'') total_winners_amt,  '||
     '       TO_NUMBER(paid_today_amt,''999,999,999.00'') paid_today_amt,        '||
     '       TO_NUMBER(total_paid_amt,''999,999,999.00'') total_paid_amt,        '||
     '       TO_NUMBER(expired_today_amt,''999,999,999.00'') expired_today_amt,        '||
     '       TO_NUMBER(total_expired_amt,''999,999,999.00'') total_expired_amt,        '||
     '       TO_NUMBER(frac_round_amt,''999,999,999.00'') frac_round_amt,        '|| 
     '       TO_NUMBER(outstanding_amt,''999,999,999.00'') outstanding_amt,        '||  
     '       '''||l_file_name                                       ||''', '||
     '       sysdate                                                     , '||
     --'     ''N''                                                         , '||
             refresh_cdc                                                    ||
     '    FROM                                                             '||
     '       LOTO_LIABILITY_REPORT_temp                                              ';
    
     
        dbms_output.put_line(l_sql);
             execute immediate l_sql;           
             
    ll_sql :='drop table LOTO_LIABILITY_REPORT_temp';
     
            execute immediate l_sql;
    
    exception
    when others then
    rollback;
    l_sql :='drop table LOTO_LIABILITY_REPORT_temp';
    execute immediate l_sql;
    debug_message('LOTO_LIABILITY_REPORT_temp_UPLOAD/'||REFRESH_CDC,'Unexpected Error '||sqlerrm);
    END LOTO_LIABILITY_REPORT;
    any help would be greatly appreciated.

    Thank you
    Kevin

    Hello

    You can do this:
    Add this condition in the table definition
    WHEN LOAD (total_winners_amt! = "#.") "#" and total_paid_amt! =" ###. "#" and draw_number! = BLANKS)
    and do it for each column that can have this value...

    CREATE TABLE WEBUSER.LOTO_LIABILITY_REPORT_TEMP
    (
      DRAW_NUMBER        VARCHAR2(50 BYTE),
      TOTAL_WINNERS_AMT  NUMBER,
      PAID_TODAY_AMT     NUMBER,
      TOTAL_PAID_AMT     NUMBER,
      EXPIRED_TODAY_AMT  NUMBER,
      TOTAL_EXPIRED_AMT  NUMBER,
      FRAC_ROUND_AMT     NUMBER,
      OUTSTANDING_AMT    NUMBER
    )
    ORGANIZATION EXTERNAL
      (  TYPE ORACLE_LOADER
         DEFAULT DIRECTORY GTECHFILES
         ACCESS PARAMETERS
           ( records delimited by newline
                    LOGFILE GTECHFILES:'loto_liability_report.log'
                    SKIP 8
                    LOAD WHEN (total_winners_amt!="########.##" and total_paid_amt!="########.##" and draw_number != BLANKS)
                    FIELDS LDRTRIM
                    MISSING FIELD VALUES ARE NULL
                     (
                draw_number       (1:11)  char(11),
                total_winners_amt (14:24) char(11),
                paid_today_amt    (26:36) char(11),
                total_paid_amt    (38:48) char(11),
                expired_today_amt (50:60) char(11),
                total_expired_amt (62:72) char(11),
                frac_round_amt    (74:80) char(7),
                outstanding_amt   (82:92) char(11)
                     ) 
    
                  )
         LOCATION (GTECHFILES:'test.txt')
      )
    REJECT LIMIT UNLIMITED
    NOPARALLEL
    NOMONITORING;
    

    You'll get in the log file:

     LOG file opened at 06/28/10 22:16:51
    
    Field Definitions for table LOTO_LIABILITY_REPORT_TEMP
      Record format DELIMITED BY NEWLINE
      Data in file has same endianness as the platform
      Rows with all null fields are accepted
      Load when ((TOTAL_WINNERS_AMT != ########.##) AND ((TOTAL_PAID_AMT != ########.##) AND (DRAW_NUMBER != BLANKS)))
    
      Fields in Data Source: 
    
        DRAW_NUMBER                     CHAR (11)
          Record position (1, 11)
          Trim whitespace same as SQL Loader
        TOTAL_WINNERS_AMT               CHAR (11)
          Record position (14, 24)
          Trim whitespace same as SQL Loader
        PAID_TODAY_AMT                  CHAR (11)
          Record position (26, 36)
          Trim whitespace same as SQL Loader
        TOTAL_PAID_AMT                  CHAR (11)
          Record position (38, 48)
          Trim whitespace same as SQL Loader
        EXPIRED_TODAY_AMT               CHAR (11)
          Record position (50, 60)
          Trim whitespace same as SQL Loader
        TOTAL_EXPIRED_AMT               CHAR (11)
          Record position (62, 72)
          Trim whitespace same as SQL Loader
        FRAC_ROUND_AMT                  CHAR (7)
          Record position (74, 80)
          Trim whitespace same as SQL Loader
        OUTSTANDING_AMT                 CHAR (11)
          Record position (82, 92)
          Trim whitespace same as SQL Loader
    KUP-04102: record 41 discarded from file c:\temp\test.txt
    KUP-04102: record 42 discarded from file c:\temp\test.txt
    KUP-04102: record 43 discarded from file c:\temp\test.txt
    KUP-04102: record 44 discarded from file c:\temp\test.txt
    

    ORA-01722 exception has disappeared...
    be very vigilant, you also should jump 6 instead of spend 8...

  • ORA-01722: invalid number error

    Hello Experts,

    I'm having a problem downloading a text file.

    It works ok for some files but for some files I get the following error

    ORA-01722: invalid number

    Anyone know what could be the reason of this please. Just tell me what you need more details.

    Thank you
    Kevin

    Hello
    OK now the image grows.
    So, you dynamically create the insert statement, replace the comma with nothing and then insert.
    The system from which you found the data file is this number of column type sales NET in this system or even stores characters.
    Assuming that the data type is a generic system remote here is the scenarios where it will fail

    select to_number(replace('23 ,380.00 ',',','') )  from dual -- not ok observe before comma
    select to_number(replace('a23,380.00 ',',','') )  from dual -- not ok
    select to_number(replace('23,380. 00 ',',','') )  from dual -- not ok observe space after decinal
    

    My Suggestion,
    take the file upload in a temporary table using sqlldr.
    Next moment, you have the incorrect records.
    Keep an eye on them.
    In addition, the use of external tables is an option where you can log records failed.

    Kind regards
    Bobin

  • multi select sql problem - ORA-01722: invalid number

    Hello

    I have a multi select list and when I select only one item it works perfectly, but if I select several items, it gives an error. The sql statement is as below:

    SELECT * VIEW WHERE INSTR (': ' |: P1_ID |': ',' :'||) ID: ': ') > 0

    and I get the following error:

    ORA-01722: invalid number


    Here is some information on the display:
    Name of the column
    Data Type (NUMBER)
    Nullable (No.)

    Hello

    I just try this in my own sandbox application to sand...

    Create report area with

    SELECT t_id, t_code
    FROM t_table
    WHERE INSTR(':'||TO_CHAR(:P1_ID)||':', ':'||TO_CHAR(t_id)||':') > 0
    

    as the source.

    Create multiple selection list

    SELECT t_code, t_id
    FROM t_table
    

    as the source.

    Create a button with application of GO, subordinate the region report on request = GB.

    Now, I run the page, select a value in the list, click on go - region displays with the correct result.

    Now I run the page, select several values in the list, click on go - region displays with good results.

    What is your scenario? If so, it works for me...

    See you soon

    Ben
    http://www.munkyben.WordPress.com
    Don't forget to mark the answers useful or correct ;)

  • ORA-01722: invalid number calculation error during the treatment.

    My version of the APEX is Application Express 4.2.6.00.03

    I imported apex application 4.0.2 and his object of decision-making support in my apex.

    Its installed successfully.

    But when I try to run this application it show me this error:

    ORA-01722: invalid number calculation error during the treatment.

    Thank you guys for your help.

    I found the solution.

    There was a problem in the authentication scheme.

    I called function as return function_name in 4.0.2

    but in the Apex 4.2.6 to call a function word return is not necessary.

    He was throwing the error caused that Word back.

Maybe you are looking for

  • iTunes movie does not show on the ipad after download

    When I rent a movie via itunes on my ipad air 2 it runs it through the treatment of download, but the film does not show in one of my shopping list

  • Satego X 200 21 d - how to get the new motherboard

    Hello I try to repair the laptop my father (Satego X 200 - 21 d). The motherboard is obviously default (does not start).How can I get a new one? Toshiba still selling these parts? Reference of the motherboard is K000055260 (I discovered, this motherb

  • HP pavilion 500-098: hp pavilion 500-098 graphics card upgrade

    I'm updating my video card present, a Radeon HD 8570 on my hp pavilion 500-098 office. I think it's a PCI card? It's because I'm trying to connect to my new monitor that requires a Display Port. I would appreciate any advice. Thank you

  • Satellite L30 PSL33E - new HARD disc but startup fails

    Laptop Satellite L30-psL33E... .total HARD drive failed Installed the new HARD drive, hitachi hts541616j9sa00.Start Recovery CD, this completes then the computer shuts down. I restart and on screen, it is said wait while windows is loading for the fi

  • can I update my iPhone 4S with IOS9

    I cling to the coast of the update of the software update IOS 9 on my iPhone 4s, until I have a good idea whether the phone will work properly thereafter. Everyone was a success with the update, and you recommend? I have no problem of function at thi