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 AM
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
-
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 - 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 -
To_number function and the "invalid number" error
Dear all,
I have searched the forum for threads relating to the ORA-01722: invalid number error, could not find the answer I am looking for.
What I was trying to do was
select * from table1 where to_number(field1) > 1000
field1 is a varchar2 data type.
I tried all sorts of things i.e using fmt, nls params as defined in the documentation, nothing worked.
Though the practical problem was solved by
select * from table1 where field1 > '1000'
I would still like to know why this error occurs. Can someone help ?
Regards
CrusoeI think the database engine should simply return the rows that successfully convert to number and meet the where condition Oracle does not work in that way ;)
Then try this...
Just you need to add the below where clause to your source query. as this will retrieve only the number, to_number should work without any problem.
But still you have to create a subquery to escape the invalid number error.
PRAZY@11gR1> select * from tablea;
FIELD1
123
123.345
45
AVC
23.234.234
ABC.234
345.45
7 rows selected.
Elapsed: 00:00:00.00
PRAZY@11gR1> select to_number(field1) from tablea where rtrim(trim(regexp_replace(field1,'\.','',1,1)),'0123456789') is null;
TO_NUMBER(FIELD1)
123
123.345
45
345.45
4 rows selected.
Elapsed: 00:00:00.01Regards,
Prazy
Edited by: Prazy on Mar 23, 2010 4:00 PM -
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')); -
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 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.
Maybe you are looking for
-
Hi all, I am attaching my labview code with this post. My problem is that the code runs correctly with "write to lvm file" applette. Without this aplette the waveform shows a continuous graph. But when I add this applette to store the data, the wave
-
MSI K8N Neo Platinum (MS-7030) Performance on 3000+ (socket 754)
I want to thank many guys for their help on various posts on these forums. I found out many useful tips on my newly built system but seems I have missed something somewhere... The problem is that my system seems to perform a bit low. On the following
-
Is the iTunes in the cloud active for Belgium
I m trying to activate / access my purchased music on the iCloud but my iPad only shows me the apps & iBooks as available for automatic download I'm wondering whether this may be because this "new" option may not be yet available in belgium ? Is ther
-
Watching a tv program while it's still recording
Hi is it possible to watch a tv programe while it's recording. For example if the progame starts at 9.00pm and finishes at 10.00pm and I get in about 9.30pm can I start watching the program or do I need to wait for the show to finish before I can sta
-
How do I deactivate Creative Suite 3 from a computer I no longer have access to?
How do I deactivate Creative Suite 3 from a computer I no longer have access to?