ORA-01722 running sql in C# 2.0, but works in Apex
Hi,
I am using VS2005 with C# and .NET 2.0 and have an Oracle 10g XE database.
When I run the following query in Apex then it works:
SELECT PIT.TYPE_VALUE AS "Entity Type", PIT.PILE_ITEM_TYPE_ID, RAWTOHEX(PI.PILE_ITEM_VALUE) AS "Entity Value", COUNT(PI.PILE_ITEM_VALUE) AS "# Occurrences", COUNT(DISTINCT XF.IMAGE_ID) AS "# Images" FROM PILE_ITEM_TYPE PIT, PILE_ITEM PI, XFILE XF
WHERE PIT.PILE_ITEM_TYPE_ID = PI.PILE_ITEM_TYPE_ID AND PI.XFILE_ID = XF.XFILE_ID AND (PI.PILE_ITEM_TYPE_ID IN (1,3))
GROUP BY PIT.TYPE_VALUE, PIT.PILE_ITEM_TYPE_ID, RAWTOHEX(PI.PILE_ITEM_VALUE) ORDER BY "Entity Type"
I try and run the same query in my C# app by replacing PI.PILE_ITEM_TYPE_ID IN (1,3) with PI.PILE_ITEM_TYPE_ID IN (:selectedPileTypes), where selectedPileTypes is a string. If selectedPileTypes contains one number, then no problem. Otherwise I get the ORA-01722: invalid number error.
I had this working in a DataSet, but we had to remove it so we could bind and rebind our datagridviews at run-time. I tried to replicate the settings of the Fill method (parameter.DbType = AnsiString ), but it doesn't help. Below is the current code I'm running:
SummaryDataGridView.DataSource = currDB.GetHitSummariesData(selectedPileTypes);
public DataTable GetHitSummariesData(string selectedPileTypes)
DataTable table = new DataTable();
table.Locale = System.Globalization.CultureInfo.InvariantCulture;
OracleDataAdapter adapter = new OracleDataAdapter();
OracleParameter param1 = new OracleParameter();
param1.ParameterName = ":selectedPilesString";
param1.DbType = DbType.AnsiString;
param1.Value = selectedPileTypes;
param1.Direction = ParameterDirection.Input;
string commmandStr = "SELECT PIT.TYPE_VALUE AS \"Entity Type\", PIT.PILE_ITEM_TYPE_ID,"
+ " RAWTOHEX(PI.PILE_ITEM_VALUE) AS \"Entity Value\", COUNT(PI.PILE_ITEM_VALUE)"
+ " AS \"# Occurrences\", COUNT(DISTINCT XF.IMAGE_ID) AS \"# Images\""
+ " FROM PILE_ITEM_TYPE PIT, PILE_ITEM PI, XFILE XF"
+ " WHERE PIT.PILE_ITEM_TYPE_ID = PI.PILE_ITEM_TYPE_ID AND PI.XFILE_ID = XF.XFILE_ID AND"
+ " (PI.PILE_ITEM_TYPE_ID IN (:selectedPilesString))"
+ " GROUP BY PIT.TYPE_VALUE, PIT.PILE_ITEM_TYPE_ID, RAWTOHEX(PI.PILE_ITEM_VALUE)"
+ " ORDER BY \"Entity Type\"";
adapter.SelectCommand = new OracleCommand(commmandStr, currDBConn);
try
adapter.SelectCommand.Parameters.Add(param1);
adapter.Fill(table);
Has anybody run across a similar situation? Or can someone suggest something to try?
TIA,
Theresa
Hi Theresa,
I think it might be a bit unfair to say that the query works in APEX but not when using C# as there is a bit of a difference in the query in the two environments. In the APEX query you show, you are using literals whereas in the query to be submitted via the C# app you are using a single bind variable. If you want to pass multiple values in the "in" clause, you should use a separate bind for each one. Something like:
PI.PILE_ITEM_TYPE_ID IN (:1, :2, :3,...)
Basically you would just build up the query text and then create OracleParameter objects using the correct OracleDbType (to avoid type coercion/conversion), add the parameters to the OracleCommand.Parameters collection, and you should be OK.
Hope that helps a bit,
Mark
Similar Messages
-
Greetings,
I had a report created in APEX 3 that was working fine. Now APEX was upgraded to 4.0.2.00.07, now I am getting the 06502 error. I have not made any changes to the database or any program units or the report itself. Is this an issue known in 4.0.2.00.07 ?? Is there a work around?
Thanks
Vatsacheck the DB version compatibility with apex 4 or your DB version to apex 4.0 support for upgrade!
Oracle Application Express Installation Requirements for 4.0 -
Shared Services JDBC error ORA-01722 after restart
Help me please...
I have this configuration:
- Red Hat EL5.0
- Oracle DB 10.2.0.1
- WebLogic 9.2 MP3
- Hyperion 9.3.1
Hyperion Shared Services install and configured - properly (without any exceptions and errors). Than I setup and config Essbase and Administration Services, externalize users and all this worked properly. I have projects and users in Shared Services and I can do anything with Essbase applications and cubes.
When restart Shared Services and other services I have error when Shared Services started:
org.apache.slide.store.impl.rdbms.StandardRDBMSAdapter - ERROR - SQL error 1722 on /1238771509551.56: [Hyperion][Oracle JDBC Driver][Oracle]ORA-01722: invalid number
and after that Shared Services - worked but I didn't find any users and projects in Shared Services.
ThanksHi dzianis ,
I`m haveing the same problem, I tried this solution but it didn`t work.
You set it at the user instance or at the SGBD?
Regards,
Marcelo -
No error in PL/SQL, but error in Apex
Hi All. I have configured the code from the How-to on uploading a spreadsheet to suit my own needs. It is the cut and paste method.
In SQL developer I run:
BEGIN
conversion_upload.process_text('Argentina Peso 0.3243000 3.0836
Australia Dollar 0.7432000 1.3455
Belgium Euro 1.2792000 0.7817
END;
Uploads the 2 rows fine, places them into their rows and everything is great.
I then cut and paste the same data into my Apex Text area, which is tied to a submit button process. text area is named P8_UPLOAD, process is as follows :
conversion_upload.process_text(:P8_UPLOAD);
When I submit in APEX I get an Invalid number error, ora-01722 ...
how can this not be working if it is working fine in PLSQL?got it figured out... man what a pain in the behind though.
I was getting an extra chr(13) in it through apex, but when I ran it through SQL Dev. it was converting all chr(13)s to chr(10)s.
So in apex I had extra whitespace that was throwing it out. -
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 -
Hello,
I have a ten relational data modeler. When I export a reporting scheme I get the following error:
java.sql.BatchUpdateException: ORA-01722: invalid number
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10296)
at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:216)
at oracle.dbtools.crest.exports.reports.RSTables.export(RSTables.java:108)
at oracle.dbtools.crest.exports.reports.RSRelationalModel.export(RSRelationalModel.java:28)
at oracle.dbtools.crest.exports.reports.ReportsHandler.export(ReportsHandler.java:123)
at oracle.dbtools.crest.swingui.ControllerApplication$ExportToReportsSchema$1.run(ControllerApplication.java:2055)
Will I could help with the error?
Logical data modeler is exported correctly
Thanks.Hi,
I've logged a bug on this.
It seems likely that the problem has arisen because one of your tables has a non-integer value for one of its volumetric properties (Minimum, Expected or Maximum volume).
(If this is the case, then the problem will probably still occur with the DM 4.1 EA1 version.)
David -
Hi
I´m trying to insert numeric data in a field. NUMBER (10,2). But when i run my control file with SQL Loader i have:
Registro 1: Rechazado - Error en tabla "DM08_POLIZA", columna "SUM_ASEGURADA". ORA-01722: número no válido
I've checked the data and all of them are numerics. Then i delete all the values for this field and i have the problem still.
Does Anybody knows why happens this?
My control File has:
LOAD DATA
CHARACTERSET WE8MSWIN1252
INTO TABLE "DM08_POLIZA"
APPEND
REENABLE DISABLED_CONSTRAINTS
FIELDS
TERMINATED BY '|'
"ID_BASE_ORIGEN" POSITION (1) INTEGER EXTERNAL ,
"ID_ORIGEN" CHAR ,
"ID_POLIZA" INTEGER EXTERNAL ,
FILLER_ID_RETENEDOR FILLER INTEGER EXTERNAL ,
FILLER_ID_UNIDAD_PAGO FILLER INTEGER EXTERNAL ,
FILLER_UNIDAD_ADMON FILLER CHAR ,
FILLER_SECTOR FILLER CHAR ,
FILLER_NUM_SUBGPO FILLER INTEGER EXTERNAL ,
FILLER_AREA FILLER CHAR ,
FILLER_TIPO_CONTRATO FILLER CHAR ,
FILLER_PUESTO FILLER CHAR ,
FILLER_NIVEL_LABORAL FILLER CHAR ,
FILLER_FEC_INGRESO FILLER DATE ,
FILLER_FEC_COTIZ FILLER DATE ,
FILLER_SDO_BASE FILLER INTEGER EXTERNAL ,
FILLER_SDO_NETO_ FILLER INTEGER EXTERNAL ,
FILLER_SEG_GMM FILLER INTEGER EXTERNAL ,
"CANAL" CHAR ,
"ID_TIP_PLAN" INTEGER EXTERNAL ,
"RAMO_SUBRAMO" INTEGER EXTERNAL ,
"NUM_CATEGORIA" INTEGER EXTERNAL ,
"PRIMA_ANUAL" INTEGER EXTERNAL ,
"SUM_ASEGURADA" INTEGER EXTERNAL ,
"PRIMA_ANUAL_DESC" INTEGER EXTERNAL ,
"EXTRA_PRIMA" INTEGER EXTERNAL ,
"PRIMA_BASE" INTEGER EXTERNAL ,
"PRIMA_BASE_CT" INTEGER EXTERNAL ,
"PRIMA_POTENCIADA" INTEGER EXTERNAL ,
"PRIMA_POTENCIADA_CT" INTEGER EXTERNAL ,
"PRIMA_BENEF_ADICIONAL" INTEGER EXTERNAL
INTO TABLE "DM08_DATOS_TRABAJO"
APPEND
REENABLE DISABLED_CONSTRAINTS
FIELDS
TERMINATED BY '|'
"ID_BASE_ORIGEN" POSITION (1) INTEGER EXTERNAL ,
"ID_ORIGEN" CHAR ,
"ID_POLIZA" INTEGER EXTERNAL ,
"ID_RETENEDOR" INTEGER EXTERNAL ,
"ID_UNIDAD_PAGO" INTEGER EXTERNAL ,
"UNIDAD_ADMON_O_EMPRESA" CHAR ,
"SECTOR" CHAR ,
"NUM_SUBGRUPO" INTEGER EXTERNAL ,
"AREA" CHAR ,
"TIPO_CONTRATO" CHAR ,
"PUESTO" CHAR ,
"NIVEL_LABORAL" CHAR ,
"FECHA_INGRESO" DATE ,
"FECHA_PRIMER_COT" DATE ,
"SUELDO_BASE" INTEGER EXTERNAL ,
"SUELDO_NETO" INTEGER EXTERNAL ,
"SEGURO_GMM" INTEGER EXTERNAL ,
FILLER_CANAL FILLER CHAR ,
FILLER_ID_TIP_PLAN FILLER INTEGER EXTERNAL ,
FILLER_RAMO_SUBR FILLER INTEGER EXTERNAL ,
FILLER_NUM_CATEG FILLER INTEGER EXTERNAL ,
FILLER_PRIMA_ANUAL FILLER INTEGER EXTERNAL ,
FILLER_SUM_ASEGURADA FILLER INTEGER EXTERNAL ,
FILLER_PRIM_DESC FILLER INTEGER EXTERNAL ,
FILLER_EXTRA_PRIMA FILLER INTEGER EXTERNAL ,
FILLER_PRIMA_BASE FILLER INTEGER EXTERNAL ,
FILLER_PRIMA_BASE_CT FILLER INTEGER EXTERNAL ,
FILLER_PRIMA_POTANCIADA FILLER INTEGER EXTERNAL ,
FILLER_PRIMA_POT_CT FILLER INTEGER EXTERNAL ,
FILLER_PRIMA_BENEF_ADICIONAL FILLER INTEGER EXTERNAL
My table:
SQL> desc dm08_poliza;
Nombre ¿Nulo? Tipo
ID_BASE_ORIGEN NOT NULL NUMBER(2)
ID_ORIGEN NOT NULL VARCHAR2(15)
ID_POLIZA NOT NULL NUMBER(10)
CANAL VARCHAR2(20)
ID_TIP_PLAN NUMBER(5)
NUM_CATEGORIA NUMBER(3)
PRIMA_ANUAL NUMBER(10,2)
SUM_ASEGURADA NUMBER(10,2)
PRIMA_ANUAL_DESC NUMBER(10,2)
EXTRA_PRIMA NUMBER(10,2)
PRIMA_BASE NUMBER(10,2)
PRIMA_BASE_CT NUMBER(10,2)
PRIMA_POTENCIADA NUMBER(10,2)
PRIMA_POTENCIADA_CT NUMBER(10,2)
PRIMA_BENEF_ADICIONAL NUMBER(10,2)
RAMO_SUBRAMO NUMBER(5)
And a registry is:
1|clave1|1232|2|2|IMSS|SECTOR A|145|REC. HUMANOS|INDEFINIDO|DIR. GENERAL||01/01/2000|01/01/2000||||canal 1|2|8422|558|78239|1173588.61||3911.96|3129.57|3129.57|11735.89|11735.89|11735.89
Thanks for your time.
AlexIf i try changing
INTEGER EXTERNAL by DECIMAL EXTERNAL i get the same result
but if i replace for DECIMAL i got:
SQL*Loader-402: No se ha podido determinar la longitud de la columna FILLER_SDO_BASE a partir de la especificaci¾n
and means that SQL*Loader can't determine the column width.
Can anybody tell me the syntax for my control file to insert a field decimal (10,2)
I tried with
S_B FILLER CHAR "TO_NUMBER(:S_B,'99,999,999.99')",
and i get the follow message error:
SQL*Loader-350: Error de sintaxis en la lÝnea 39.
Se espera "," o ")", se ha encontrado "TO_NUMBER".
S_B FILLER CHAR "TO_NUMBER(:S_B,'99,999,999.99')",
Any ideas or suggestions.
Thanks a lot. -
SQL Query and Exception ORA-01722
Hi,
I have a table called t_lookup which has three columns Lookup_Value, Description and Lookup_Type all of them are varchar2 type. If I execute the below query, its working fine
SELECT *
FROM (SELECT Lookup_Value
*,To_Number(Description) Dd*
FROM t_Lookup
WHERE Lookup_Type = 'CALENDAR') Tab ;
Here is the result
Lookup_Value .............. 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 execute
SELECT *
FROM (SELECT Lookup_Value
*,To_Number(Description) Dd*
FROM t_Lookup
WHERE Lookup_Type = 'CALENDAR') Tab
AND Dd = 9;
then it is throwing ORA exception
ORA-01722: invalid number
Can any one help me on this in order to understand the root cause of this problem? Oracle server I am using is "Oracle9i Release 9.2.0.8.0" .
ThanksI'm assuming that it is intended that certain descriptions will have non-numeric data in them, right?
Assuming that is the case, the success or failure of the query will depend on how the optimizer happens to choose to execute your query. If it happens to run the TO_NUMBER function before it filters out a row with non-numeric data, you'll get an error. If it happens to run the TO_NUMBER after filtering out all the rows with non-numeric data, the query will be successful. Given that query plans are subject to change, particularly when you eventually upgrade, you probably don't want to just find a SQL query that works, you'll need to ensure that either 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 whether you really need to store numeric data in a VARCHAR2 field in the first place. I'm guessing this is some sort of generic lookup table (which cause a raft of issues, this being one). Can you at least store string, date, and number data in separate columns?
Barring that, can you create your own PL/SQL function 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;That will ensure that the query will be successful regardless of the plan. Note that you would probably want to catch just the ORA-01722 error, not OTHERS, in your real code-- this is just a sample.
Barring that, you'll need to do something to enforce stability in the query plan. A stored outline that forces this query to use the query plan that doesn't generate an error.
Justin -
'ORA-01722: Invalid Number' error while Running a Query
Hi,
I'm trying to run a query built on a DSO. The DSO has a field 'Start Date'. This Start Date InfoObject has a reference Char as 0DATE.
This Start Field has blank values due to which I'm getting the ORA-01722 error. I came across many threads with same topic of discussion. As mentioned in one of the Threads I have written a program to update 'Start Date' with 00000000. The code wriiten is "UPDATE /BIC/AZ_MONINV00 SET /BIC/ZSTR_DTE = '00000000' where /BIC/ZSTR_DTE = ' '.
Now when I see the data in the active data table of DSO the blank value is replaced with '00000000'.
But If I right click on the DSO click on display data the 'Start Date' field is blank. And now the Query also gets executed without any error. But in the output of the query the 'Start Date' Field has "#" values.
Can anyone suggest on how can I make these "#" values appear as 00000000 in the report?In this case, you have to write a macro to avoid # in Analyzer.
Right Click-->Display Data will show data from Active table of DSO only.
If you don't want to show any blank date values in the report, you can exclude in Filter in Query. -
Hi everyone.
Can anyone tell me what is wrong in this code below?
Code:
function NO_DAYSFormula return Number is
begin
IF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
AND :P_TO_DT<:MATURITY_DATE
AND :ACCT_OPN_DT>:P_FR_DT
THEN RETURN (:P_TO_DT-:ACCT_OPN_DT+1);
ELSIF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
AND :P_TO_DT<:MATURITY_DATE
AND :ACCT_OPN_DT<:P_FR_DT
THEN RETURN (:P_FR_DT-:P_TO_DT+1);
ELSIF TO_CHAR(TO_DATE(:P_FR_DT, 'DD-MM-RRRR'), 'RRRR') =TO_CHAR(TO_DATE(:ACCT_OPN_DT, 'DD-MM-RRRR'), 'RRRR')
AND :P_TO_DT>:MATURITY_DATE
AND :ACCT_OPN_DT<:P_FR_DT
THEN RETURN (:P_FR_DT-:MATURITY_DATE+1);
END IF;
END;
It gets compiled successfully but when i run the report, i get 2 errors.
Error 1:
REP-1401: 'no_daysformula':Fatal PL/SQL error occurred.
ora-06503: PL/SQL : Function returned without value.
Error 2:
REP-0619: You cannot run without a layout.
Should i use only 1 return statement?
Can i use as many return statements as i want?
What is the exact mistake? Please let me know.
Thank You.Let me clear you the first thing...
If you get any fatal errors while running the report (e.g., function returned without value,no value etc.,) the report will show
REP-0619: You cannot run without a layout.
So you just correct the function 'no_daysformula' .
First of all you run the report without that formula column.
If it works fine then , Check the return value of your formula column (Your formula column properties --> Return value --> value (It will be DATE as i think so).
As function will always return a single value, Check your formula 'no_daysformula' returns the same.
declare a return variable say for example..
DECLARE
V_DATE DATE;
BEGIN
--YOUR CODE---
RETURN V_DATE := (RETURN VALUE)
END;
Last but not least ... use Else condition to return (NULL or any value ) in your code and check..
If any Problem persists let me know
Regards,
Soofi. -
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 approchSELECT 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 -
ORA-00900: invalid SQL statement error while running jobs in APEX 4.2
Hi,
the following procedure compiled successfully in Apex 4.2:
create or replace procedure "DEVLOE" AS
L_TEMPLATE VARCHAR2(32000);
L_base_TEMPLATE VARCHAR2(32000);
begin
l_base_template := '<html>
<head>
<title>HTML Editor Sample Page</title>
</head>
<body>
<p>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;"><span class="plsql-literal" style="line-height: 14.65625px; white-space: nowrap;">Hi #Contact#,</span></span></span></p>
<p>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;"><span class="plsql-literal" style="line-height: 14.65625px; white-space: nowrap;">This is a notification message to inform you that <strong>Development </strong>effort </span><span class="plsql-literal" style="line-height: 14.65625px; white-space: nowrap;">and milestones are yet to be updated for ECR: </span><span class="plsql-operator" style="line-height: 14.65625px; white-space: nowrap;"></span><span class="plsql-word" style="line-height: 14.65625px; white-space: nowrap;">#ECR_NAME#. This ECR has priority #p#. </span></span></span></p>
<table align="center" border="1" cellpadding="1" cellspacing="1" style="width: 500px;">
<tbody>
<tr>
<td>
<span style="font-size:14px;"><span style="color: rgb(255, 0, 0);"><span style="font-family: verdana, geneva, sans-serif;"><u><strong>Department</strong></u></span></span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;"><span style="color: rgb(255, 0, 0);"><u><strong><span style="background-color: rgb(255, 255, 255);">Contact Name</span></strong></u></span></span></span></td>
</tr>
<tr>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">Product Management Contact</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#pdm#</span></span></td>
</tr>
<tr>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">PMO Contact</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#PMO#</span></span></td>
</tr>
<tr>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">Dev Contact</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#Dev#</span></span></td>
</tr>
<tr>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">QA Contact</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#QA#</span></span></td>
</tr>
<tr>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">Infodev Contact</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#Info#</span></span></td>
</tr>
</tbody>
</table>
<p>
</p>
<span fckbookmark="1" style="display: none;"> </span><span fckbookmark="1" style="display: none;"> </span>
<table align="center" border="1" cellpadding="1" cellspacing="1" style="width: 500px;">
<tbody>
<tr>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;"><span style="color: rgb(0, 0, 255);">Team</span></span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;"><span style="color: rgb(0, 0, 255);">Start Date</span></span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;"><span style="color: rgb(0, 0, 255);">End Date</span></span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;"><span style="color: rgb(0, 0, 255);">Effort(in person days)</span></span></span></td>
</tr>
<tr>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">Development</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#d1#</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#e1#</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#L1#</span></span></td>
</tr>
<tr>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">Quality Assurance</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#d2#</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#e2#</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#L2#</span></span></td>
</tr>
<tr>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">Information Development</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#d3#</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#e3#</span></span></td>
<td>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">#L3#</span></span></td>
</tr>
</tbody>
</table>
<p>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">The ECR application is located</span> at </span>: https://apex.oraclecorp.com/pls/apex/f?p=1472:1<span fckbookmark="1" style="display: none;"> </span></p>
<span fckbookmark="1" style="display: none;"> </span>
<p>
<span style="font-family: verdana, geneva, sans-serif; font-size: 14px;">Regards,</span></p>
<p>
</p>
<p>
<span style="font-size:14px;"><span style="font-family: verdana, geneva, sans-serif;">ECR Team</span></span></p>
</body>
</html>
FOR c1 IN (select ECR_NAME,PMO_CONTACT, QE_LOE,INFODEV_LOE, DEV_START_DATE, DEV_END_DATE, QE_CONTACT,QE_START_DATE,INFODEV_START_DATE,INFODEV_END_DATE, QE_END_DATE, INFODEV_CONTACT, PDM_CONTACT, DEV_LOE,ECR_PRIORITY, DEV_CONTACT from ECR_NAME WHERE DEV_LOE IS NULL AND ECR_STATUS = 'Effort Estimation is in Progress' AND ECR_PRIORITY <=5)
LOOP
l_template := l_base_template;
l_template:= replace(l_template, '#Contact#', c1.DEV_CONTACT);
l_template:= replace(l_template, '#ECR_NAME#', c1.ECR_NAME);
l_template:= replace(l_template, '#p#', c1.ECR_PRIORITY);
l_template:= replace(l_template, '#PMO#', c1.PMO_CONTACT);
l_template:= replace(l_template, '#pdm#', c1.PDM_CONTACT);
l_template:= replace(l_template, '#Dev#', c1.DEV_CONTACT);
l_template:= replace(l_template, '#QA#', c1.QE_CONTACT);
l_template:= replace(l_template, '#Info#', c1.INFODEV_CONTACT);
l_template:= replace(l_template, '#d1#', c1.DEV_START_DATE);
l_template:= replace(l_template, '#L1#', c1.DEV_LOE);
l_template:= replace(l_template, '#e1#', c1.DEV_END_DATE);
l_template:= replace(l_template, '#d2#', c1.QE_START_DATE);
l_template:= replace(l_template, '#L2#', c1.QE_LOE);
l_template:= replace(l_template, '#e2#', c1.QE_END_DATE);
l_template:= replace(l_template, '#d3#', c1.INFODEV_START_DATE);
l_template:= replace(l_template, '#L3#', c1.INFODEV_LOE);
l_template:= replace(l_template, '#e3#', c1.INFODEV_END_DATE);
htmldb_mail.Send(p_to => '[email protected]',
p_cc => '[email protected]',
p_from => '[email protected]',
p_body => l_template,
p_body_html => l_template,
p_subj => 'cxxxx:' ||c1.ECR_NAME );
END LOOP;
end;
the when I ran:
begin
devloe();
end;
I received the mail as well.
However, when I try to schedule this in the job:
declare
JobNo user_jobs.job%TYPE;
begin
dbms_job.submit(JobNo, 'BEGIN
DEVLOE();
END;', sysdate, 'sysdate + 1/24/60'); commit; end;
The job status shows failures every minute.
dbms_job.run(job_no);
It gave : ORA-00900: invalid SQL statementFirst of all I don't see a procedure header.
Secondly I see you commit inside your procedure. This is a bug.
Thirdly I see you also commit inside a loop. This is also a bug, and needs to be removed asap.
The error indicates a statement doesn't parse. As you don't post the error stack, nor a table definition no one can reproduce the problem.
You need to isolate the statements, one by one, and run them through sql*plus to see what happens.
Sybrand Bakker
Senior Oracle DBA -
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
*/ -
ORA-01722 when opening a package in SQL Developer 1.2 with oracle 9iR1
Hi,
I use SQL Developer with Oracle Database 9i release 1.
When I open a package in SQL Developer 1.2 (or 1.5) for editing, I receive the error ORA-01722. The package successfully opens but this message, which pops everytime, is really annoying.
I monitored the requests sent by SQL Developer and it seems that the following request is responsible of the error :
SELECT LINE,POSITION,TEXT,ATTRIBUTE FROM USER_ERRORS WHERE TYPE=:1AND NAME=:2
Notice there are no spaces between ':1' and 'AND'. When executing 'by hand' the request with SQL Developer, it asks for the value of '1AND' bind variable and the value of '2'. Then, it fails to execute with... ORA-01722.
Is it possible to avoid this bug ?
Thank you for your help.We're doing rolling 2 week releases until production. Expect something new next week.
-
Interface not running: ORA-01722: invalid number
Hi,
I have migrated my ODI master&work repositories from my development-machine to my local laptop and now I get this error when executing one of my Interfaces:
ORA-01722 Invalid number (I translated this because I get this error in Dutch!!).
On my development-machine, I do not get this error, and IF I get errors, I get them in English (which I prefer).
So, my questions are:
1) how do I change my errors on my local machine from Dutch to English?
does that depend on the database? or on java? or on ....?
2) can I make changes in ODI to get this Interface running?
Thanks in advance!
Steffen
ps. I already tried
a) to set in 'odiparams.bat'
ODI_ADDITIONAL_JAVA_OPTIONS='-Duser.language=en -Duser.country=US"
but this didn't help...
and
b: set my Oracle database run in AMERICAN_AMERICA.
set my Locale Settings to English [US]
.. still no luck.. ;-((I think to change the language of the error message of oracle you got to change the value of the variable NLS_LANG
you can change it only for a session if you want to try
alter session set NLS_LANGUAGE='AMERICAN'
and you can verify your language with this script
SELECT USERENV ('language') FROM DUAL
then you can see if the problem come from here
And for your interface this message could come from a character which is not valid in Dutch.
execute this to see which numeric delimiter is allowed:
SELECT * from NLS_SESSION_PARAMETERS where
PARAMETER='NLS_NUMERIC_CHARACTERS'
which this I hope you to find your error
Maybe you are looking for
-
Set value of SPFieldLookup programmatically
Hi, I have a situation wherein when I add an item in List A in website A, same item needs to be added in List B in website B(Both the list have same meta data of course). I have an event handler and registered it for List A, wherein in Item Added eve
-
HT1711 how can i erase music off of my ipad2
ive been trying to figure this out for the longest and i really need answers
-
I want to remove "Restore Previous Session" without disabling crash/tab restore and history
I have checked "Clear history when ff closes" & "Active logins" / "Saved passwords" but nothing. The options of restoring a session after a crash and reopening an accidentally closed tab are great, but I just can't feel ok that everyone on my pc can
-
I'm trying to make a simple rollover using 2 states, and for the life of me I cannot figure out how to do so. Can you help, or direct me to a tutorial? Thanks.
-
I have a problem installing Photoshop CS5
I have a copy of PS CS5 bought as an upgrade over CS3. Unfortunately, the hard drive failed on my PC and I need to reinstall it on the rebuilt PC. I have and can provide the SNs for both the CS3 and CS5 systems, but the installer then complains that