Please help getting invalid number error.
Hi Experts,
My requirement is
If DT_ID value of xmlmsg existed in the DT_ID of PART_ID_COLLES table then that record should be processd else should be skipped.
And xmlmsg of PART_ID should start with "A" and followed only by the number then that record should be processed else should be skipped.
And xmlmsg of DD_DAYS should contain only the number and grater than or equal to 0 ,then that record should be processed else should be skipped.
For that I have written this code.
But if I pass dt_id as string value in xmlmsg I am getting invalid number error.
DT_ID of PART_ID_COLLES table is number data type.
SELECT xmlmsg.part_id part_id,xmlmsg.dd_days dd_days,xmlmsg.dt_id dt_id
FROM XMLTABLE(
XMLNAMESPACES(
'urn:schemas-microsoft-com:rowset' as "rs"
, '#RowsetSchema' as "z"
'/z:row[not(@dt_id=following-sibling::z:row/@dt_id and @part_id=following-sibling::z:row/@part_id)]'
PASSING p_dd_days_vals
COLUMNS
ITEM_NO for ordinality
, dt_id VARCHAR2 (20) path '@dt_id'
, part_id VARCHAR2 (25) path '@part_id'
, dd_days VARCHAR2 (20) path '@dd_days'
) xmlmsg,
part_id_colles pic
WHERE REGEXP_REPLACE(TRIM(xmlmsg.dt_id),'^([0-9]+)$|.','\1') = pic.dt_id
AND REGEXP_LIKE (UPPER(TRIM(xmlmsg.part_id)),'^[A][0-9]+$')
AND (TO_NUMBER(REGEXP_REPLACE(TRIM(xmlmsg.dd_days),'^([0-9]+)$|.','\1')) >=0
AND REGEXP_LIKE(TRIM(xmlmsg.dd_days), '^-?[[:digit:],.]*$') ;
Sample message is
<MESSAGES>
<MESSAGE ID="12345">
<MSG_ID>3026900</MSG_ID>
<DT_POSTED>6/20/2013 08:15:48</DT_POSTED>
<POSTED_BY>GPD_MSG_EXTRACTOR</POSTED_BY>
<DT_LAST_QUEUED />
<MSG>
<WORK_SET TRANSACTION_ID="@TRANS_ID" TRANSACTION_TYPE="Batch" IS_ACID="@IS_ACID">
<WORK_UNIT GROUP="dd_days" ACTION="ADD" AFFECTED="dd_days">
<RECORDSET TABLE_NAME="dd_days">
<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<rs:data>
<z:row dt_id="430" part_id="A5556689" dd_days="10"/>
<z:row dt_id="550A" part_id="A8889965" dd_days="20"/>
</rs:data>
</xml>
</RECORDSET>
</WORK_UNIT>
</WORK_SET>
</MSG>
</MESSAGE>
</MESSAGES>
Please help me.
Thanks.
Your code has ton of errors. Anyway:
with part_id_colles as (
select 430 dt_id,xmltype('<MESSAGES>
<MESSAGE ID="12345">
<MSG_ID>3026900</MSG_ID>
<DT_POSTED>6/20/2013 08:15:48</DT_POSTED>
<POSTED_BY>GPD_MSG_EXTRACTOR</POSTED_BY>
<DT_LAST_QUEUED />
<MSG>
<WORK_SET TRANSACTION_ID="@TRANS_ID" TRANSACTION_TYPE="Batch" IS_ACID="@IS_ACID">
<WORK_UNIT GROUP="dd_days" ACTION="ADD" AFFECTED="dd_days">
<RECORDSET TABLE_NAME="dd_days">
<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<rs:data>
<z:row dt_id="430" part_id="A5556689" dd_days="10"/>
<z:row dt_id="550A" part_id="A8889965" dd_days="20"/>
</rs:data>
</xml>
</RECORDSET>
</WORK_UNIT>
</WORK_SET>
</MSG>
</MESSAGE>
</MESSAGES>') p_dd_days_vals from dual)
SELECT xmlmsg.part_id part_id,
xmlmsg.dd_days dd_days,
xmlmsg.dt_id dt_id
FROM part_id_colles pic,
XMLTABLE(
XMLNAMESPACES(
'urn:schemas-microsoft-com:rowset' as "rs",
'#RowsetSchema' as "z"
'/MESSAGES/MESSAGE/MSG/WORK_SET/WORK_UNIT/RECORDSET/xml/rs:data/z:row[not(@dt_id=following-sibling::z:row/@dt_id and @part_id=following-sibling::z:row/@part_id)]'
PASSING p_dd_days_vals
COLUMNS
ITEM_NO for ordinality,
dt_id VARCHAR2 (20) path '@dt_id',
part_id VARCHAR2 (25) path '@part_id',
dd_days VARCHAR2 (20) path '@dd_days'
) xmlmsg
WHERE REGEXP_REPLACE(TRIM(xmlmsg.dt_id),'^([0-9]+)$|.','\1') = pic.dt_id
AND REGEXP_LIKE(UPPER(TRIM(xmlmsg.part_id)),'^[A][0-9]+$')
AND TO_NUMBER(REGEXP_REPLACE(TRIM(xmlmsg.dd_days),'^([0-9]+)$|.','\1')) >=0
AND REGEXP_LIKE(TRIM(xmlmsg.dd_days), '^-?[[:digit:],.]*$')
PART_ID DD_DAYS DT_ID
A5556689 10 430
SQL>
SY.
Similar Messages
-
TO_CHAR to convert date getting 'Invalid number' error
I am trying to convert a static date value using TO_CHAR function but I can't believe I am not able to do it such a simple conversion.
//Obviously this is easy and everyone would like to give this as an example and this is what I see everwhere on Google and it works.
SELECT TO_CHAR(sysdate, 'YYYY-MM-DD') FROM DUAL;
How can I make it work like this?
SELECT TO_CHAR('2010-JUN-23', 'YYYY-MM-DD') FROM DUAL;
I keep getting "Invalid number" error. I changed my constant date to different formats but none works.Your first literal is not a date, assuming you didn't set NLS_DATE_FORMAT.
So the code should have been
SELECT TO_CHAR(to_date('2010-JUN-23','YYYY-MON-DD'), 'YYYY-MM-DD') FROM DUAL;
Please note DATEs are always converted to VARCHAR2 when you SELECT them, using NLS_DATE_FORMAT.
When you use a DATE string literal it ias always implicitly converted to a real date, by using NLS_DATE_FORMAT.
So if you want all your dates formatted as YYYY-MON-DD, you need to set NLS_DATE_FORMAT to that mask.
Sybrand Bakker
Senior Oracle DBA -
TO_NUMBER getting invalid number error
I want to use TO_NUMBER function to converse some float number,
but the following query always gets invalid number error:
select to_number('12.1073') from dual;
but if I add the format in, it runs as expected:
select to_number('12.1073', '99.9999') from dual;
From the syntax, the format parameter is optional, is it only optional for integers?
Thanks!Same here.
So, or you replace dot by comma, or you change the territory (or nls_numeric_characters) defined for your session :
SQL> select to_number('12.1073') from dual;
select to_number('12.1073') from dual
ERROR at line 1:
ORA-01722: invalid number
Elapsed: 00:00:00.00
SQL> alter session set nls_territory='america';
Session altered.
Elapsed: 00:00:00.00
SQL> select to_number('12.1073') from dual;
TO_NUMBER('12.1073')
12.1073
Elapsed: 00:00:00.00
SQL> alter session set nls_territory='france';
Session altered.
Elapsed: 00:00:00.00
SQL> select to_number('12.1073') from dual;
select to_number('12.1073') from dual
ERROR at line 1:
ORA-01722: invalid number
Elapsed: 00:00:00.00
SQL> alter session set nls_numeric_characters='.,';
Session altered.
Elapsed: 00:00:00.00
SQL> select to_number('12.1073') from dual;
TO_NUMBER('12.1073')
12.1073
Elapsed: 00:00:00.00
SQL> Nicolas. -
Trying to complete profile - get invalid number error
I'm attempting to complete my Skype profile, but am running into a problem when trying to enter my mobile number. I've entered it as xxxxxxxxxx and xxx-xxx-xxxx, neither seems acceptable. The error says, "It looks like you entered an invalid number - try again, so friends will have more ways to contact you." Not sure what I'm doing wrong. I'm in the US and am attempting to use Skype Web (beta). Need to use this for a call on Monday.
Your first literal is not a date, assuming you didn't set NLS_DATE_FORMAT.
So the code should have been
SELECT TO_CHAR(to_date('2010-JUN-23','YYYY-MON-DD'), 'YYYY-MM-DD') FROM DUAL;
Please note DATEs are always converted to VARCHAR2 when you SELECT them, using NLS_DATE_FORMAT.
When you use a DATE string literal it ias always implicitly converted to a real date, by using NLS_DATE_FORMAT.
So if you want all your dates formatted as YYYY-MON-DD, you need to set NLS_DATE_FORMAT to that mask.
Sybrand Bakker
Senior Oracle DBA -
Invalid number error when calculating with sysdate
Hello - I am getting invalid number error for query below:
SELECT *
FROM
trkg
WHERE
trkg.tran_type=500
AND
trkg.mod_date_time>sysdate-0.5
I am not sure what is wrong with above query. Strange part is that it executes fine in one environmnet and returns 'invalid number' error in other environmnet? Please help me find missing setting.more information:
Table1: LOCN_HDR with field locn_brcd and locn_id
locn_brcd locn_id
26001A 0000086
26002A 0000087
26001B 0000088
Table2: PICK_LOCN with field LOCN_ID
locn_id
0000086
0000087
0000088
Table3: TRKG with field from_locn and mod_date_time (this is timestamp field)
from_locn mod_date_Time
0000086 29-MAY-13 10.09.23.000000000 AM
0000087 29-MAY-13 10.11.48.000000000 AM
0000088 31-MAY-13 04.07.21.000000000 PM
Now I combine Table1 and Table3
select * from appwms.locn_hdr lh
join
(SELECT lh.locn_brcd,trkg.mod_Date_Time from appwms.trkg
join appwms.locn_hdr lh
on trkg.FROM_LOCN = lh.LOCN_ID
where
trkg.TRAN_TYPE = 500
and trkg.mod_Date_time>sysdate-5
) trkg1 on lh.locn_brcd=trkg1.locn_brcd
-- returns values correctly
Now when I join another table to above (ie table 2), it returns 'invalid number'
select * from appwms.locn_hdr lh
join
(SELECT lh.locn_brcd,trkg.mod_Date_Time from appwms.trkg
join appwms.locn_hdr lh
on trkg.FROM_LOCN = lh.LOCN_ID
where
trkg.TRAN_TYPE = 500
and trkg.mod_Date_time>sysdate-5
) trkg1 on lh.locn_brcd=trkg1.locn_brcd
join
(select pld.locn_id,lh.locn_brcd
from APPWMS.PICK_LOCN PLD join appwms.locn_hdr lh
on pld.locn_id = lh.LOCN_ID ) picklocn on picklocn.locn_brcd=lh.locn_brcd
why are rows returned with one join? when i have more than one join why does it return error 'invalid number'. -
When calling to phone, I get "Invalid number" to n...
Hi,
I had SIM card from one mobile provider in Ireland and I have moved my number to other mobile provider. After successful transfer I am not able to call to my number (+35389xxxxxxx) from skype and I get "invalid number" error message.
I was able to call before transfer.
Is it skype problem or new mobile provider bad transfer problem?
Thanks
Solved!
Go to Solution.SauLius wrote:
Is new mobile provider bad transfer problem?
Yes it is. Please contact your provider.
TIME ZONE - US EASTERN. LOCATION - PHILADELPHIA, PA, USA.
I recommend that you always run the latest Skype version: Windows & Mac
If my advice helped to fix your issue please mark it as a solution to help others.
Please note that I generally don't respond to unsolicited Private Messages. Thank you. -
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 -
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')); -
Getting 'Invalid argument' error while uisng OPEN DATASET. Help!
Hi Experts,
I am trying to read a file from a shared server location using OPEN DATASET as shown below.
OPEN DATASET file_name FOR INPUT IN TEXT MODE ENCODING UTF-8 MESSAGE msg.
The file_name i gave is '
CNSGN-PRE-DM.COM\FUNCTIONAL\INVENTORY.CSV'.
The program compiles perfectly. But when I run the program I am getting 'Invalid argument' error. I have checked the authorization to the server, file name, file availability and everything is fine.
Strangely this code was working fine a week ago.
What could be the problem? Kindly help me!
Thanks
GopalHi Chndrasekhar,
You mean to say the we cannot use OPEN DATASET for reading file in shared server location. For example a shared folder in my PC.
Is there something wrong in the file name path I have given? It started with '//'. Do I have to start the file path wih 'file://..'?
Thanks
Gopal -
Please help me with this error I keep getting for attachments
please help me with my error message as I can't download attachments
Some information would be helpful... operating system, email client, Reader version, error message, ...
-
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.. -
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. -
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> -
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
Maybe you are looking for
-
Error in XXL_FULL_API function module for download report to excel
Hi all, I am using XXL_FULL_API function module for download report to excel, In this FM we have to fill a table called sema = t_gxxlt_s. in this table we have a fields called i_sema-col_no = 19. i_sema-col_src = 19. i_sema-col_typ = 'STR
-
Hi I am getting the following error while calling a service in BPEL. Error while reading wsdl file http://afsmlnx07.onerheem.com:7105/soa-infra/services/default/validationForCC/getStatusByCC?WSDL.Exception:WSDLException:faultCODE=OTHER_ERROR:Failed t
-
Can I change the default phone number format?
I a new BB user and have so much to learn! I got a Storm (bad choice) 6 weeks ago and thought BBs were ridiculous. Then I got the Tour and am pobably converted for life. In my contacts, most of my phone numbers show up as 4395551234 which is hard t
-
Im trying to use my messaging, but its telling me that my password is wrong...what should i do?
-
Premier Elements 10 video playback is very poor and choppy
When I look at my mts files inusing premier elements 10, the video looks really bad. But when I look at the same videos using windows media player they look fine. Any idea on how I can get my videos to look good in Premier elements? I have a new high