Query SQL and Exception ORA-01722

Hello

I have a table called t_lookup that contains three columns of the argument lookup_value, Description and Lookup_Type they are all of type varchar2. If I run the query, its working fine below

SELECT *.
FROM (SELECT lookup_value
*, To_Number (Description) Dd *.
OF t_Lookup
WHERE Lookup_Type = 'CALENDAR') Tab ;

Here is the result

Lookup_value argument... DD
---------------------------------------.
January... 1
February... 2
March......................... 3
April........................... 4
May........................... 5
June.......................... 6
July........................... 7
August... 8
September... 9
October... 10
November... 11
December... 12


But when I run

SELECT *.
FROM (SELECT lookup_value
*, To_Number (Description) Dd *.
OF t_Lookup
WHERE Lookup_Type = 'CALENDAR') tab
AND Dd = 9;

then he throws exception ORA

ORA-01722: invalid number

Can someone help me on this in order to understand the cause of this problem? Oracle server that I use is "Oracle9i Release 9.2.0.8.0".

Thank you

I guess it is expected that some of the descriptions will have non-numeric data, right?

Assuming that this is the case, the success or failure of the request depends on how the optimizer can choose to run your query. If it happens to run TO_NUMBER function before it filters a row with non-numeric data, you will get an error. When chasing the TO_NUMBER filtering all lines with non-numeric data, the query will be successful. Because query plans are subject to change, especially when you finally upgrade, you probably don't want just to find a SQL query that works, you will need to make sure that the query plan never changes or that the query is formulated in such a way that it will never fail.

My first thought would be to know if you really need store digital data in a field of VARCHAR2 in the first place. I guess it's a kind of generic lookup table (which causes a series of questions, what is a). Can we at least keep string, date and numbers given in separate columns?

Except, you can create your own function to PL/SQL that converts a string to a number and catches the exception?

CREATE OR REPLACE FUNCTION my_to_number( p_arg IN varchar2 )
  RETURN NUMBER
IS
  l_num NUMBER;
BEGIN
  l_num := to_number( p_arg );
  RETURN l_num;
EXCEPTION
  WHEN others THEN
    RETURN NULL;
END;

Who will ensure that the request is successful, regardless of the plan. Note that you probably want to catch just the error ORA-01722, not others, in your actual code - this is just a sample.

Except that, you will need to do something to strengthen stability in the query plan. A stored outline, which forces the query to use the query plan that does not generate an error.

Justin

Tags: Database

