Whats wrong with my query
Hi All
I have the following query, the pupose is to get the count of BIN_DATA_ID's for the first 2 days (48 hours). I have a start date and end date, but i need to get only 48hours or 2days worth of data from a week or more worth of data.
SELECT bin_data_id, CEIL (end_intv_time / 100) AS end_intv_time, direction,
traffic_sample_id,
start_date, end_date,end_date_1, ROW_NUMBER,days,
COUNT (bin_data_id) OVER (PARTITION BY traffic_sample_id) AS COUNT
from
SELECT ROW_NUMBER () OVER (PARTITION BY t1.traffic_sample_id ORDER BY t1.bin_data_id)
AS ROW_NUMBER,
t1.traffic_sample_id,
SUM (t1.bin_1_data + bin_2_data + bin_3_data) AS SUM,
SUM ( t1.bin_10_data
+ t1.bin_11_data
+ t1.bin_12_data
+ t1.bin_13_data
+ t1.bin_14_data
+ t1.bin_15_data
+ t1.bin_4_data
+ t1.bin_5_data
+ t1.bin_6_data
+ t1.bin_7_data
+ t1.bin_8_data
+ t1.bin_9_data
) AS sum_1,
t1.bin_data_id, t1.direction, t1.end_intv_time,
TO_DATE (t3.start_date, 'mmddyy') AS start_date, TO_DATE (t3.end_date, 'mmddyy') AS end_date,
(TO_DATE (t3.start_date, 'mmddyy') + 2) AS end_date_1,
(TO_DATE (t3.start_date, 'mmddyy') + 2)
- TO_DATE (t3.start_date, 'mmddyy') AS days
FROM bin_data t1, location_details t2, traffic_sample t3
WHERE t1.traffic_sample_id = t2.traffic_sample_id(+)
AND t1.traffic_sample_id = t3.traffic_sample_id(+)
GROUP BY t1.traffic_sample_id,
t1.bin_data_id,
t1.direction,
t1.end_intv_time,
t3.start_date,t3.END_DATE
where row_number!='1'
and days=2
and traffic_sample_id=832I tried the above query but unscuccessfully. The data is per each hour per day so the COUNT i had in the query must give me 48 instead its giving me weeks worth count 120 (only weekdays), how do i get count for just the 48hrs or 2 days. Please need help.
Thanks
output:
TRAFFIC_SAMPLE_ID BIN_DATA_ID END_INTV_TIME START_DATE END_DATE END_DATE_1 ROW_NUMBER DAYS DAYS_1 COUNT
832 31264 11 8/26/2009 8/31/2009 8/28/2009 2 5 2 120
832 31265 12 8/26/2009 8/31/2009 8/28/2009 3 5 2 120
832 31266 13 8/26/2009 8/31/2009 8/28/2009 4 5 2 120
832 31267 14 8/26/2009 8/31/2009 8/28/2009 5 5 2 120
832 31268 15 8/26/2009 8/31/2009 8/28/2009 6 5 2 120
832 31269 16 8/26/2009 8/31/2009 8/28/2009 7 5 2 120
832 31270 17 8/26/2009 8/31/2009 8/28/2009 8 5 2 120
832 31271 18 8/26/2009 8/31/2009 8/28/2009 9 5 2 120
832 31272 19 8/26/2009 8/31/2009 8/28/2009 10 5 2 120
832 31273 20 8/26/2009 8/31/2009 8/28/2009 11 5 2 120
832 31274 21 8/26/2009 8/31/2009 8/28/2009 12 5 2 120
832 31275 22 8/26/2009 8/31/2009 8/28/2009 13 5 2 120
Similar Messages
-
select CASE WHEN TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'DDMMYYYY HH24:MM:SS'),13,2))>0 AND TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)) <14
THEN TO_DATE(CONCAT(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)||'00',SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MI:SS'),16)||'00'),'DD-MM-YYYY HH24:MI:SS') end
from table;
i have written this query.whats wrong with this query..........
the error is "literal does not match format string"
Reegards soumenWhy does your date_format loose, ununify and not fix ?
And what is your exact requirement?
>>
CASE WHEN
TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'DDMMYYYY HH24:MM:SS'),13,2))>0
AND TO_NUMBER(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)) <14
<<
This is
CASE WHEN TO_CHAR(START_TIME_TIMESTAMP,'MM') between '01' and '13'
>>
THEN TO_DATE(CONCAT(SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MM:SS'),13,2)
||'00',
SUBSTR(TO_CHAR(START_TIME_TIMESTAMP,'YYYYMMDD HH24:MI:SS'),16)||'00'),
'DD-MM-YYYY HH24:MI:SS')
<<
This is
TO_DATE(
TO_CHAR(START_TIME_TIMESTAMP,'MM"00"SS"00"),
'DD-MM-YYYY HH24:MI:SS')
Obviously, format is not matching !
SQL> select to_char(sysdate,'MM"00"SS"00') from dual;
TO_CHAR(
06004900
SQL> select to_date('06004900','DD-MM-YYYY HH24:MI:SS') from dual;
select to_date('06004900','DD-MM-YYYY HH24:MI:SS') from dual
ERROR at line 1:
ORA-01861: literal does not match format string -
What wrong with my query?
I use Oracle 10g Express Edition 10.2.0.1.0 and I have table A
x varchar2
y date
z char(1)
I would like to check existing data with query
Select Count(*) from A
where x='x'
and y=to_date('03/15/2006','mm/dd/yyyy')
and z='z';
this query always return number of all data that have date='03/15/2006'
any idea?
Thanks,
avonkcreate or replace PROCEDURE XXX(
a IN VARCHAR2 DEFAULT NULL,
b IN VARCHAR2 DEFAULT NULL,
c IN NUMBER DEFAULT NULL)
AS
line VARCHAR2(30);
stat VARCHAR2(30);
ldate VARCHAR2(30);
item CHAR(2);
shift CHAR(1);
strshift DATE;
endshift DATE;
fdate DATE;
reccount NUMBER(10,0);
CURSOR e_pbmap IS
SELECT col1, col2, col3 FROM KLM
WHERE col4 = a AND col5 = b;
BEGIN
NULL;/*DECLARE CURSOR e_pbmap */
OPEN e_pbmap;
FETCH e_pbmap INTO line, stat, item;
If e_pbmap%FOUND THEN
BEGIN
FOR rec IN ( SELECT col1, col2 FROM DSA
WHERE col3 = a)
LOOP
shift := rec.col1 ;
endshift := rec.col2 ;
END LOOP;
shift := NVL(shift, '0');
FOR rec IN ( SELECT col1 FROM sa.PQR
WHERE LINENAME = a AND SHIFT = shift)
LOOP
strshift := rec.col1 ;
END LOOP;
IF endshift > strshift THEN
ldate:=TO_CHAR(SYSDATE(),'mm/dd/yyyy');
ELSE
ldate:=TO_CHAR((SYSDATE()-1),'mm/dd/yyyy');
END IF;
fdate:=TO_DATE(ldate,'mm/dd/yyyy');
/* This query has trouble */
SELECT COUNT(*) INTO reccount FROM XYZ
WHERE col1 = a AND FDATE=fdate AND col2 = shift AND
col3 = stat;
/* its always return number of all data that FDATE=fdate regardless col1 and
col2*/
IF reccount >0 THEN
BEGIN
UPDATE XYZ SET MyColumn=c WHERE LINENAME = a AND
FDATE=fdate AND SHIFT = shift AND STATION = stat;
END;
ELSE
BEGIN
INSERT INTO XYZ(col1,col2,col3) VALUES(a,b,c);
END;
END IF;
FETCH e_pbmap INTO line, stat, item;
END;
END IF;
CLOSE e_pbmap;
NULL;
END SET_PUSH_BTN_SUMM; -
Hi
I have a view which is obtained by using multiple unions, sub queries which made the query complex. The view works good and gives correct data when i select all the records from the view. But the problem is when I use where clause and filter then it is giving me an error message which is shown below. In other words "select * from view" works good but "select * from view where dateran >to_date('3/3/2011','mm/dd/yyyy') ".
Now I dont understand is why the query is not working when I use the where clause. Can any one tell what could be the reason?
ERROR MESSAGE
+"ORA-01427: single-row subquery returns more than one row+
+01427. 00000 - "single-row subquery returns more than one row"+
Thanks,CREATE OR replace FORCE VIEW "SECO"."D_REWORK_REPORT_V"
("MATERIALID", "CUSTOMER", "ORDER#", "PRODUCT", "STEELGRADEID", "GAUGE", "WIDTH"
, "DEFECTCODE", "DEFECTCOMMENT", "RESPONSIBLEUNIT", "SEVERITY", "COMMENTS",
"ENTRYCOIL", "ENTRYWEIGHT", "DATERAN", "SHIFTDATERAN")
AS
SELECT
/*+ USE_HASH */ mf.me_id materialid,
tp.customername,
v.au_nr order#,
taup.productid product,
taup.sc_steelgradeid steelgrade,
taup.coilorderthickness thick,
taup.coilorderwidth width,
mf.fehlertyp defectcode,
ft.displaytext defectcomment,
mf.fehlerverursacher
unitresponsible,
mf.auspraegung priority,
mf.bemerkung comments,
(SELECT matbezeichnung
FROM matereignis c
WHERE c.me_id = v.me_id
AND bemerkung = 'process scrap'
AND subtyp = 'Produktion'
AND dtstorno IS NULL
AND matbezeichnung = (SELECT a.matbezeichnung
FROM d_matevents_v a
WHERE me_id = v.me_id
AND dtstorno IS NULL
AND a.ereignisid =
ereignisiderfassung))
entrytcoil,
(SELECT aftergew
FROM d_matevents_v c
WHERE c.me_id = v.me_id
AND c.ereignisid = ereignisiderfassung) entryweight,
(SELECT erstelldatum
FROM matereignis c
WHERE c.me_id = v.me_id
AND bemerkung = 'process scrap'
AND subtyp = 'Produktion'
AND dtstorno IS NULL
AND matbezeichnung = (SELECT a.matbezeichnung
FROM d_matevents_v a
WHERE me_id = v.me_id
AND dtstorno IS NULL
AND a.ereignisid =
ereignisiderfassung))
dateran,
(SELECT CASE
WHEN To_number(To_char(erstelldatum, 'HH24')) < 7
THEN
erstelldatum - 1
ELSE erstelldatum
END
FROM matereignis c
WHERE c.me_id = v.me_id
AND bemerkung = 'process scrap'
AND subtyp = 'Produktion'
AND dtstorno IS NULL
AND matbezeichnung = (SELECT a.matbezeichnung
FROM d_matevents_v a
WHERE me_id = v.me_id
AND dtstorno IS NULL
AND a.ereignisid =
ereignisiderfassung))
shiftdateran
FROM matfehler mf,
matfehler_prj mfp,
tap_prj tp,
taup_prj taup,
vlfehlerverursacher_v fv,
vlfehlertyp_v ft,
vlfehlerauspraegung_v fa,
d_matevents_v v
WHERE mf.me_id = v.me_id
AND v.au_nr = tp.au_nr(+)
AND tp.au_nr = taup.au_nr(+)
AND mf.fehlerverursacher = fv.fehlerverursacher(+)
AND mf.fehlerverursacher <> 'TAC'
AND mf.fehlertyp = ft.fehlertyp(+)
AND mf.auspraegung = fa.auspraegung(+)
AND mf.me_id = mfp.me_id
AND mf.lfd_nr = mfp.lfd_nr
AND v.fa_nr LIKE '%-%'
AND v.bemerkung = 'kmpL3TMArb.processTTM_REPORT_TO_L3'
AND v.dtstorno IS NULL
AND Trunc (mf.erstelldatum) BETWEEN
To_date ('01/01/'
|| ( To_char (SYSDATE,
'YYYY') - 1
'MM/DD/YYYY') AND Trunc (SYSDATE)
AND v.ereignisid = (SELECT MIN (ereignisid)
FROM matereignis a
WHERE a.fa_nr LIKE '%-%'
AND Nvl (a.bemerkung, 'A') =
'kmpL3TMArb.processTTM_REPORT_TO_L3'
AND a.dtstorno IS NULL
AND a.me_id = v.me_id
AND 2 = (SELECT COUNT (DISTINCT
matbezeichnung
FROM matereignis b
WHERE b.fa_nr LIKE '%-%'
AND b.me_id = a.me_id
AND b.dtstorno IS NULL)
GROUP BY a.me_id)
AND ereignisiderfassung = (SELECT MAX (a.ereignisid)
FROM matereignis a
WHERE a.me_id = v.me_id
AND a.ereignisid < v.ereignisid
AND a.dtstorno IS NULL
AND ( a.ausloeser = 'DIALOG'
OR a.ausloeser =
'MaterialQM_MPanel' )
AND ( a.bemerkung != 'Unblocking'
OR Substr (a.bemerkung, 1, 9)
=
'kmpSIVPES'
UNION
SELECT
/*+ USE_HASH */ mf.me_id
materialid,
tp.customername,
v.au_nr
order#,
taup.productid
product,
taup.sc_steelgradeid
steelgrade,
taup.coilorderthickness
thick,
taup.coilorderwidth
width,
mf.fehlertyp
defectcode,
ft.displaytext
defectcomment,
mf.fehlerverursacher
unitresponsible,
mf.auspraegung
priority,
mf.bemerkung
comments,
matbezeichnung
entrytcoil,
aftergew
entryweight,
(SELECT erstelldatum
FROM matereignis c
WHERE c.me_id = v.me_id
AND bemerkung = 'process scrap'
AND subtyp = 'Produktion'
AND dtstorno IS NULL
AND matbezeichnung = (SELECT a.matbezeichnung
FROM d_matevents_v a
WHERE me_id = v.me_id
AND dtstorno IS NULL
AND a.ereignisid =
v.ereignisid))
dateran,
(SELECT CASE
WHEN To_number(To_char(erstelldatum, 'HH24')) < 7
THEN
erstelldatum - 1
ELSE erstelldatum
END
FROM matereignis c
WHERE c.me_id = v.me_id
AND bemerkung = 'process scrap'
AND subtyp = 'Produktion'
AND dtstorno IS NULL
AND matbezeichnung = (SELECT a.matbezeichnung
FROM d_matevents_v a
WHERE me_id = v.me_id
AND dtstorno IS NULL
AND a.ereignisid =
v.ereignisid))
shiftdateran
FROM matfehler mf,
matfehler_prj mfp,
tap_prj tp,
taup_prj taup,
vlfehlerverursacher_v fv,
vlfehlertyp_v ft,
vlfehlerauspraegung_v fa,
d_matevents_v v
WHERE mf.me_id = v.me_id
AND v.au_nr = tp.au_nr(+)
AND tp.au_nr = taup.au_nr(+)
AND mf.fehlerverursacher = fv.fehlerverursacher(+)
AND mf.fehlertyp = ft.fehlertyp(+)
AND mf.auspraegung = fa.auspraegung(+)
AND mf.me_id = mfp.me_id
AND mf.lfd_nr = mfp.lfd_nr
AND v.fa_nr LIKE '%-%'
AND Trunc (mf.erstelldatum) BETWEEN
To_date ('01/01/'
|| ( To_char (SYSDATE,
'YYYY') - 1
'MM/DD/YYYY') AND Trunc (SYSDATE)
-- If a coil gets a rework more than 2 times, get the first record
AND v.ereignisid = (SELECT MIN (ereignisid)
FROM matereignis a
WHERE a.fa_nr LIKE '%-%'
AND a.dtstorno IS NULL
AND a.me_id = v.me_id
AND 2 < (SELECT COUNT (DISTINCT
matbezeichnung
FROM matereignis b
WHERE b.fa_nr LIKE '%-%'
AND b.me_id = a.me_id
AND b.dtstorno IS NULL)
GROUP BY a.me_id)
AND ereignisiderfassung = (SELECT MAX (a.ereignisid)
FROM d_matevents_v a
WHERE a.me_id = v.me_id
AND a.ereignisid <
(SELECT b.ereignisid
FROM matereignis b
WHERE b.fa_nr LIKE '%-%'
AND
b.metyp = 'Anbinden'
AND b.matbezeichnung =
v.matbezeichnung
AND b.me_id = v.me_id))
UNION
SELECT
/*+ USE_HASH */ mf.me_id
materialid,
tp.customername,
v.au_nr
order#,
taup.productid
product,
taup.sc_steelgradeid
steelgrade,
taup.coilorderthickness
thick,
taup.coilorderwidth
width,
mf.fehlertyp
defectcode,
ft.displaytext
defectcomment,
mf.fehlerverursacher
unitresponsible,
mf.auspraegung
priority,
mf.bemerkung
comments,
matbezeichnung
entrytcoil,
aftergew
entryweight,
(SELECT erstelldatum
FROM matereignis c
WHERE c.me_id = v.me_id
AND bemerkung = 'process scrap'
AND subtyp = 'Produktion'
AND dtstorno IS NULL
AND matbezeichnung = (SELECT a.matbezeichnung
FROM d_matevents_v a
WHERE me_id = v.me_id
AND dtstorno IS NULL
AND a.ereignisid =
v.ereignisid)) AS
dateran,
(SELECT CASE
WHEN To_number(To_char(erstelldatum, 'HH24')) < 7
THEN
erstelldatum - 1
ELSE erstelldatum
END
FROM matereignis c
WHERE c.me_id = v.me_id
AND bemerkung = 'process scrap'
AND subtyp = 'Produktion'
AND dtstorno IS NULL
AND matbezeichnung = (SELECT a.matbezeichnung
FROM d_matevents_v a
WHERE me_id = v.me_id
AND dtstorno IS NULL
AND a.ereignisid =
v.ereignisid)) AS
shiftdateran
FROM matfehler mf,
matfehler_prj mfp,
tap_prj tp,
taup_prj taup,
vlfehlerverursacher_v fv,
vlfehlertyp_v ft,
vlfehlerauspraegung_v fa,
d_matevents_v v
WHERE mf.me_id = v.me_id
AND v.au_nr = tp.au_nr(+)
AND tp.au_nr = taup.au_nr(+)
AND mf.fehlerverursacher = fv.fehlerverursacher(+)
AND mf.fehlertyp = ft.fehlertyp(+)
AND mf.auspraegung = fa.auspraegung(+)
AND mf.me_id = mfp.me_id
AND mf.lfd_nr = mfp.lfd_nr
AND v.fa_nr LIKE '%-%'
AND Trunc (mf.erstelldatum) BETWEEN
To_date ('01/01/'
|| ( To_char (SYSDATE,
'YYYY') - 1
'MM/DD/YYYY') AND Trunc (SYSDATE)
-- If a coil gets a rework more than 2 times, get the second record
AND v.ereignisid = (SELECT ereignisid
FROM matereignis a
WHERE a.fa_nr LIKE '%-%'
AND a.me_id = v.me_id
AND a.dtstorno IS NULL
AND ROWNUM = 1
AND a.ereignisid > (SELECT MIN (ereignisid)
FROM matereignis b
WHERE
b.fa_nr LIKE '%-%'
AND b.dtstorno IS
NULL
AND
b.me_id = a.me_id
AND 2 <
(SELECT COUNT (DISTINCT
matbezeichnung)
FROM matereignis c
WHERE
c.fa_nr LIKE '%-%'
AND
c.me_id = b.me_id
AND c.dtstorno IS
NULL)
GROUP BY a.me_id))
AND ereignisiderfassung = (SELECT MAX (a.ereignisid)
FROM d_matevents_v a
WHERE a.me_id = v.me_id
AND a.ereignisid <
(SELECT MIN (b.ereignisid)
FROM matereignis b
WHERE b.fa_nr LIKE '%-%'
AND
b.metyp = 'Anbinden'
AND b.matbezeichnung =
v.matbezeichnung
AND b.me_id = v.me_id)); -
SAMPLE DATA
CT_NO RENT_NO DUE_DATE DUE_AMT
2233 1 11-SEP-06 11800
2233 2 11-OCT-06 11800
2233 3 11-NOV-06 11800
2233 4 11-DEC-06 11800
2233 5 11-JAN-07 11800
2233 6 11-FEB-07 50000
2233 7 11-MAR-07 11800
2233 8 11-APR-07 11800
2233 9 11-MAY-07 11800
2233 10 11-JUN-07 11800
2233 11 11-JUL-07 11800
2233 12 11-AUG-07 50000
2233 13 11-SEP-07 11800
2233 14 11-OCT-07 11800
2233 15 11-NOV-07 11800
2233 16 11-DEC-07 11800
2233 17 11-JAN-08 11800
2233 18 11-FEB-08 50000
2233 19 11-MAR-08 11800
2233 20 11-APR-08 11800
2233 21 11-MAY-08 11800
2233 22 11-JUN-08 11800
2233 23 11-JUL-08 11800
2233 24 11-AUG-08 50000
2233 25 11-SEP-08 11800
2233 26 11-OCT-08 11800
2233 27 11-NOV-08 11800
2233 28 11-DEC-08 11800
2233 29 11-JAN-09 11800
2233 30 11-FEB-09 50000
2233 31 11-MAR-09 11800
2233 32 11-APR-09 11800
2233 33 11-MAY-09 11800
2233 34 11-JUN-09 11800
2233 35 11-JUL-09 11800
2233 36 11-AUG-09 50000
2233 37 11-SEP-09 11800
2233 38 11-OCT-09 11800
2233 39 11-NOV-09 11800
2233 40 11-DEC-09 11800
2233 41 11-JAN-10 11800
2233 42 11-FEB-10 50000
2233 43 11-MAR-10 11800
2233 44 11-APR-10 11800
2233 45 11-MAY-10 11800
2233 46 11-JUN-10 11800
2233 47 11-JUL-10 11800
2233 48 11-AUG-10 50000
My QUERY
select
count(distinct(case when b.due_date <='15-feb-2010' then b.rent_no else 0 end))ovd_due,
SUM(case when rcv_dt is null or RCV_DT>'15-feb-2010'
THEN due_amt
else 0
END) Rent_Bal
from le_dues b
where ct_no=2233
my result from the query
OVD_DUE RENT_BAL
43 159000here we can see tha OVE_DUE should be 42 but my query is returning 43....WHY
please correct my query.Hi,
It looks like 43 is the correct answer. The distinct values you are counting are all the integers from 0 through 42 inclusive.
Don't compare DATEs to strings. For example
when b.due_date <='15-feb-2010' is asking for trouble. Use TO_DATE or a DATE literal:
when b.due_date <= DATE '2010-02-15' instead.
If you don't want to count 0, don''t include 0 in the list of things to be counted.
COUNT ( DISTINCT CASE
WHEN b.due_date <= TO_DATE ( '15-feb-2010'
, 'DD-Mon-YYYY'
AND b.rent_no != 0 -- If needed (probably not; unclear from example)
THEN b.rent_no
END
) AS ovd_due, -
Pleas what is wrong with this query
select h.business_unit_id bu, h.edi_sequence_id seq, d.edi_det_sequ_id dseq, s.edi_size_sequ_id sseq, h.po_number po, h.total_unit tUnit, h.total_amount tDollar, s.quantity qty, s.unit_price price,
(select (case when count(*) = 0 then 'N' else 'Y' end)
from(select s.business_unit_id, s.edi_sequence_id, s.edi_det_sequ_id, s.edi_size_sequ_id
from sewn.nt_edii_purchase_size s
where s.business_unit_id='01'
and s.edi_sequence_id = '168420'
and (s.edi_sequence_id, s.edi_det_sequ_id, s.edi_size_sequ_id) not in
(select edi_sequence_id, edi_det_sequ_id, edi_size_sequ_id
from sewn.nt_edii_po_det_error
where business_unit_id = '01'
and edi_sequence_id='168420'
and error_code in(select error_code
from sewn.nt_edii_error_codes
where severity='CR'))))eligible
from sewn.nt_edii_purchase_size s, sewn.nt_edii_purchase_det d,
sewn.nt_edii_purchase_hdr h
where h.business_unit_id = '01'
and h.edi_sequence_id = '168420'
and h.business_unit_id = d.business_unit_id
and h.edi_sequence_id = d.edi_sequence_id
and d.business_unit_id = s.business_unit_id
and d.edi_sequence_id = s.edi_sequence_id
and d.edi_det_sequ_id = s.edi_det_sequ_id
group by h.business_unit_id, h.edi_sequence_id, d.edi_det_sequ_id,
s.edi_size_sequ_id,h.po_number, h.total_unit, h.total_amount, s.quantity,s.unit_priceNever mind, I got it working
-
Whats wrong with the sql query-- giving no rows selected
i have a table audit_data with 4 columns , eff_m & end_m are declared as timestamp and the time stamp data is different for all the records
Please advice as soon as possible as this is a production problem
ORG_GRP_I grn_n ED_EFF_m (timestamp) ED_END_M OFV
1 999 01-Jan-06 1 03-Aug-06 0 0
1 999 28-Jul-06 0 04-Aug-06 1 0
1 999 04-Aug-06 1 04-Aug-06 1 0
1 999 04-Aug-06 0 6.08
This query is giving no rows returned,even though there is data in database
SELECT NVL(OFV,0)
FROM audit_data ag
WHERE ag.ORG_GRP_I = 1
AND ag.GRN_N = 999
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_data 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'));
This query is giving value 6.08, when made type conversions.
what wrong with the above query.please advice
SELECT NVL(OFV,0)
FROM audit_data ag
WHERE ag.ORG_GRP_I = 1
AND ag.GRN_n = 999
AND (to_date(to_char(ag.ED_EFF_M,'mm/dd/yyyy'),'mm/dd/yyyy'),NVL(to_date(to_char(ag.ED_END_M,'mm/dd/yyyy'),'mm/dd/yyyy'),SYSDATE)) IN
(SELECT MAX(to_date(to_char(ED_EFF_M,'mm/dd/yyyy'),'mm/dd/yyyy')),MAX(NVL(ED_END_M,SYSDATE))
FROM audit_data 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('08/04/2006','MM/DD/YYYY')
AND To_Date(To_Char(NVL(ag2.ED_END_M,SYSDATE),'MM/DD/YYYY'),'MM/DD/YYYY') >= TO_DATE('08/04/2006','MM/DD/YYYY'));In the second query you convert a string to a date correctly using TO_DATE(string,date format)
In the first query you try to make a char of something that already is a char, e.g. TO_CHAR('08/04/06','MM/DD/YYYY').
The TO_CHAR functions expects either a number or a date as its first parameter. That's why it's giving you a ORA-01722. -
Whats wrong with code??
hello guys...i am having some problems..the application runs fine until it reaches this bit of code..
if(mode=="w"){
System.out.println(" mode is weekly");
try{
ps4 =con.prepareStatement("UPDATE property SET tid=?,start=curdate(),days_due=adddate(start, 7) WHERE pid=?");
ps4.setInt(1, tid);
ps4.setInt(2, pid);
ps4.executeUpdate();
catch(SQLException e1){
e1.printStackTrace();
else if(mode=="m"){
System.out.println(" mode is monthly");
try{
ps4 =con.prepareStatement("UPDATE property SET tid=?,start=curdate(),days_due=adddate(start, 31) WHERE pid=?");
ps4.setInt(1, tid);
ps4.setInt(2, pid);
ps4.executeUpdate();
System.out.println(" property update query executed");
catch(SQLException e2){
System.out.println("property update Query not executed");
e2.printStackTrace();
whats wrong with it?this part
if(mode=="w"){should be:
if(mode.equals("w")){and this part:
else if(mode=="m"){should be:
else if(mode.equals("m")){ -
When I try to power up my iphone 4 32g, it will stay on the apple screen for a few seconds then turn off. even when I try connecting it to my computer it turns on for a few seconds then turns off. Whats wrong with it? and what do I do about it?
Have you tried charging it with another known working USB sync cable? After letting it sit to "charge" for at least 30 minutes, have you tried resetting the device by pressing and holding both the Select/Center and Menu buttons together long enough for the Apple logo to appear.
B-rock -
My phone has been asked to be plugged into itunes for the past hour or so, and it has been plugged in the whole time... i have tried holding in both buttons too turn it on and nothing is happening... whats wrong with it and how do i fix this :(?
Does iTunes see your phone?
Do you have a PC or a Mac?
~Lyssa -
when i open itunes, it gives me a message "the folder itunes is on a locked disk or you do not have write permissions for this folder" i am the only user and it was working a week ago whats wrong with it? it will not open itunes
Hi lvdmerwe!
I have two articles here for you that should be able to help you troubleshoot this issue further:
Trouble adding music to iTunes library or importing audio CD
http://support.apple.com/kb/ts1387
iTunes: Missing folder or incorrect permissions may prevent authorization
http://support.apple.com/kb/ts1277
Take care, and thanks for visiting the Apple Support Communities.
-Braden -
i if use "search" in music on my ipod touch 5th gen the result just show only album and playlist but nothing song result.whats wrong with it?please help
The users guide says:
Spotlight searches the following:
Contacts—All content
Apps—Titles
Music—Names of songs, artists, and albums, and the titles of podcasts and videos
Podcasts—Titles
Videos—Titles
Audiobooks—Titles
Notes—Text of notes
Calendar (Events)—Event titles, invitees, locations, and notes
Mail—To, From, and Subject fields of all accounts (the text of messages isn’t searched)
Reminders—Titles
Messages—Names and text of messages
Try:
- Reset the iOS device. Nothing will be lost
Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
least ten seconds, until the Apple logo appears.
- Unsynce all music and resync
- Reset all settings
Go to Settings > General > Reset and tap Reset All Settings.
All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
- Restore from backup
- Restore to factory settings/new iOS device.
- Make an appointment at the Genius Bar of an Apple store.
Apple Retail Store - Genius Bar -
HELP PLEASE - WHATS WRONG WITH THIS CODE
Hi. I get this message coming up when I try to compile the code,
run:
java.lang.NullPointerException
at sumcalculator.SumNumbers.<init>(SumNumbers.java:34)
at sumcalculator.SumNumbers.main(SumNumbers.java:93)
Exception in thread "main"
Java Result: 1
BUILD SUCCESSFUL (total time: 2 seconds)
I am not sure whats wrong with the code. Any assistance would be nice. The code is below.
package sumcalculator;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class SumNumbers extends JFrame implements FocusListener {
JTextField value1;
JTextField value2;
JLabel equals;
JTextField sum;
JButton add;
JButton minus;
JButton divide;
JButton multiply;
JLabel operation;
public SumNumbers() {
SumNumbersLayout customLayout = new SumNumbersLayout();
getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
getContentPane().setLayout(customLayout);
value1.addFocusListener(this);
value2.addFocusListener(this);
sum.setEditable(true);
value1 = new JTextField("");
getContentPane().add(value1);
value2 = new JTextField("");
getContentPane().add(value2);
equals = new JLabel("label_1");
getContentPane().add(equals);
sum = new JTextField("");
getContentPane().add(sum);
add = new JButton("+");
getContentPane().add(add);
minus = new JButton("-");
getContentPane().add(minus);
divide = new JButton("/");
getContentPane().add(divide);
multiply = new JButton("*");
getContentPane().add(multiply);
operation = new JLabel();
getContentPane().add(operation);
setSize(getPreferredSize());
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
public void focusGained(FocusEvent event){
try {
float total = Float.parseFloat(value1.getText()) +
Float.parseFloat(value2.getText());
sum.setText("" + total);
} catch (NumberFormatException nfe) {
value1.setText("0");
value2.setText("0");
sum.setText("0");
public void focusLost(FocusEvent event){
focusGained(event);
public static void main(String args[]) {
SumNumbers window = new SumNumbers();
window.setTitle("SumNumbers");
window.pack();
window.show();
class SumNumbersLayout implements LayoutManager {
public SumNumbersLayout() {
public void addLayoutComponent(String name, Component comp) {
public void removeLayoutComponent(Component comp) {
public Dimension preferredLayoutSize(Container parent) {
Dimension dim = new Dimension(0, 0);
Insets insets = parent.getInsets();
dim.width = 711 + insets.left + insets.right;
dim.height = 240 + insets.top + insets.bottom;
return dim;
public Dimension minimumLayoutSize(Container parent) {
Dimension dim = new Dimension(0, 0);
return dim;
public void layoutContainer(Container parent) {
Insets insets = parent.getInsets();
Component c;
c = parent.getComponent(0);
if (c.isVisible()) {c.setBounds(insets.left+24,insets.top+48,128,40);}
c = parent.getComponent(1);
if (c.isVisible()) {c.setBounds(insets.left+256,insets.top+48,128,40);}
c = parent.getComponent(2);
if (c.isVisible()) {c.setBounds(insets.left+408,insets.top+48,56,40);}
c = parent.getComponent(3);
if (c.isVisible()) {c.setBounds(insets.left+488,insets.top+48,152,40);}
c = parent.getComponent(4);
if (c.isVisible()) {c.setBounds(insets.left+128,insets.top+136,72,40);}
c = parent.getComponent(5);
if (c.isVisible()) {c.setBounds(insets.left+248,insets.top+136,72,40);}
c = parent.getComponent(6);
if (c.isVisible()) {c.setBounds(insets.left+368,insets.top+136,72,40);}
c = parent.getComponent(7);
if (c.isVisible()) {c.setBounds(insets.left+488,insets.top+136,72,40);}
c = parent.getComponent(8);
if (c.isVisible()) {c.setBounds(insets.left+176,insets.top+48,56,40);}
}Thank you. How do i amend this? I have defined value1though.Yes, you did - but after the call to addFocusListener(...). It needs to be before it.
BTW, you did the same thing with "value2.addFocusListener(this)" and "sum.setEditable(true)" on the next two lines. You're attempting to call a method on an object that doesn't exist yet (i.e., you haven't called new yet). -
I have the Iphone 3gs and it said update required and i needed to connect to itunes so i did al that and now everytime i go to restore everything it just says error and then i have to do it again?whats wrong with it?
Are you getting an error message number with your error message? If so, what number are you getting?
-
My lap top is extremly slow. It studders. It kind of sounds like there is a fan inside and it constantly stopping and starting. And, it takes a really long time for it too start up. Whats wrong with it?
Do you have current backups?
Those symptoms could indicate a failing Hard drive. If it dies, all your documents go with it unless you have Backups.
I have had very good luck with physical and battery problem diagnosis at the Genius Bar. Those guys put their hands (and their ears) to these machines, all day every day, and they know immediately what all those sounds mean.
Your appointment for an evaluation is FREE, in warranty or out.
Maybe you are looking for
-
Need some help in SQL...
Sorry for asking before doing a search. I really don't know what is the keyword to do this search. my case is i want a report to show now many Documents created in yesterday and it is group by hours so i have write the following SQL: select TO_char(x
-
Yet another Try Catch question. Iterating through a ForEach loop
Confused on error handling in a Powershell ForEach loop. I'm looping through a list of registry keys, attempting to open each one. If it succeeds, I do a bunch of stuff. If it fails, I want to skip to the next iteration. If I was doing It in VBScrip
-
Should installation of a blu-ray with wirelesss cause a conflict with an existing home network.. Laptop will not connect to the dlink now
-
Inserting WEBI into Live Office with Bex query
I have created a WEBI connected directly to a Bex query in BI 4.0. When I refresh the WEBI, I am prompted with the Bex variable and the data is refreshed correctly. I added that WEBI to Live Office, but it does not prompt me with the Bex variable.
-
How to read jpg image from a specified path
Hi I am having an image in jpg ext, so i am using File nf = new File(path);to read the image, now i have to place that jpg image in an byte/String array so from that i will save that in to the Oracle DB with BLOB data type, plz answer to this asap wi