Invalid Number Error in Merge Statement
Hi all.
I got an invalid number error in the following merge statement, but I don't know why. Maybe you can give me a hint.
MERGE INTO wam_table
USING (SELECT * FROM wam_table) b
ON (b.username = 'user'
AND b.mod = 'module'
AND b.trimester = '1')
WHEN MATCHED THEN
UPDATE SET as = '1', ad = '1', co = '1', pr = '1', date = localtimestamp, lus = 'username'
WHEN NOT MATCHED THEN
INSERT VALUES ('user','module','1','1','1','1','1', localtimestamp, 'username');
The invalid number error appears in the first line, but I don't know why?
Stephan
UPDATE SET as = '1', ad = '1', co = '1', pr = '1', date = localtimestamp, lus = 'username'SELECT * FROM sys.v_$reserved_words;
SQL> create table test1(as varchar2(10));
create table test1(as varchar2(10))
ERROR at line 1:
ORA-00904: : invalid identifier
SQL> create table test1(sno number, date date);
create table test1(sno number, date date)
ERROR at line 1:
ORA-00904: : invalid identifier
SQL> create table test1("as" varchar2(10));
Table created.
SQL>
SQL> create table test2(sno number, "date" date);
Table created.
SQL> desc test1
Name Null? Type
as VARCHAR2(10)
SQL> desc test2
Name Null? Type
SNO NUMBER
date DATE
SQL>
Similar Messages
-
Invalid Number Error Please help Urgent
Hi,
I am trying to create a report in discoverer where in I get an invalid number error for the statement
,DECODE(final.TYP,'Sales',to_char(final.future_supplpy),'B/O','B/O') sale_type.
We have the requirement that when TYP is Sales i need to display future supply and when the TYP is B/O i need to display B/O.
The query runs perfectly fine in TOAD but in Discoverer Desktop when i run the report i get an error message
invalid number.
Please help its urgent
Thanks
AshwiniHi Ashwani
First of all, your statement appears to not be handling anything other than Sales or B/O. Is that deliberate? If not, you need a default, catch all value at the end like this:
DECODE(final.TYP,'Sales',NVL(final.future_supply,to_char(final.future_supply),'B/O','B/O', default_value) sale_type
You also might want to make sure there aren't any NULL values in future_supply or in TYP and if there are you might want to consider using an NVL for these, like this:
DECODE(final.TYP,'Sales',NVL(to_char(final.future_supply,NULL),'B/O','B/O', default_value) sale_type
Also, when using DECODE you don't always need to use TO_CHAR as the DECODE conversion to a string typically takes place automatically. CASE is different as it insists that all results are of the same data type.
Hope this helps
Best wishes
Michael -
Case When Statement and ORA:01722 Invalid number error
Hi folks, I have posted this under another heading as well under E-business suite so apologies if some you have already seen it but I would really appreciate some help on this one. Any suggestions are most welcome.
We are trying to put together a calculation that returns the number of days absent an individual has had in a given time period. We need to cater for those absences that started before the period and are closed during it, absence that start during the period and end after it, and those that open and close within it.
The period is always a rolling 6 months from sysdate.
This is the calc we have come up with so far which works for some people but we get the invalid number error if the absence includes a half day - so 0.5, 1.5,etc.
This is probably over complicated but we are not techie at all so are learning as we go!
We are using the HRMS - Administration - Oracle Human Resources (Core) business area in 10G and the Absence Attendance and Person folders.
SUM(TO_NUMBER(NVL(( CASE WHEN Absence Attendance.Actual Start Date < TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') THEN ( CASE WHEN Absence Attendance."Actual End Date" > SYSDATE THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),SYSDATE) ) ELSE ( CASE WHEN ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) END ) END ) END ) IS NULL THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),SYSDATE) ) ELSE ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) END ) END ) END ) END ) END ) ELSE ( CASE WHEN ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) END ) END ) END ) IS NULL THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),SYSDATE) ) ELSE ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( Absence Attendance.Duration Days ) END ) END ) END ) END ) END ),( DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") )),'999999990D00'))Hi,
It could be that this is because you are using SYSDATE which contains the time as a fraction rather than TRUNC(SYSDATE) which just contains the current time. It could be that your working_dates_between raises this error.
However, your formula is far more complicated than it needs to be.
Firstly, you want to look at the date window ADD_MONTHS(TRUNC(SYSDATE), -6) to TRUNC(SYSDATE). Then you want to look at the portion of the absence that falls in the date window. This is GREATEST(Absence Attendance.Actual Start Date, ADD_MONTHS(TRUNC(SYSDATE), -6)) to LEAST(NVL(Absence Attendance."Actual End Date",TRUNC(SYSDATE)), TRUNC(SYSDATE)). You may need to add 1 to the absence end date because this is the last day of their absence rather than the date they return. It depends how you calculate the days between the start and end
date of the absence. You can create calculations for the start and end date of the absences within the 6 months time window. Create calculation AbsenceStart as
GREATEST(Absence Attendance.Actual Start Date, ADD_MONTHS(TRUNC(SYSDATE), -6))
and AbsenceEnd as
LEAST(NVL(Absence Attendance."Actual End Date",TRUNC(SYSDATE)), TRUNC(SYSDATE))
Then you need to only pick up absence that a part of the absence in your 6 month date window. You can use a condition in the workbook or a condition in a case statement to do this. You then need to calculate the difference between these dates and SUM all the values.
SUM(CASE WHEN AbsenceEnd >= AbsenceStart THEN WORKING_DAYS_BETWEEN(AbsenceStart, AbsenceEnd) END)
That's it. Not so complicated after all.
Rod West -
Case When Statement and ORA:1722 Invalid number error
Sorry I posted this in the wrong forum - I have the answer now
Cheers
HELP!!!
We are trying to put together a calculation that returns the number of days absent an individual has had in a given time period. We need to cater for those absences that started before the period and are closed during it, absence that start during the period and end after it, and those that open and close within it.
The period is always a rolling 6 months from sysdate.
This is the calc we have come up with so far which works for some people but we get the invalid number error if the absence includes a half day - so 0.5, 1.5,etc.
This is probably over complicated but we are not Techie at all so are learning as we go! We are using the HRMS - Administration - Oracle Human Resources (Core) business area in 10G and the Absence Attendance and Person folders.
SUM(TO_NUMBER(NVL(( CASE WHEN Absence Attendance.Actual Start Date < TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') THEN ( CASE WHEN Absence Attendance."Actual End Date" > SYSDATE THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),SYSDATE) ) ELSE ( CASE WHEN ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) END ) END ) END ) IS NULL THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),SYSDATE) ) ELSE ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) END ) END ) END ) END ) END ) ELSE ( CASE WHEN ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) END ) END ) END ) IS NULL THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),SYSDATE) ) ELSE ( CASE WHEN TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY') >= Absence Attendance.Actual Start Date THEN ( WORKING_DAYS_BETWEEN(TO_DATE(ADD_MONTHS(SYSDATE,-6),'DD-Mon-YYYY'),Absence Attendance."Actual End Date") ) ELSE ( CASE WHEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") ) IS NULL THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( CASE WHEN SYSDATE <= Absence Attendance."Actual End Date" THEN ( WORKING_DAYS_BETWEEN(Absence Attendance.Actual Start Date,SYSDATE) ) ELSE ( Absence Attendance.Duration Days ) END ) END ) END ) END ) END ),( DAYS_BETWEEN(Absence Attendance.Actual Start Date,Absence Attendance."Actual End Date") )),'999999990D00'))
Edited by: CPearce on Sep 25, 2008 8:03 AMHi,
It could be that this is because you are using SYSDATE which contains the time as a fraction rather than TRUNC(SYSDATE) which just contains the current time. It could be that your working_dates_between raises this error.
However, your formula is far more complicated than it needs to be.
Firstly, you want to look at the date window ADD_MONTHS(TRUNC(SYSDATE), -6) to TRUNC(SYSDATE). Then you want to look at the portion of the absence that falls in the date window. This is GREATEST(Absence Attendance.Actual Start Date, ADD_MONTHS(TRUNC(SYSDATE), -6)) to LEAST(NVL(Absence Attendance."Actual End Date",TRUNC(SYSDATE)), TRUNC(SYSDATE)). You may need to add 1 to the absence end date because this is the last day of their absence rather than the date they return. It depends how you calculate the days between the start and end
date of the absence. You can create calculations for the start and end date of the absences within the 6 months time window. Create calculation AbsenceStart as
GREATEST(Absence Attendance.Actual Start Date, ADD_MONTHS(TRUNC(SYSDATE), -6))
and AbsenceEnd as
LEAST(NVL(Absence Attendance."Actual End Date",TRUNC(SYSDATE)), TRUNC(SYSDATE))
Then you need to only pick up absence that a part of the absence in your 6 month date window. You can use a condition in the workbook or a condition in a case statement to do this. You then need to calculate the difference between these dates and SUM all the values.
SUM(CASE WHEN AbsenceEnd >= AbsenceStart THEN WORKING_DAYS_BETWEEN(AbsenceStart, AbsenceEnd) END)
That's it. Not so complicated after all.
Rod West -
Please help: Case Statement - ORA-01722: invalid number Error
Hi All,
I'm trying to use Case statement to recode Cancelled statuses into two groups
'Reject' if the difference between first date and last date is less than 29 and
'Accept' if the difference between first date and last date is greater than 30
Here is my 'test' data:
STATUS FIRST_DATE LAST_DATE
Transfer 10/08/2011 10/09/2011
Mover 10/08/2011 15/09/2011
Cancel 10/08/2011 16/09/2011
Cancel 10/08/2011 5/09/2011
Here is the syntax
select a.*,
(CASE WHEN a.STATUS ='Cancel' THEN (round(a.LAST_DATE-a.FIRST_DATE))
ELSE 0
END) CAN_DAYS,
(CASE WHEN 'CAN_DAYS' >29 THEN 'Reject'
WHEN 'CAN_DAYS' <30 THEN 'Accept'
END) Reject_Accept
from test a
The first CASE statement works fine and gives me this
STATUS FIRST_DATE LAST_DATE CAN_DAYS
Transfer 10/08/2011 10/09/2011 0
Mover 10/08/2011 15/09/2011 0
Cancel 10/08/2011 16/09/2011 37
Cancel 10/08/2011 5/09/2011 26
but the second CASE produces ORA-01722: invalid number Error. It is something to do with the CAN_DAYS data type, Oracle doesn't see it as Numeric i think.
The result i want to see would be
STATUS FIRST_DATE LAST_DATE CAN_DAYS Reject_Accept
Transfer 10/08/2011 10/09/2011 0
Mover 10/08/2011 15/09/2011 0
Cancel 10/08/2011 16/09/2011 37 Accept
Cancel 10/08/2011 5/09/2011 26 Reject
Could someone please help me to fix the syntax?
Thank you in advance,This seems to give you your desired results...
with test as
( select 'Transfer' as status, to_date('10/08/2011') as first_date, to_date('10/09/2011') as last_date from dual union all
select 'Mover' , to_date('10/08/2011') , to_date('15/09/2011') from dual union all
select 'Cancel' , to_date('10/08/2011') , to_date('16/09/2011') from dual union all
select 'Cancel' , to_date('10/08/2011') , to_date('05/09/2011') from dual
select status
, first_date
, last_date
, CAN_DAYS
, CASE
WHEN CAN_DAYS = 0 THEN NULL
WHEN CAN_DAYS < 30 THEN 'Reject'
WHEN CAN_DAYS >= 30 THEN 'Accept'
END Reject_Accept
from ( select status
, first_date
, last_date
, CASE
WHEN STATUS ='Cancel' THEN round(LAST_DATE-FIRST_DATE)
ELSE 0
END CAN_DAYS
from test
; -
Recieving ORA-01722 invalid number error while creating a materialized view
Hi,
I am receiving a ORA-01722 invalid number error while creating a materialized view. when run the select statement of the view i don't get any error, but when i use the same select statement to create a materialized view i receive this error. Could any please help in resolving this error. Here is the code i am using to create a materialized view.
CREATE MATERIALIZED VIEW MV_EBS_CH_CLOSED
REFRESH FORCE ON DEMAND
AS
SELECT DISTINCT kr.request_id, org.org_unit_name,
ebs_ch_ticket_type (kr.request_id) ticket_type,
DECODE
(kr.status_code,
'CLOSED_SUCCESS', kr.last_update_date,
'IN_PROGRESS', (SELECT MAX (start_time)
FROM ebs_ch_datastore ecd1
WHERE kr.request_id = ecd1.request_id
AND workflow_step_name =
'Final BA Review and Deployment Exit Criteria')
) closed_date,
substr(krhd.visible_parameter12,1,10) siebel_start_date,
kr.creation_date itg_start_date
FROM kcrt_requests kr,
kcrt_request_types krt,
kcrt_req_header_details krhd, kcrt_request_details krd1,
(SELECT koum.user_id user_id,
DECODE (koup.org_unit_name,
'IT Implementations', 'CHS - Service Management BA',
koup.org_unit_name
) org_unit_name
FROM krsc_org_unit_members koum, krsc_org_units koup
WHERE 1 = 1
AND 'Y' = koup.enabled_flag
AND koum.org_unit_id = koup.org_unit_id
AND EXISTS (
SELECT 'X'
FROM krsc_org_units kouc
WHERE koup.org_unit_id = kouc.org_unit_id
START WITH kouc.parent_org_unit_id =
ANY (SELECT org_unit_id
FROM krsc_org_units krsc_org_units1
WHERE 'Clearinghouse' =
org_unit_name)
CONNECT BY kouc.parent_org_unit_id =
PRIOR kouc.org_unit_id)
UNION
SELECT kou.manager_id user_id,
DECODE
(kou.org_unit_name,
'IT Implementations', 'CHS - Service Management BA',
kou.org_unit_name
) org_unit_name
FROM krsc_org_units kou
WHERE 'Y' = kou.enabled_flag
START WITH kou.parent_org_unit_id =
(SELECT org_unit_id
FROM krsc_org_units krsc_org_units2
WHERE 'Clearinghouse' = org_unit_name)
CONNECT BY kou.parent_org_unit_id = PRIOR kou.org_unit_id) org
WHERE krt.request_type_id = kr.request_type_id
AND krt.request_type_name IN ('Bug Fix', 'IT Enhancement')
and kr.REQUEST_ID = krd1.request_id
and krd1.batch_number = 1
AND kr.request_id = krhd.request_id
AND org.user_id in (krd1.parameter4, krd1.parameter5, krd1.parameter7)
AND ( 'CLOSED_SUCCESS' = kr.status_code
OR 'IN_PROGRESS' = kr.status_code
AND kr.request_id IN (
SELECT request_id
FROM (SELECT DISTINCT request_id,
MAX
(start_time)
closed_date
FROM ebs_ch_datastore
WHERE 'Final BA Review and Deployment Exit Criteria' =
workflow_step_name
GROUP BY request_id))
Thanks,
Shaik MohiuddinThis error occurs when you try to create a materialized view , but if you run the sql the results are perfectly fine. Well it happend to me also and to fix this I made sure all the coulmns have the same data type which are used in joins or in where clause.
use
where
to_number(col1)=to_number(col2) and to_number(col3)=to_number(col4)
hope this helps.. -
Invalid number error for bind dialog
Oracle SQL Developer version 1.1.2.25 BUILD MAIN-25.79
Running under WinXP
Issue description:
We get an invalid number error when bind variable filled with an enter in the bind dialogIt is hard to say what is causing your problem without the specifics (ie query and value entered for the bind variable). Try running the same statement with the value of the bind variable in place of the bind variable (ie instead of running "select * from dual where dummy = :var" with a value of 'x' for :var, run "select * from dual where dummy = 'x'"). If you get the same error, then it is not an issue with the use of bind variables.
Be aware that currently you cannot define the data type of bind variables (unlike TOAD, etc) and they are all treated as character values. I wouldn't have thought that this would cause you problem unless you are using a bind variable to restrict a numeric column to a specific value and you are entering a non-numeric bind (ie "select * from people where person_id = :id" and using 'xyz' as the value for :id). -
Another ORA-01722: invalid number Error
Hello All,
I have 2 Validations on 1 Item, Not Null and Not Exists, very standard.
select fk_session_name_id
from hrt_session
where fk_session_name_id = :p9_fk_session_name_id
and fk_class_id = :p9_fk_class_id;My Item needs to be a Select List that returns the ID of FK_SESSION_NAME_ID.
select distinct SESSION_NAME display_value, PK_SESSION_NAME_ID return_value
from HRT_SESSION_NAME
order by 1My Form Page throws the ORA-01722 in invalid number Error only when I make the Item a Select List. If Item is a
Text Field and ID value entered and Create is clicked the data is saved but not when its a Select List. I have read alot
of threads that talk about converting this Item to_number but I have not been successful in doing this. Once the Item is
a Select List the Not Exists validation works but the Not Null Validation populates the Error Message. Can anyone
assist me with this please? Thanks
My Data Type is INTEGER for FK_SESSION_NAME_ID and SESSION_NAME is VARCHAR2.
SESSION_NAME data....
SESSION 1
SESSION 2
PMAS 1
PMAS 2
BASIC WORD 2003.....
Edited by: Charles A on Jan 11, 2010 1:42 PMHey Jari,
The PK_SESSION_NAME_ID in the select statement is the value that is going to be returned. FK_SESSION_NAME_ID is the Foreign Key value that will get the value from the Primary Key PK_SESSION_NAME_ID.
Yes, I do have an account that you can log into, thanks for assistance Jari.
Once you log in Select link 'Hrt_Class' which will populate Page 2. Region 'Cascading LOVs has 4 Items. Class Meridiem, Class Name, Class End Date and Class Location. Select these values then click 'Search'. Once the values are populated click the red button at the bottom 'Add Session Info'. This will populate Page 9 which will allow you to test the Create button. You should not be able to add any Session Name that exists in the Report below and you should not be able to Create a Null FK_SESSION_NAME_ID. Let me know if this is clear, thanks again.
The PK_SESSION_ID cannot be Null so just start with values 60116 on up to avoid that error message. I do not have any sequences or triggers created since this is just a testing app.
Edited by: Charles A on Jan 11, 2010 4:05 PM -
ORA-01722: invalid number - Error during implicit conversion (10g vls 11g)
I am facing oracle error for few SELECT queries in 11g which were working fine in 10g environment.
Oracle Version:
10g - 10.2.0.5.0
11g - 11.2.0.3.0
We are storing numeric values under CHAR or VARCHAR2 column in few tables. This is known design issue & it can't be changed for now.
I know this will work fine until all the data is numeric in those columns for respective table. Because by some reason, if any row got character value for that column then implicit string to number conversion will fail and this error can occur. But I have verified that there is no data issue.
But I can see difference in the execution plan! But not able to recognize the reason issue.
Any other pointers on why the queries are failing in 11g would be of great help..
Example SQL:
Note that table structure and data is same in both the environments.
View Definition -
CREATE OR REPLACE FORCE VIEW CIMSOS.LC_LOCATIONS
( COUNTRY_ID, PRODUCTID,
LANGUAGE_ID, LOCATION_NAME,
LOCATION_SHORT_NAME, TAG_ID, LOCATION_DEFINITION,
COMPOSITEKEY, GLOBAL_LOCATION_KEY,
CPRODUCTKEYID, CMODVERSION)
AS
SELECT
CCOUNTRY_ID AS COUNTRY_ID,
CPRODUCTID AS PRODUCTID,
CLANGUAGE_CODE AS LANGUAGE_ID,
CLOCATION_NAME AS LOCATION_NAME,
CLOCATION_SHORT_NAME AS LOCATION_SHORT_NAME,
CTAG_ID AS TAG_ID,
CLOCATION_DEFINITION AS LOCATION_DEFINITION,
CCOMPOSITEKEY AS COMPOSITEKEY,
CGLOBAL_LOCATION_KEY0 AS GLOBAL_LOCATION_KEY,
cproductkeyid,
cmodversion
FROM mct_35193, goldencopy
WHERE cproductkeyid = productkey
AND cmodversion = version
AND catalogid = 35193;Facing issue for SQL query based on above view:
** In 10g Env
SELECT * FROM LC_LOCATIONS WHERE productid = 75;
-- It executes successfully and provide required results.
Explain Plan:
SELECT STATEMENT ALL_ROWSCost: 12 Bytes: 416 Cardinality: 4
4 NESTED LOOPS Cost: 12 Bytes: 416 Cardinality: 4
1 INDEX RANGE SCAN INDEX CIMSOS.GOLDENCOPY_INDX1 Cost: 10 Bytes: 30,225 Cardinality: 2,015
3 TABLE ACCESS BY INDEX ROWID TABLE CIMSOS.MCT_35193 Cost: 1 Bytes: 89 Cardinality: 1
2 INDEX UNIQUE SCAN INDEX (UNIQUE) CIMSOS.XPK_MCT_34342 Cost: 0 Cardinality: 1 ** In 11g Env
SELECT * FROM LC_LOCATIONS WHERE productid = 75;
ORA-01722: invalid number
Explain Plan:
SELECT STATEMENT ALL_ROWSCost: 40 Bytes: 8,692 Cardinality: 82
3 NESTED LOOPS Cost: 40 Bytes: 8,692 Cardinality: 82
1 TABLE ACCESS FULL TABLE CIMSOS.MCT_35193 Cost: 22 Bytes: 819 Cardinality: 9
2 INDEX RANGE SCAN INDEX CIMSOS.GOLDENCOPY_INDX1 Cost: 2 Bytes: 135 Cardinality: 9
-- Executes when value is passed as character.
SELECT * FROM LC_LOCATIONS WHERE productid = '75';The problem doesn't appear to be related to the Oracle version, at least not directly. If your query plan does the string to number conversion before eliminating the rows that have non-numeric data, you'll get an error. If the query plan eliminates the rows that have non-numeric data before doing the conversion, the query will succeed. It is entirely possible that you'd get the "bad" plan in 10g or the "good" plan in 11g.
You can capture the query plans from your 10g database and move them over to the 11g database. Oracle has a nice white paper on upgrading from 10g to 11g that walks you through that process.
Of course, you really don't want to be dependent on the optimizer picking the "right" plan, you really want to fix the underlying data model issue.
Justin -
ORA-01722 Invalid Number Error - report parameter
I have a report which runs successfully using the following simple select statement: -
select u.user_id, u.user_forename||' '||u.user_surname user_name,
fo.flight_number_in, fo.sta, fo.ata, fo.flight_number_out, fo.std, fo.atd
from users u, flight_operations_employees foe, flight_operations fo
where NVL(fo.sta, fo.std) between :P_Start and :P_End and
fo.record_number = foe.record_number and
u.user_id = foe.user_id
order by u.user_surname
Where P_Start and P_End are parameters passed from a form. I want to add further user option selections for the report and have added another parameter (P_inClause) where the user can select one or more items to select from. The column selected is a number on the table. I then want to pass this as another parameter into the report listing a number of valid values using the IN statement. The updated select statement is: -
select u.user_id, u.user_forename||' '||u.user_surname user_name,
fo.flight_number_in, fo.sta, fo.ata, fo.flight_number_out, fo.std, fo.atd
from users u, flight_operations_employees foe, flight_operations fo
where NVL(fo.sta, fo.std) between :P_Start and :P_End and
fo.record_number = foe.record_number and
u.user_id = foe.user_id and
u.user_id IN :P_inClauseorder by u.user_surname
u.user_id is a number column in the table. The value of P_inClause is set as a character parameter in the report and has the value (45,5,13,26) - as an example.
When I try running the report interactively it comes up with the ORA-01722 : Invalid Number error and points to the P_inClause parameter. If I type in the value directly into the select statement it works fine.
Do you have any ideas as to how I can make this work?
Regards
Edited by: Buzzer on Apr 13, 2011 12:44 PMYou can search this forum for "in clause", e.g.:
Re: how to pass values to where conditon -
Find the Column Name which gives Invalid Number Error
Hi,
There are about 150 columns in a table and data to this table is from a external source like flat file. when these data are loaded to the table for a particular column it gives Invalid Number Error. So need to find for Which Numeric Column a String Value is about to be inserted.
since we are sure not whether the proper Values are coming from Source in Front End we pass the Value within ' quotes.
So how do we get the Column for which the error is raised :-)If you are using SQL*Loader, the log will tell you which row and column has the error.
Otherwise you may need to code your own debugging statements. -
Invalid Number Error in IR search bar.
Hi,
I am getting an invalid number error when i put a value in search bar without selecting the column name.
I followed ' "Invalid number" error using Interactive Report search on collection' thread and accordingly
1) Purged User preferences and session state.
2) Cleared browser settings and cache.
3) Deleted old region and Created a new region on the page with the same query.
If I select a column and search it works fine but when I just give an arrangement id which looks like 'ARR12345' directly in search bar it throws Invalid Number.
This is working perfectly fine in other environments which is replica of this one.
I also ran Apex util function to remove sort preferences.
Also my report is a very simple report like select * from a,b where a.id = b.id.
Please help me. This is a production issue.
Thanks a lot in advance.
Regards
Garima
Edited by: 860249 on Nov 4, 2011 11:40 AMUPDATE SET as = '1', ad = '1', co = '1', pr = '1', date = localtimestamp, lus = 'username'SELECT * FROM sys.v_$reserved_words;
SQL> create table test1(as varchar2(10));
create table test1(as varchar2(10))
ERROR at line 1:
ORA-00904: : invalid identifier
SQL> create table test1(sno number, date date);
create table test1(sno number, date date)
ERROR at line 1:
ORA-00904: : invalid identifier
SQL> create table test1("as" varchar2(10));
Table created.
SQL>
SQL> create table test2(sno number, "date" date);
Table created.
SQL> desc test1
Name Null? Type
as VARCHAR2(10)
SQL> desc test2
Name Null? Type
SNO NUMBER
date DATE
SQL> -
"Invalid Number" error for no apparent reason
Hi.
We're transferring data from one table on one DB to a data warehouse on a separate DB. All Oracle 11g running on Windows Server 2003.
The columns all match data wise, and it's a simple select and insert.
However, we got an ORA-01722: invalid number error on one run. We checked all the data, which was fine (all 540,000 rows) and ran it again with no error this time.
I'd like to know if anyone knows why this would happen if there is no issue with the data validity. I'll take all guesses or known issues and check them against our systems. If anyone knows how I can get this to repeat I'd be grateful as it's all running fine now.
Cheers
SiThe data is transferred using a Java program. Select into an OracleResultSet() then read each row result into a prepared statement. Were using the batch send, I believe every 100 rows.
The source columns match the target columns for name and type, with two exceptions where the column name is slightly different but the column type still matches.
There are not triggers on either the source or target tables.
Cheers
Si -
How to determine offending column in ORA-01722: invalid number error ...
When an error like
ORA-01722: invalid number error
occurs and you are dealing with many columns that could be the 'culprit', does anyone have a method by which
you can quickly determine offending column?SQL PLus will tell you:
SQL> create table t
2 (col1 number
3 ,col2 number
4 ,col3 number
5 ,col4 number
6 ,col5 number
7 );
Table created.
SQL> create table x
2 (col1 varchar2(10)
3 ,col2 varchar2(10)
4 ,col3 varchar2(10)
5 ,col4 varchar2(10)
6 ,col5 varchar2(10)
7 );
Table created.
SQL> insert into x values ('1','2','x','4','5');
1 row created.
SQL> insert into t(col1,col2,col3,col4,col5)
2 select col1,col2,col3,col4,col5 from x;
select col1,col2,col3,col4,col5 from x
ERROR at line 2:
ORA-01722: invalid numberAnd if you rearrange your sql like this, sql plus will give you the line number of the offending column:
SQL> insert into t
2 (col1
3 ,col2
4 ,col3
5 ,col4
6 ,col5
7 )
8 select col1
9 ,col2
10 ,col3
11 ,col4
12 ,col5
13 from x;
,col3
ERROR at line 10:
ORA-01722: invalid number -
Getting ORA-01722 invalid number error
what is wrong with the query throwing invalid number error
SELECT NVL(OPT_WA_FAIR_VAL_A,0)
FROM AUDIT_GRN ag
WHERE ag.ORG_GRP_I = 1
AND ag.GRN_N = 2
AND (ag.ED_EFF_M,NVL(ag.ED_END_M,SYSDATE)) IN (SELECT MAX(ED_EFF_M),MAX(NVL(ED_END_M,SYSDATE))
FROM AUDIT_GRN ag2
WHERE ag2.ORG_GRP_I= ag.org_grp_i
AND ag2.grn_n=ag.grn_n
AND To_Date(To_Char(ag2.ED_EFF_M,'MM/DD/YYYY'),'MM/DD/YYYY') <= TO_DATE(TO_CHAR('08/04/06','MM/DD/YYYY'),'MM/DD/YYYY')
AND To_Date(To_Char(NVL(ag2.ED_END_M,SYSDATE),'MM/DD/YYYY'),'MM/DD/YYYY') >= TO_DATE(TO_CHAR('08/04/06','MM/DD/YYYY'),'MM/DD/YYYY'));Error occurs at this line-excluding these line iam getting output
Audit _grn striucture is
org_grp_i number(6)
grn_n number
ed_eff_m timestamp(6)
ed_end_m timestamp(6)
OPT_WA_FAIR_VAL_A number(18,6)
AND To_Date(To_Char(ag2.ED_EFF_M,'MM/DD/YYYY'),'MM/DD/YYYY') <= TO_DATE(TO_CHAR('08/04/2006','MM/DD/YYYY'),'MM/DD/YYYY')
AND To_Date(To_Char(NVL(ag2.ED_END_M,SYSDATE),'MM/DD/YYYY'),'MM/DD/YYYY') >= TO_DATE(TO_CHAR('08/04/2006','MM/DD/YYYY'),'MM/DD/YYYY'));
Maybe you are looking for
-
My apple ID is associated with my kid's ipad. I want to create her own ID but Im afraid she may loose everything she has downloaded (games, etc) if I give her a new ID.
-
I bought an audiobook on my iPhone and I can't find it.
I purchased an audiobook from my iPhone 5c. I couldn't find it in iBooks, or Music or anyplace else. The only place that I can play it, is when I attach my iPhone to my iMac and view what is on my phone in iTunes. I can then play the audiobook. I bou
-
Using Like Operator in a decode function
Hi, I am trying to find out if I can use the like operator in a decode function like: select decode(1234,like '%123%','123 is a match') from dual; this reults in error ORA-00936: missing expression is there any way to make this work? thank you
-
Run FOUR 2560 x 1440 displays from W530?
Hi all, I have a setup most folks don't see every day, but it serves me well. I find myself in need of updating it, though. CURRENT setup: W530 laptop with 32GB and the NVidia Quadro K2000M card Sitting in a 4338 dock Four (4) HP 24" LCD displays, e
-
I am very frustrated. I have spent over 8 hours trying to get my Dreamweaver subscription to work on my PC to no avail. Six hours have been spent with foreign support. I want to speak with someone who isn't speaking from a script who can actually