Invalid Number Error on Toplink Access
I am wondering if anyone else has had this problem. Every time i query the database, i get this exception. I have already verified the Mapping documents. I have also attached, below, the toplink - generated JDBC call that is actually getting executed.
--Connection(32185778)
--SELECT QUERY_CASES_BY, QUERY_ID, CREATE_DATE, QUERY_NAME, DESCRIPTION, SHOW_DIAL_HOMES_F, END_DATE, LAST_UPDATED_BY, CREATED_BY, LAST_UPDATE_DATE, CASE_CONTACT_F, USER_ID, DURATION_DAYS FROM ESERV_USER_SAVED_QUERY WHERE (((((((((LAST_UPDATED_BY = ?) AND (CREATED_BY = ?)) AND (QUERY_NAME = ?)) AND (SHOW_DIAL_HOMES_F = ?)) AND (CASE_CONTACT_F = ?)) AND (USER_ID = ?)) AND (QUERY_CASES_BY = ?)) AND (DURATION_DAYS = ?)) AND (DESCRIPTION = ?))
bind => [1, 1, test, true, true, 1, 100, 100, test]
James,
What data did you enter in each field? Could it be as simple as you tried to enter character data into the deptno column?
Sergio
Similar Messages
-
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 -
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). -
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 -
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
; -
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')); -
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 with Bulk collect
Hi ,
I have been using the script to delete old seasonal data from my application DB tables. The stored procedure has been created successfully but when i try to run the proc it has been throwing 'ORA-01722: invalid number' exception at line 'FETCH C1_CUR BULK COLLECT INTO C1_TYPE_VAR LIMIT v_bulklimit;'.
Could you please help me here?
Below is the stored proc:
CREATE OR REPLACE PROCEDURE clean_old_season_data(P_SEASON VARCHAR2) AS
CURSOR C1_CUR IS SELECT ROWID RID,pro.* FROM PROPS pro where pro.ITEMPK IN
(SELECT sve.pk FROM SAVEDVALUEENTRY sve WHERE sve.p_parent IN
(SELECT s.pk FROM SAVEDVALUES s WHERE s.P_MODIFIEDITEM IN
(SELECT a.PK
FROM products a
WHERE a.p_season IN (select s.pk from Seasons s where s.P_code=P_SEASON)
) ) ) and rownum<5;
CURSOR C2_DEL IS SELECT RID FROM PROPS_HISTORY;
TYPE C1_TYPE IS TABLE OF C1_CUR%ROWTYPE;
C1_TYPE_VAR C1_TYPE;
TYPE C2_TYPE IS TABLE OF UROWID;
C2_TYPE_VAR C2_TYPE;
ex_dml_errors EXCEPTION;
PRAGMA EXCEPTION_INIT(ex_dml_errors, -24381);
l_error_count NUMBER;
err_num NUMBER;
err_msg VARCHAR2 (300);
COMMIT_VARIABLE PLS_INTEGER:=0;
v_bulklimit NUMBER:=2;
BEGIN
/*------------------ Data Selection and INSERTION IN HISTORY TABLE ---------------------------------------*/
OPEN C1_CUR;
LOOP
DBMS_OUTPUT.put_line('Cursor opend now in loop');
FETCH C1_CUR BULK COLLECT INTO C1_TYPE_VAR LIMIT v_bulklimit;//ERROR OCCURS HERE
DBMS_OUTPUT.put_line('Cursor count is'|| C1_TYPE_VAR.COUNT);
FORALL I IN 1..C1_TYPE_VAR.COUNT SAVE EXCEPTIONS
INSERT INTO PROPS_HISTORY VALUES C1_TYPE_VAR(I);
COMMIT_VARIABLE := COMMIT_VARIABLE + v_bulklimit;
DBMS_OUTPUT.put_line('Commit variable'|| COMMIT_VARIABLE.COUNT);
IF COMMIT_VARIABLE = v_bulklimit THEN
COMMIT;
COMMIT_VARIABLE := 0;
END IF;
EXIT WHEN C1_CUR%NOTFOUND;
END LOOP;
DBMS_OUTPUT.put_line('Cursor closed now in loop and data inserted in history table');
CLOSE C1_CUR;
/*------------------ Data Selection and DELETION IN Live TABLE ---------------------------------------*/
COMMIT_VARIABLE := 0;
OPEN C2_DEL;
LOOP
FETCH C2_DEL BULK COLLECT INTO C2_TYPE_VAR LIMIT 2;
FORALL I IN 1..C2_TYPE_VAR.COUNT SAVE EXCEPTIONS
DELETE FROM PROPS WHERE ROWID = C2_TYPE_VAR(I);
COMMIT_VARIABLE := COMMIT_VARIABLE + 2;
IF COMMIT_VARIABLE = 2 THEN
COMMIT;
COMMIT_VARIABLE := 0;
END IF;
EXIT WHEN C2_DEL%NOTFOUND;
END LOOP;
CLOSE C2_DEL;
END;Although there are many things which should not have been done in the posted code, I could not find any reason why the Invalid number error should occur at the Fetch clause.
I would suggest you to Insert into Table by providing the Order of Columns i.e. Insert into table (col1, ... colN) values (coll(i).col1...col(i).colN);
I tested below code and it did not give any errors.
drop table test_table;
create table test_Table
rid varchar2(100),
emp_id number(5),
fname varchar2(20),
lname varchar2(50)
set serveroutput on;
declare
cursor c_cur is
select rowid rid, e.*
from employees e
where rownum < 10;
type typ_cur is table of c_cur%rowtype;
typ typ_cur;
l_bulk_limit number := 5;
begin
open c_cur;
loop
fetch c_cur bulk collect into typ limit l_bulk_limit;
dbms_output.put_line('Collection Count :: ' || typ.count);
forall i in 1..typ.count --typ.first..typ.last
insert into test_Table (rid, emp_id, fname, lname) values (typ(i).rid,typ(i).employee_id,typ(i).first_name,typ(i).last_name);
dbms_output.put_line('Processed ' || l_bulk_limit || ' records.');
exit when c_cur%notfound;
end loop;
commit;
end;
select * from test_table;PS:- 1. When you are processing only 4 Records, then why are you breaking them in 2 Loops?
2. Why Commit every time you are processing a DML? Why not maintain an Error Flag and Rollback the Transaction as soon as error is encountered?
3. Use "{code}" (Exclude Double Quotes) to format the code. I am not sure if works.
Regards,
P. -
ORA-01722: invalid number error. In Update
create or replace procedure San_Test (sInNum varchar2, outMsg out varchar2)
is
begin
update mtest set
mname = 'Success'
where id in (sInNum);
commit;
outMsg :='Success';
exception
when others then
outMsg :='Err';
dbms_output.put_line(sqlerrm);
end;
This is my test sp where i am getting ORA-01722: invalid number error.
Which is because the column data type is Number of ID and i have sInNum parameter as varchar2.. How can i achieve this ?
I don't have other way to do this please help.Great demonstration for SQL INJECTION, was that part of your OCP training?
CREATE TABLE mtest (id NUMBER, mname VARCHAR2(255));
INSERT INTO mtest VALUES (1, 'test');
INSERT INTO mtest VALUES (2, 'test2');
COMMIT;
CREATE OR REPLACE PROCEDURE san_test (sinnum VARCHAR2, outmsg OUT VARCHAR2)
IS
mnum VARCHAR2 (10);
strsql VARCHAR2 (250);
BEGIN
mnum := REPLACE (sinnum, '''', '');
strsql :=
'update mtest set
mname = ''Success''
where id in (' || mnum || ')';
EXECUTE IMMEDIATE strsql;
COMMIT;
outmsg := 'Success';
EXCEPTION
WHEN OTHERS
THEN
outmsg := 'Err';
DBMS_OUTPUT.put_line (SQLERRM);
END;
SELECT *
FROM mtest;
ID MNAME
1 test
2 test2And now for the fun part:
SET SERVEROUTPUT ON
DECLARE
v_put_msg VARCHAR2(255);
BEGIN
san_test('1) OR (1=1', v_put_msg);
dbms_output.put_line(v_put_msg);
COMMIT;
END;
SELECT *
FROM mtest;
ID MNAME
1 Success
2 SuccessC. -
ORA-01722: invalid number (Error in Application after upgrade to 3.0)
Dear All,
After upgrading to 3.0 I am no longer able to login to my application. The error I am seeing is:
ORA-01722: invalid number
Error Could not process show_hide_memory.show_hide_collection_output procedure !
Please help me pin-point the issue and fixed it.
This happens in some applications but in others it doesn't...
Regards,
Pawel.I believe I have found the source of the problem!
This is coming from the sample application which was used for the show/hide of regions example.
The code behind the above procedure is:
CREATE OR REPLACE
PACKAGE show_hide_memory AS
PROCEDURE show_hide_collection;
PROCEDURE show_hide_collection_output;
END;
CREATE OR REPLACE PACKAGE BODY show_hide_memory AS
PROCEDURE show_hide_collection AS
l_arr apex_application_global.vc_arr2;
l_found boolean := FALSE;
l_collection_name VARCHAR2(255) := 'SHOW_HIDE_COLLECTION';
BEGIN
IF(wwv_flow_collection.collection_exists(p_collection_name => l_collection_name) = FALSE) THEN
htmldb_collection.create_or_truncate_collection(p_collection_name => l_collection_name);
END IF;
l_arr := apex_util.string_to_table(p_string => v('TEMPORARY_ITEM'), p_separator => ']');
-- If the array member count of l_arr < 3, then the following code will raise an exception
FOR c1 IN
(SELECT seq_id
FROM apex_collections
WHERE collection_name = l_collection_name
AND c001 = l_arr(1)
AND c002 = l_arr(2)
AND c003 = l_arr(3))
LOOP
-- It exists, so delete it
apex_collection.delete_member(p_collection_name => l_collection_name, p_seq => c1.seq_id);
l_found := TRUE;
END LOOP;
IF l_found = FALSE THEN
apex_collection.add_member(p_collection_name => l_collection_name, p_c001 => l_arr(1), p_c002 => l_arr(2), p_c003 => l_arr(3));
END IF;
COMMIT;
END show_hide_collection;
PROCEDURE show_hide_collection_output AS
BEGIN
htp.prn('<script type="text/javascript">' || CHR(10));
htp.prn('<!--' || CHR(10));
htp.prn('window.onload=function(){' || CHR(10));
FOR c1 IN
(SELECT c003
FROM apex_collections
WHERE collection_name = 'SHOW_HIDE_COLLECTION'
AND c001 = wwv_flow.g_flow_id
AND c002 = wwv_flow.g_flow_step_id)
LOOP
htp.prn('htmldb_ToggleWithImage(''' || c1.c003 || 'img'',''' || c1.c003 || 'body'');' || CHR(10));
END LOOP;
htp.prn('}' || CHR(10));
htp.prn('//-->' || CHR(10));
htp.prn('</script>' || CHR(10));
END show_hide_collection_output;
END;
I guess now I have to find the bug in the above code ! -
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 -
Ora-01722 invalid number error within view
Hi, in my oracle 9.2.0.4.0 db, under TEST schema i've a view called PRODUTTIVITA_LINEE. I'm trying to create another view joining PRODUTTIVITA_LINEE with a table called LINEE. But when i execute the select (SELECT PRODUTTIVITA_LINEE.*, LINEE.NAME FROM PRODUTTIVITA_LINEE, LINEE WHERE PRODUTTIVITA_LINEE.LINEA_ID = LINEE.LINEA_ID), i obtain the ORA-01722 invalid number error.
But if i create a table PRODUTTIVITA_SUPPORT as select all fields from PRODUTTIVITA_LINEE and i use it in the new query (SELECT PRODUTTIVITA_SUPPORT.*, LINEE.NAME FROM PRODUTTIVITA_SUPPORT, LINEE WHERE PRODUTTIVITA_SUPPORT.LINEA_ID = LINEE.LINEA_ID), all works.
Using the view, the new query doesn't work, but using the same data toke from a table instead of view, all works. Why?Excuse me but i send modified script. Here the original script of object.
SQL> desc PRODUTTIVITA_LINEE;
Nome Nullo? Tipe
LINEA_ID NUMBER(9)
COD_LINEA_ANDATA VARCHAR2(8)
COD_LINEA_RITORNO VARCHAR2(4)
ID_TRAT_PIC_ANDATA NUMBER
ID_TRAT_PIC_RITORNO NUMBER
DESC_LINEA VARCHAR2(120)
EKM_NOMINALI NUMBER
EKM_SCONTATI NUMBER
KMLINEA NUMBER
ANNO NUMBER SQL> desc PRODUTTIVITA_SUPPORT;
Nome Nullo? Tipe
LINEA_ID NUMBER(9)
COD_LINEA_ANDATA VARCHAR2(8)
COD_LINEA_RITORNO VARCHAR2(4)
ID_TRAT_PIC_ANDATA NUMBER
ID_TRAT_PIC_RITORNO NUMBER
DESC_LINEA VARCHAR2(120)
EKM_NOMINALI NUMBER
EKM_SCONTATI NUMBER
KMLINEA NUMBER
ANNO NUMBER Both objects have 5400 records and are the same. -
ORA-01722: invalid number error when trying to pass a list of values
Gurus
We are using a function like so
The usage for the function below is
Select fn_st_bb_nm_uc (‘1232131312, 123213312’) from dual;
SQL> /
Select fn_st_bb_nm_uc ('1232131312, 123213312') from dual
ERROR at line 1:
ORA-01722: invalid number
It’s giving an invalid number error. When we pass one value it is working fine but when we pass a string of values it gives this error. I have opened an SR around this but would greatly appreciate your help
Acc_blackbar is the table and acc_blkbr_id is of type number.
FUNCTION fn_st_bb_nm_uc (pBB_ID_LIST VARCHAR2)
RETURN VARCHAR2 IS
vspcm_typ_nm_uc VARCHAR2 (2000);
CURSOR stname
IS
SELECT distinct st.spcm_typ_nm_uc
FROM
acc_blackbar abb,
acc_specimen_type ast, acc_procedure apr,
acc_specimen_part asp,
specimen_type st, procedure pr,
proc_proc_family ppf
WHERE abb.ACC_BLKBR_ID = apr.ACC_BLKBR_ID
AND apr.ACC_SPCM_PART_ID = asp.ACC_SPCM_PART_ID
AND asp.ACC_SPCM_TYP_ID = ast.ACC_SPCM_TYP_ID
AND ast.ACC_SPCM_TYP_SPCM_TYP_ID = st.SPCM_TYP_ID
AND apr.procdr_id = pr.PROCDR_ID
AND pr.PROCDR_ID = ppf.PROCDR_ID
AND abb.acc_blkbr_id in (pBB_ID_LIST) ;
BEGIN
DBMS_OUTPUT.PUT_LINE(' BB LIST : ' || pBB_ID_LIST);
FOR st IN stname
LOOP
vspcm_typ_nm_uc := vspcm_typ_nm_uc || ',' || st.spcm_typ_nm_uc;
END LOOP;
vspcm_typ_nm_uc := SUBSTR (vspcm_typ_nm_uc, 2);
RETURN vspcm_typ_nm_uc;
END;This ask tom thread covers multiple solutions:
[http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:210612357425]
Maybe you are looking for
-
Dear Experts, Please help me, I did Manual Bank Statement (FF67) cheque received and issued enteries are posted to main bank a/c but still that line items are still open item status, i checked in fbl3n cheque received and cheque issued a/c and ma
-
CSV output = Yes, but link not displayed
Hi, Anyone encountered/know how to fix this one? I've a report in an SQL Report region with CSV Output = YES, but the link label is not displayed. (CSV link is displayed OK on other reports). Thanks John D
-
hey i have a short question, is it normal that the mac restart very often after an update, my mac restarted several times in a row, restart (white screen with loading bar) and restart again (same screen)
-
Error after lastest system update
I downloaded the new update this morning and now after I start up the console if I play a game or access any of the settings. For some odd reason whenever I finish whatever i was doing the Playstation doesn't eject disks and I can't access anything e
-
Urgent: Setting character limit for JTextArea
Hi, I am newbie to java swing and I have a question. I need to set a limit of 2000 characters that can be typed in a text box(JTextArea). How do I do that? Thanks for the help.