Similar Questions

  • catupgrd. SQL and ORA-01722

    Hello
    11 G R1
    When you run catupgrd.sql, I get:
    DOC>#######################################################################
    DOC>#######################################################################
    DOC > the following statement will cause an "ORA-01722: invalid number."
    DOC > error if the current time zone version file is not identical to the
    DOC > version in the database to be upgraded. The statement will cause a
    DOC > error ORA-00942 or ORA-00904 if the utility of pre-upgrade (utlu111i.sql)
    DOC > has not be executed to update the database table $ registry to include the existing
    DOC > the timezone database version.
    DOC >
    DOC > Shutdown ABORT and return to the original ORACLE_HOME. Then apply
    DOC > patch version zone required to the original ORACLE_HOME
    DOC > before attempting to upgrade. Restart utlu111i.sql after the application
    DOC > patch to save the new version of the timzone file in the
    DOC > table of the registry database $.
    DOC >
    DOC>#######################################################################
    DOC>#######################################################################
    DOC > #.
    SELECT TO_NUMBER ('MUST_BE_SAME_TIMEZONE_FILE_VERSION')
    *
    ORA-01722: invalid number

    But my version of zone is 4:
    SQL > select * from v$ timezone_file;

    FILENAME VERSION
    ------------ ----------
    timezlrg.dat 4

    And:
    SQL > select status from v$ instance;

    STATUS
    ------------
    MIGRATE FROM OPEN

    SQL > show user
    USER "SYS".

    SQL > select tablespace_name, status of dba_tablespaces;

    STATUS TABLESPACE_NAME
    ------------------------------ ---------
    ONLINE SYSTEM
    UNDOTBS1 ONLINE
    SYSAUX ONLINE
    TEMP ONLINE
    USERS ONLINE
    ONLINE EXAMPLE

    Any help?
    Thank you.

    Hmm, I think that the message would be:

    DOC>#######################################################################
    DOC>#######################################################################
    DOC > the following statement will cause an "ORA-01722: invalid number."
    DOC > error if the current time zone version file is not identical to the
    DOC > version in the database to be upgraded. The statement will cause a
    DOC > error ORA-00942 or ORA-00904 if the utility of pre-upgrade (utlu111i.sql)
    DOC > has not be executed to update the database table $ registry to include the existing
    DOC > the timezone database version.
    DOC >
    DOC > Shutdown ABORT and return to the original ORACLE_HOME. Then apply
    DOC > patch version zone required to the original ORACLE_HOME
    DOC > before attempting to upgrade. Restart utlu111i.sql after the application
    DOC > patch to save the new version of the timzone file in the
    DOC > table of the registry database $.
    DOC >
    DOC>#######################################################################
    DOC>#######################################################################
    DOC > #.

  • Exception ORA when accepting SQL Tuning Set

    Hello

    RDBMS version: 11.2.0.1.0 & 11.2.0.4.0

    OS: OEL 5 (64-bit)

    I am creating a SQL tuning set and get both to do exception below. Tried to search on the forums also with the exception of the ORA, but unable to get any resolution for this exception ORA.

    The following awards were made: -.

    GRANT CREATE ANY SQL PROFILE TO SCOTT;
    GRANT DROP ANY SQL PROFILE TO SCOTT;
    GRANT ALTER ANY SQL PROFILE TO SCOTT;
    GRANT ADVISOR TO SCOTT;
    GRANT ADMINISTER SQL MANAGEMENT OBJECT TO SCOTT;
    grant execute on dbms_spm to SCOTT;
    grant administer sql management object to SCOTT;
    
    

    DECLARE
      my_task_name VARCHAR2(30);
      my_sqltext CLOB;
      my_sqlprofile_name VARCHAR2(4000);
    BEGIN
      my_sqltext   := 'SELECT * FROM emp';
      my_task_name := DBMS_SQLTUNE.CREATE_TUNING_TASK(sql_text => my_sqltext, user_name => 'SCOTT', scope => 'COMPREHENSIVE', time_limit => 60, task_name => 'my_sql_tuning_task3', description => 'Demo Task to tune a query');
      DBMS_SQLTUNE.EXECUTE_TUNING_TASK( task_name => 'my_sql_tuning_task3');
      my_sqlprofile_name := DBMS_SQLTUNE.ACCEPT_SQL_PROFILE (task_name =>'my_sql_tuning_task3', name => 'my_sql_profile');   -- Culprit for the exception
      --dbms_output.put_line(my_sqlprofile_name);
    END;
    /
    
    Error report -
    ORA-13786: missing SQL text of statement object "1" for tuning task "my_sql_tuning_task3"
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_SQLTUNE_INTERNAL", line 16255
    ORA-06512: at "SYS.PRVT_SQLPROF_INFRA", line 31
    ORA-06512: at "SYS.DBMS_SQLTUNE", line 7133
    ORA-06512: at line 4
    13786. 00000 -  "missing SQL text of statement object \"%s\" for tuning task \"%s\""
    *Cause:    The user attempted to accept SQL profile for an object
               that has not a SQL text associated to it.
    *Action:   Check the identifier of the object and retry the operation.
    
    
    

    Would be really grateful if someone could point me in the right direction here.

    TIA...

    Personally, I wouldn't bother with a task of setting.

    If you are lucky who will recommend a sql profile based on adjustments of cardinality which may or may not be effective.

    I would just use either the COE_XFR_SQL_PROFILE. SQL script SQLT ( doc-id 1487302.1Support) or use SQL Plan baseline to apply the previous execution plan. The latter has the advantage of being able to make an evolution controlled all plans potentially better which would otherwise be generated.

    You can choose the older, better plan AWR in the same database or a different database, and then transport it.

  • java.lang.Exception: ORA-01017: name of user and password invalid. connection refused - wait_bottlenecks

    Hello

    I have been using OEM for the monitoring of the database. Recently, I've seen more error on screen

    java.lang.Exception: ORA-01017: name of user and password invalid. connection refused - wait_bottlenecks

    So I reset password with the same value to reopen. I still get this error.


    When I try to sign in with the same password in sqlplus, I get same error also.


    SQL > alter user DBSNMP identified by the values '-';

    Modified user.

    SQL > connect DBSNMP.

    ERROR:

    ORA-01017: name of user and password invalid. connection refused


    I don't know why I'm not able to login with the same password I used to change the statement.


    Thanks for the help in advance.

    Let's not your syntax.

    When you say 'identified by values' you tell Oracle 'this is not the password, but it is a salted and hashed password.

    Do not use 'values '.

    Technically,-is not a password valid, so I'll use it valid to demonstrate:

    In 12.1.0.2, it will not allow you to use '-' because this isn't a valid hash value, so I can't prove that it works, but you get the idea

    SQL> grant create session to foo;                     
    
    Grant succeeded.                                     
    
    SQL> conn foo/aaa$
    Connected.
    SQL> conn / as sysdba
    Connected.
    SQL> drop user foo cascade;                           
    
    User dropped.                                         
    
    SQL> create user foo identified by values 'aaa$';
    create user foo identified by values 'aaa$'
    *
    ERROR at line 1:
    ORA-02153: invalid VALUES password string             
    
    SQL> create user foo identified by aaa$;             
    
    User created.                                         
    
    SQL> alter user foo identified by values 'aaa$';
    alter user foo identified by values 'aaa$'
    *
    ERROR at line 1:
    ORA-02153: invalid VALUES password string             
    
    SQL> alter user foo identified by values '---';
    alter user foo identified by values '---'
    *
    ERROR at line 1:
    ORA-02153: invalid VALUES password string
    
  • SQL * Loader - rejected records - error on table ORA-01722: invalid number

    Get the following errors:

    Please tell me where I'm wrong?
    The log file and extracts the data file with the control file is attached.
    Also guide me please how I can download 4900 files at once?

    -------------------------------------
    SQL * Loader: release 11.1.0.7.0 - Production on Fri 14 Oct 03:06:06 2011

    Copyright (c) 1982, 2007, Oracle. All rights reserved.

    Control file: sample.ctl
    Data file: Cities.csv
    Bad leadership: Cities.bad
    Discard File: none is specified

    (Allow all releases)

    Number of loading: ALL
    Number of jump: 0
    Authorized errors: 50
    Link table: 64 lines, maximum of 256000 bytes
    Continuation of the debate: none is specified
    Path used: classics

    Table CITY, loaded from every logical record.
    Insert the option in effect for this table: INSERT

    Column Position Len term Encl. Datatype name
    ------------------------------ ---------- ----- ---- ---- ---------------------
    FIRST ID *, CHARACTER
    35. ACCORDING TO NAME, ' CHARACTER
    COUNTRYCODE 3, ' CHARACTER
    THE NEXT POPULATION * CHARACTER WHT

    Sheet 1: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 2: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 3: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Folder 4: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 5: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 6: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 7: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 8: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    File 9: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Case 10: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Factsheet 11: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 12: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    File 13: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Fact sheet 14: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Fact sheet 15: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 16: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    File 17: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 18: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    File 19: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 20: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 21: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Account 22: rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 23: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record number of 24: rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 25: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Fact sheet 26: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Fact sheet 27: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 28: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 29: rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 30: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record of 31: rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    • Statement 32: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 33: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Page 34: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 35: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 36: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 37: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 38: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 39: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 40: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 41: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Page 42: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 43: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 44: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 45: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    • Statement 46: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 47: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 48: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 49: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Page 50: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 51: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number


    NUMBER of MAXIMUM ERRORS EXCEEDED - above the statistics reflect partial performance.

    CITY table:
    0 rows successfully loaded.
    51 lines not filled due to data errors.
    0 rows not loading because all WHEN clauses were failed.
    0 rows not populated because all fields are null.


    The space allocated to bind table: 35840 bytes (64 lines)
    Bytes of read buffer: 1048576

    Total logical records ignored: 0
    Total logical records read: 64
    Total rejected logical records: 51
    Total logical records ignored: 0

    Run started on Fri 14 Oct 03:06:06 2011
    Run finished Fri Oct 14 03:06:12 2011

    Time was: 00:00:06.18
    Time processor was: 00:00:00.03



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

    my control file (sample.ctl):

    Load data infile 'Cities.csv '.
    in the town of table
    fields completed by «,»
    (external id integer,
    char (35) name box by ' ', '
    CountryCode tank (3) box by ' ', '
    external population integer terminated by '\n '.
    )

    my data (Cities.csv) file (it contains 4900 documents, but I show 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!

    Watch when I have a little change your database as follows

    1,'Kabul','AFG',1780000
    2,'Qandahar','AFG','237500'
    3,'Herat','AFG','186800'  
    

    I got the same error (last 2 rows rejected for the same number invalid error)

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

    Value of the population within the data file must be a number

    Best regards

    Mohamed Houri

  • 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 Exception-need help

    CREATE OR REPLACE PROCEDURE BILLING_NOTIFY.ComposeTextPopUPMessageinMC)
    pi_NAME IN varchar2,
    pi_SCN IN varchar2,
    pi_ACCOUNTBALANCE IN varchar2,
    pi_OFFERAMOUNT IN varchar2,
    pi_DUEDATE IN varchar2,
    pi_FREQ in numbers
    )
    IS
    po_error_code NUMBER;
    e_exp EXCEPTION;
    v_MsgTemplate varchar2 (5000);

    BEGIN

    Select MsgTemplate in the notification_MessageTemplate v_MsgTemplate where MsgTypeId = 1;

    insert into notification_message (clientId, messageId, payload, updated, frequency)
    VALUES (pi_SCN, 1, replace (Replace (replace (Replace ())))
    Replace (v_MsgTemplate, '(Name)', Upper (pi_NAME)),
    ('(SCN)', cast (pi_SCN as varchar2 (15)));
    ('(AccountBalance)', cast (floor (pi_ACCOUNTBALANCE) as varchar2 (15)));
    ('(OfferAmount)', cast (floor (pi_OFFERAMOUNT) as varchar2 (15)));
    ('(LastChargedDate)', to_char(pi_DUEDATE,'MM-DD-YYYY'));
    SYSDATE, pi_FREQ);



    COMMIT;


    END;
    /


    These are my entry values:

    PI_NAME: = 'RAJ ';
    PI_SCN: = '200500';
    PI_ACCOUNTBALANCE: = '123';
    PI_OFFERAMOUNT: = '122';
    "PI_DUEDATE: = DECEMBER 12, 2005;
    PI_FREQ: = 1;

    The value of v_MsgTemplate is
    "Sir (Madam).
    ID of the Subscriber: (SNA)
    The balance of your account is Rs. (AccountBalance)
    Please minimum recharge of Rs. (OfferAmount) before (LastChargedDate)
    To reload please call BIG TV Customer Care on 1800 200 9002.
    Thank you very much. »


    My SP Comoles without errors, but when I try to run the MS using the above values get the following errors.



    ORA-01722: invalid number
    ORA-06512: at "BILLING_NOTIFY.COMPOSETEXTPOPUPMESSAGEINMC", line 23
    ORA-06512: at line 17 level

    Pls help me to correct my mistake.

    If pi_DUEDATE is varchar2 and the data coming out as customize date format as-> MM/DD/YYYY, then remove only to_char doesn't solve the problem.

    In this case, op must use to_date with same format mask or else as you have suggested to make the data of the argument of type date.

    select to_date('12/12/2005','MM/DD/YYYY') from dual;
     
    

    Kind regards.

    LOULOU.

  • 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 PL/SQL: numeric string or the error value

    Hi people;

    I have an error with this request:
    SELECT SEQ_ENTITE.nextval, ENT_CODE_ENT, ENT_GPL_ID, TO_NUMBER('2012')+1, 
         pkg_etl_fdx.f_getseqexe('LPG_TYE', 'TYE_CODE_CON', ENT_CODE_TEN, 'TYE_SEQ', TO_NUMBER('2012')),
         ENT_LIB_ENT, ENT_SEUIL, 'O', 0, 0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, ENT_CODE_UNI, ENT_CODE_MERE, ENT_IND_FIN, 0,
         0, 0, ENT_NIVEAU, ENT_CODE_TEN, CHAR_TO_LABEL('EXERCICE', 'PUB:EXE'||TO_NUMBER('2012')+1||':'), OLS_GRP
         FROM ENTITE
         WHERE ENT_OLS_EXE = TO_NUMBER('2012');
    How to fix the PL/SQL ORA-01722: numeric value or error string?

    The description of the entity table:
    desc entite
    Nom           NULL     Type              
    ------------- -------- ----------------- 
    ENT_SEQ       NOT NULL NUMBER(38)        
    ENT_CODE_ENT  NOT NULL VARCHAR2(6 CHAR)  
    ENT_GPL_ID    NOT NULL NUMBER(10)        
    ENT_OLS_EXE   NOT NULL NUMBER(38)        
    ENT_TYE_SEQ            NUMBER(38)        
    ENT_LIB_ENT            VARCHAR2(40 CHAR) 
    ENT_SEUIL              NUMBER(3)         
    ENT_AUTO_DEP           VARCHAR2(1 CHAR)  
    ENT_TOT_REP            FLOAT(126)        
    ENT_TREC_VEN           FLOAT(126)        
    ENT_TREC_INT           FLOAT(126)        
    ENT_RPT_ANT            FLOAT(126)        
    ENT_TOT_VEN            FLOAT(126)        
    ENT_CUM_REP            FLOAT(126)        
    ENT_CREC_INT           FLOAT(126)        
    ENT_CRPT_ANT           FLOAT(126)        
    ENT_CCRE_RCU           FLOAT(126)        
    ENT_TOT_ENG            FLOAT(126)        
    ENT_TOT_FAC            FLOAT(126)        
    ENT_TDEP_INT           FLOAT(126)        
    ENT_TOT_DEM            FLOAT(126)        
    ENT_TOT_RES            FLOAT(126)        
    ENT_CODE_UNI           VARCHAR2(6 CHAR)  
    ENT_CODE_MERE          VARCHAR2(6 CHAR)  
    ENT_IND_FIN            VARCHAR2(1 CHAR)  
    ENT_TOT_ATT            FLOAT(126)        
    ENT_CUM_ATT            FLOAT(126)        
    ENT_CUM_REA            FLOAT(126)        
    ENT_NIVEAU             NUMBER(1)         
    ENT_CODE_TEN           VARCHAR2(2 CHAR)  
    OLS_EXERCICE           NUMBER(10)        
    OLS_GRP                NUMBER(10)   
    Thank you.
    select  'PUB:EXE'|| to_char(TO_NUMBER('2012')+1 )||':' from dual
    

    Kind regards
    Gena

  • Help of query SQL - inner joins and the separate results

    Hello

    ASP VB, SQL Server

    I have a structure of data base with 3 tables - users, albums and photos. each user has a identifier unique, each record has a unique albumid and also contains a column with the user name. each record in the photo has a unique id so that store the user name and the album in which the image belongs.

    I'm writing a query that returns a list of the albums for a particular user (based on a user name query string) and who will also bring back the id of the first record in the table for each of these albums photo.

    the closest I get is to run a query to select albumid albums where userid = varuserid with a join internal on the pictures table to remove the photo ID - problem I then it comes out all the photos from the photos table where userid = varuserid, so when I do a repeat region to display a list of albums for a certain user It produces a list of all the photos where userid = varuserid

    I really want to return just a list of ID album based on the username variable, but also to return the first record in the table of photos for each of these albumids

    I tried different combinations of inner joins, select distinct etc but no joy.

    any suggestion would be appreciated as am floundering here...




    First, you must define 'first' with regard to the photos. Is there a
    timestamp? They are numbered inside the album? Do you really care who is
    "first", or do you want simply a shot? You also neglected to indicate if they are
    empty photo albums have been allowed. I assumed that the empty albums are not
    allowed.

    Whatever you decide, the answer will be similar.
    SQL Server tends to get better results with joins with subqueries. You will have
    See such a written request more often with subqueries, and there isn't
    nothing wrong with that, but I'll use a join on a derived table. I have
    have not all column names (hint, hint), so I made them, but the
    Comments should help out you.

    SELECT A.Title, P.PhotoID, P.Caption, A.AlbumID, P.ImagePath
    FROM dbo. A albums
    -build a table derived, consisting of photo ID lowest for each
    album.
    INNER JOIN (SELECT AlbumID, MIN (PhotoID) AS FirstPhoto FROM dbo. Photos
    AlbumID GROUP) AS PM WE A.AlbumID = PM. AlbumID
    -details of the photo for the photo shown in the table above
    INNER JOIN dbo. Photos P on A.AlbumID = P.AlbumID AND
    H. FirstPhoto = P.PhotoID
    User A.UserID ='some WHERE '

    "tedstar" wrote in message
    News:ee4pfn$de$1@forums. Macromedia.com...
    > I am writing a query that returns a list of the albums for a
    > particular user (based on a user name query string) and also bring
    > return
    > the id of the first record in the table for each of these albums photo.

  • Query, PL/SQL and V$ SESSION.sql_address

    I am running a procedure on a database of GR 11, 2 through a PL/SQL script in Linux-side SQLPlus. The procedure makes an insertion, and then ends.

    For the first few minutes, a join between V$ SQL_SESSION.sql_address and V$ SQL_TEXT.address for this SID returns SQL procedure for its insertion.

    However, it then suddenly returns "no rows found." A glance in V$ SESSION shows that V$ SESSION record of the SID has sql_address '00 ". The SQL insert statement appears in V$ SQL, and the table to which the procedure is inserting data still holds a lock on this subject.

    Is this a normal behavior?

    -Don

    Yes.

    All SQL can be reused, the purpose of the shared pool is to share sql analyzed between sessions. That's why the SQL remains in the shared pool and is visible through v$ sql.
    An address '00' sql means that no SQL statement is running.
    Locks will be released by a later commit or rollback. Note: you should engage a logical work unit, so not all records.

    ----------
    Sybrand Bakker
    Senior Oracle DBA

  • Strange ORA-01722: invalid number on viewCriteria

    Hello

    I defined in jDev 11.1.1.5 do with viewCriteria and everything works until I have migrate jDev 11.1.1.6. Now, I get this exception run this view

    < Utils > < buildFacesMessage > ADF: addition of the JSF error message: ORA-01722: invalid number

    java.sql.SQLSyntaxErrorException: ORA-01722: invalid number

    After a few experiences, I found that this problem is viewCriteria, which is not so simple. It is used with condition NOT IN subquery.

    (P_P_ID_FK NOT IN (SELECT P_ID of P where NVL (VALID_FROM, CURRENT_DATE) < = CURRENT_DATE))

    I know that DOESN'T look good is not standard in ADF viewCriteria, but SQL work well. So tell me why there at - it SQLSyntaxErrorException!

    When I remove that part or AppModule viewCriteria viewCriteria, then everything works.

    Exception disappear even when I move the condition NOT IN with the main request viewCriteria subquery.

    I tried to rewrite viewCriteria using NOT EXISTS, but there is no possibility of query from same table due to the inability of aliasing table names.

    You have a work around?

    Thank you.

    Problem is resolved declaratively by manual editing of XML view this tutorial Andrejus Baranovskis Blog: implementation of criteria seen in Colombia - British ADF

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

    Hello

    We get the error "ORA-01722: invalid number" when opening a cursor using the CURSOR for LOOP.

    This error started only after we migrated to Oracle 10 g to Oracle 9i. Earlier, the same code used to work properly. And also on Oracle 10 g, this is not not the case every time. Sometimes, it gives error while sometimes it works.

    Does anyone know about any such bug in Oracle 10 g. Our cursor is a cursor parameterized accepting a VARCHAR2 parameter and the value that we have to it is also character.

    Our Oracle 10 g Enterprise Edition Release 10.2.0.3.0 - 64 bit Production database and runs on the UNIX server.

    And also on Oracle 10 g, this is not not the case every time. Sometimes, it gives error while sometimes it works.

    This is usually due to
    (a) environment settings that differ from one session to the next
    (b) or, more often, data

    The error means that Oracle expects a number and that it is unable to get an entry (data or SQL or bind variable) number provided. I agree with William that she looks a lot like implicit conversion TO_NUMBER() failure.

    Why not add a debugging code exception handler? When this exception occurs, the dump of the PL/SQL and call stack values of all variables and parameters of a table/record of debugging (using a standalone transaction).

  • 12 c OEM Error rendering element. Exception: ORA-00942: table or view does not exist

    Hi gurus,

    Need your help to resolve ORA-00942 in OEM 12 c. I am planning Long running with a custom query SQL report and get ORA - error.


    I followed the instructions of MOS ' how to create a Custom Information Publisher report listing the current status of all targets (Doc ID 1682668.1). I also gave all possible permissions for mgmt._view


    Grants-

    Grant select on gv_$ ACTIVE_SESSION_HISTORY to mgmt_view;

    Grant select on gv_$ SQLAREA to mgmt_view;

    Custom - query

    SELECT *.

    OF (WITH test (schema_name, machine, sql_id, executions, elapsed_time, sql_text)

    AS (SELECT b.parsing_schema_name,

    a.machine,

    a.sql_id,

    b.executions,

    To_char (MAX (b.elapsed_time) * 0,000001,)

    ' (999999999999999.999').

    LIKE "time (in seconds)."

    B.SQL_TEXT

    OF ACTIVE_SESSION_HISTORY $ Gv, Gv$ SQLAREA B

    WHERE A.SAMPLE_TIME > = SYSDATE - 1

    AND A.SQL_ID = B.SQL_ID

    AND b.executions > 5

    GROUP OF b.parsing_schema_name, a.machine, a.sql_id, b.executions, B.SQL_TEXT

    ORDER BY DESC 4)

    SELECT DISTINCT

    schema_name,

    machine,

    sql_id,

    SUM (executions) as TOTAL_EXECUTIONS,

    SUM (elapsed_time) as TOTAL_ELAPSED_TIME,

    To_char (SUM (elapsed_time) / SUM (executions), ' 999999999999999.999' ") as AVG_RUN_TIME,

    sql_text

    TEST where lower (sql_text) not like '% select%genre.itemname%genre.itemvalue%retailerslogourl%rights_token%md_basic_info_genre%' and sql_text not like '% Analyze % '.

    GROUP BY schema_name, sql_id, machine, sql_text

    ORDER BY DESC 4)

    WHERE ROWNUM < = 20

    Compared to the 10 g report and reading different articles, type target_user_table_from_sql element is missing from 12 c. Do we need to create 12 c or any other parameter that we must follow in 12 c.

    Thanks in advance.

    Kind regards

    Nikhil Mehta.

    Hi all

    I could solve the problem by following the steps below.

    (1) in order to generate reports on the target DB, inserts under folders sysman schema.

    insert into sysman.mgmt_ip_report_elem_def values ('target_user_table_from_sql', 'database_target_type', 'target_user_table_from_sql', 'oracle.sysman.db.util.reports.TableTargetRenderController', 0, NULL, 'EM', NULL, '10.2.0.1.0');

    Insert SYSMAN. MGMT_IP_ELEM_PARAM_CLASSES (ELEMENT_TYPE_NLSID, ELEMENT_PARAM_CLASS, ELEMENT_NAME_NLSID, DISPLAY_ORDER) values ('target_user_table_from_sql', 'database_target_type ','oracle.sysman.eml.ip.render.elem.HeaderParamController ', 1);

    Insert SYSMAN. MGMT_IP_ELEM_PARAM_CLASSES (ELEMENT_TYPE_NLSID, ELEMENT_PARAM_CLASS, ELEMENT_NAME_NLSID, DISPLAY_ORDER) values ('target_user_table_from_sql', 'database_target_type', 'oracle.sysman.eml.ip.render.elem.SQLStatementParamController', 2);

    Commit;

    (2) checked the privileged references and surveillance powers. Password has been changed. Changed the same and report started running as expected.

  • How to avoid the ORA-01722 in Collection queries?

    I'm in the middle of 11 g migration of 12 c and reproduciple face ORA-01722: virheellinen (invalid number) errors with selects for existing collections.

    Never paid any attention to it, but good to know that this can happen.

    So it's potentially get ORA-01722 invalid number

    select to_number(coll.c007) c007
      from my,apex_collections coll
     where 
          my.id                 =  coll.n002  -- my_id
      and coll.collection_name = 'TUNE_COLL'
      and to_number(coll.c007) = 1  -- first level 
    
    

    While this isn't:

    select to_number(c007) FROM (
    select c007
    from my,apex_collections coll
    where 
          my.id                 =  coll.n002  -- my_id
      and coll.collection_name = 'TUNE_COLL'
    --  and to_number(coll.c007) = 1  -- first level
    ) where  to_number(c007) = 1  -- first level
    

    What is nasty, it's that the responsibe 25 pages of theme with parts of report gets berzerk when error messages between and so on.

    I read the following articles, and it really seems that it comes and goes...

    Robert Schaefer's blog: Spooky "ORA-01722: invalid number" errors when using the collections of the Apex

    http://deneskubicek.blogspot.fi/2013/03/Apex-collections-and-joins.html

    But did not find any quick way to resolve all queries on collections. Somehow, this seems to be because I exceeds the number of columns n001-005 and start using vc c001... columns for numbers.

    So what is the best alternative to doing things?

    1.) divide collections a number c001... so that the numbers will always n001 numbers...   (it is a time consuming task)

    2.) extra make selects select collection... is it enough to convert vc/characters to numbers.

    3.) or in any another cool tip - are there for example views on collections?

    Paavo /rgrds

    Paavo wrote:

    The error comes randomly, and maybe it has something to do with the existing 'temporary' collections already.

    They may have something extraordinary in c007 which cannot be to_numbered with different collection_name.

    It has developed before, and this is indeed the cause. The optimizer apply predicates in a different order than that was used earlier. That is, instead of limiting the lines of the collection by the name of the collection to the collection of TUNE_COLL first, then filtering by the value converted C007, she asks C007 firstly, clause that straightens to lines of collections where C007 value can not be converted to a number. This tends to occur during or after the SUMMIT or base data at level, as in this case.

    The fix is beef - cross selects all collections and difficulty where the conditions so that they appear only at specific collection_name?

    Surely it is necessary on all access collection still? And as explained above, it will not necessarily solve the problem, because the optimizer can change the execution plan and apply predicates in any order.

    Why you have exceeded the n001-n005 number of columns? What values are held in these? Preferably, I would suggest using these columns to store digital keys that are used in joins, values put numerical values only referenced in query projections in the columns of characters c001-c050 (and of course to do the same for date values). Then, you can create a view of the collection which explicitly converts values of the column returned to numbers or dates. Using views on top of collections, it is good practice in any case because it allows explicit column names to use in queries rather than a lot of impenetrable n00x and c0xx, which avoids thinking sitting developers "which column is now the postal code?

Maybe you are looking for