Decode and group by Query
The following query throws up 'Not a group by Expression' Error:
select decode(visited_last_date,sysdate,'Present','null') ,forum_name
from disc_forum f, disc_emp_pref p
where f.forum_category='TSP'
and f.forum_short_name=p.forum_short_name group by f.forum_short_name
How can i get this working? I need to retain the group-by clause.
Thanx Detlev,
The query works with the group fn. But the actual query that i'm working on is:
select DECODE(visited_last_date,sysdate,'<img src="/images/on.gif">','null') img, ''| |f.forum_name| |'' forum_name, count(message_id) Posts, to_char(max(m.posted_date),'DD-MON-YYYY') last_updated from disc_message m, disc_thread t,disc_forum f,disc_emp_pref p where f.forum_category=nvl(:category,f.forum_category) and f.forum_short_name=t.forum_short_name(+) and t.thread_id=m.thread_id(+) group by cube(f.forum_name,f.forum_short_name,f.forum_description,p.visited_last_date)
I'm using this query to build a report in Oracle Portal. This query is working only that i'm getting duplicate rows. If i don't include the visited_last_date in the group_by clause then it flags a 'Not a group-by expr' error. How do i avoid that
Similar Messages
-
Join "Decode" and a "Simple Query"
Hi everyone, i have two queries which i have failed to join.
The first query is:
select "STUDENTDETAILS"."TITLE" as "TITLE",
"STUDENTDETAILS"."FIRSTNAME" as "FIRSTNAME",
"STUDENTDETAILS"."MIDDLENAME" as "MIDDLENAME",
"STUDENTDETAILS"."LASTNAME" as "LASTNAME",
"STUDENTDETAILS"."DATEOFBIRTH" as "DATEOFBIRTH",
"STUDENTDETAILS"."AGE" as "AGE",
"STUDENTDETAILS"."GENDER" as "GENDER",
"STUDENTDETAILS"."MARRITAL_STATUS" as "MARRITAL_STATUS",
"STUDENTDETAILS"."NRC_NUMBER" as "NRC_NUMBER",
"STUDENTDETAILS"."REGISTERED_BY" as "REGISTERED_BY",
"STUDENTDETAILS"."APPLICATIONNUMBER" as "APPLICATIONNUMBER",
"ADDRESS"."PHONE_NUMBER1" as "PHONE_NUMBER1",
"ADDRESS"."PHONE_NUMBER2" as "PHONE_NUMBER2",
"ADDRESS"."E-MAIL_ADDRESS" as "E-MAIL_ADDRESS",
"ADDRESS"."ADDRESS1" as "ADDRESS1",
"ADDRESS"."ADDRESS2" as "ADDRESS2",
"ADDRESS"."COMPOUND" as "COMPOUND",
"ADDRESS"."POSTAL_BOX" as "POSTAL_BOX",
"ADDRESS"."DISTRICT" as "DISTRICT",
"ADDRESS"."PROVINCE" as "PROVINCE"
from "ADDRESS" "ADDRESS",
"STUDENTDETAILS" "STUDENTDETAILS"
where "ADDRESS"."APPLICATIONNUMBER"="STUDENTDETAILS"."APPLICATIONNUMBER"
Second query is:
select studentdetails.
applicationnumber
,min(DECODE(SUBJECT,'MATHEMATICS', SUBJECT_SCORE)) as "MATHEMATICS"
,min(DECODE(SUBJECT,'ENGLISH', SUBJECT_SCORE)) as "ENGLISH"
,min(DECODE(SUBJECT,'BIOLOGY', SUBJECT_SCORE)) as "BIOLOGY"
,min(DECODE(SUBJECT,'SCIENCE', SUBJECT_SCORE)) as "SCIENCE"
,min(DECODE(SUBJECT,'COMMERCE', SUBJECT_SCORE)) as "COMMERCE"
,min(DECODE(SUBJECT,'ZAMBIAN LANGUAGE', SUBJECT_SCORE)) as "ZAMBIAN LANGUAGE"
,min(DECODE(SUBJECT,'ART', SUBJECT_SCORE)) as "ART"
from "SUBJECTS" "SUBJECTS",
"STUDENT_SCORES" "STUDENT_SCORES",
"STUDENTDETAILS" "STUDENTDETAILS"
where "STUDENTDETAILS"."APPLICATIONNUMBER"="STUDENT_SCORES"."APPLICATIONNUMBER"
and "STUDENT_SCORES"."SUBJECT_ID"="SUBJECTS"."SUBJECT_ID"
group by studentdetails.applicationnumber
order by studentdetails.applicationnumber
i need to join the two to have this:
APPLICATIONNUMBER
TITLE
FIRSTNAME
MIDDLENAME
LASTNAME
DATEOFBIRTH
AGE
GENDER
MARRITAL_STATUS
NRC_NUMBER
REGISTERED_BY
MATHEMATICS
ENGLISH
BIOLOGY
SCIENCE
COMMERCE
ZAMBIAN LANGUAGE
ART
201300001
Mr
Lawrence
Mukombo
12/11/1980
33
Male
Married
219879/24/1
SYSTEM
2
1
4
3
4
5
1
Thanks in advanceHi,
We do not know anything about your data model.
It is impossible help without sample data.
Also, this is Application Express forum and your question do not relate anyhow this product.
You should post these kind questions in SQL and PL/SQL forum.
Regards,
Jari -
Sorting and Grouping -Two months in this query
Hi All,
many thanks for jeneesh
i am doing project for construction company, i face this problem in grouping points according to relation between these points the
Relation is from 1 to 100. If the point between this rang that mean there is relation between these points.
this question already solve but the results not correct when the table has more data.
SQL - sorting and grouping.
from jeneesh and many thanks for him.
This example for more clarifications
for example i have these points
id location percentage comments
1 loc 1,2 20% that mean point 1 and 2 close to each other by 20%
2 loc 1,3 40% that mean point 1 and 3 close to each other byy 40%
3 Loc 8,6 25% that mean point 8 and 6 close to each other by 25%
4 Loc 6,10 20%
5 LOC 11,10 10 %
6 LOC 15,14 0%Also , we can see the relation between these points as follwoing
- points 1,2,3 in one group why becuase 1,2 has relation and 1,3 has relation that mean 1,3 also has hidden relation.
- Points 6,8,10,11 in second group there are relations between them .
- but no relation between 1 or 2 or 3 with any point of 6,8,9,10,11
- as well as no relation between 15, 14 that mean 14 in third group and 15 in fourth group.
whati need?
to group the points that has relation according to percentage value ascending
The most important part is to group the points. SO , the below query the gropuing is not correct.
I have the follwoing table with data
drop table temp_value;
create table temp_value(id number(10),location varchar2(20), percentage number(9));
insert into temp_value values (1,'LOC 1,2',10);
insert into temp_value values (2,'LOC 1,3',0);
insert into temp_value values (3,'LOC 1,4',0);
insert into temp_value values (4,'LOC 1,5',0);
insert into temp_value values (5,'LOC 1,6',0);
insert into temp_value values (6,'LOC 2,3',0);
insert into temp_value values(7,'LOC 2,4',0);
insert into temp_value values (8,'LOC 2,5',30);
insert into temp_value values (9,'LOC 2,6',0);
insert into temp_value values (10,'LOC 3,4',0);
insert into temp_value values (11,'LOC 3,5',0);
insert into temp_value values (12,'LOC 4,5',40);
insert into temp_value values (13,'LOC 4,6',0);
insert into temp_value values (14,'LOC 6,7',40);
insert into temp_value values (15,'LOC 7,2',0);
insert into temp_value values (16,'LOC 8,2',60);
insert into temp_value values (17,'LOC 8,3',0);
insert into temp_value values (18,'LOC 3,1',0);
insert into temp_value values (19,'LOC 9,6',30);
insert into temp_value values (20,'LOC 11,2',0);
insert into temp_value values (22,'LOC 12,3',10);
insert into temp_value values (23,'LOC 19,3',0);
insert into temp_value values (24,'LOC 17,3',0);
insert into temp_value values (24,'LOC 20,3',0);when i used this query , the results is not correct
with t as
(select percentage,loc1,loc2,sum(case when percentage = 0 then 1
when loc1 in (l1,l2) then 0
when loc2 in (l1,l2) then 0
when l1 is null and l2 is null then 0
else 1
end) over(order by rn) sm
from ( select id,location,percentage,
regexp_substr(location,'\d+',1,1) LOC1,
regexp_substr(location,'\d+',1,2) LOC2,
lag(regexp_substr(location,'\d+',1,1))
over(order by percentage desc) l1,
lag(regexp_substr(location,'\d+',1,2))
over(order by percentage desc) l2,
row_number() over(order by percentage desc) rn
from temp_value
order by percentage desc
select loc,min(sm)+1 grp
from(
select loc,rownum rn,sm
from(
select percentage,decode(rn,1,loc1,loc2) loc,sm
from t a,
(select 1 rn from dual union all
select 2 from dual ) b
order by percentage desc,decode(rn,1,loc1,loc2) asc
group by loc
order by min(sm),min(rn);the results
SQL> /
LOC GRP
2 1
8 1
6 2
7 2
4 3
5 3
9 4
1 5
12 6
3 6
11 13
LOC GRP
19 14
17 15
20 22
14 rows selected.SQL>
but the correct is
Location group No
2 1
8 1
4 1
5 1
1 1
6 2
7 2
9 2
12 3
3 3
19 4
17 5
20 6many thanks in advance.
Edited by: Ayham on Nov 30, 2012 3:07 AMThanks,
i want the sorting for each group DESC not all groups to gather
when i used your query i get
SQL> with connects as (
2 select distinct
3 loc1
4 ,loc2
5 ,dense_rank() over (order by connect_by_root(loc1)) grp
6 from temp_value
7 start with
8 percentage != 0
9 connect by nocycle
10 (prior loc2 = loc1
11 or
12 prior loc1 = loc2
13 or
14 prior loc1 = loc1
15 or
16 prior loc2 = loc2)
17 and
18 percentage != 0
19 )
20 , got_grp AS
21 (
22 select
23 loc
24 ,dense_rank() over (order by grp) grp
25 from (
26 select
27 loc
28 ,max(grp) keep (dense_rank first order by grp) grp
29 from (
30 select
31 loc1 loc
32 ,grp
33 from connects
34 union
35 select
36 loc2
37 ,grp
38 from connects
39 )
40 group by
41 loc
42 )
43 )
44 SELECT loc
45 , grp
46 FROM got_grp
47 ORDER BY COUNT (*) OVER (PARTITION BY grp) DESC
48 , grp
49 , loc
50 ;The output is
LOC GRP
1 1
2 1
4 1
5 1
8 1
6 3
7 3
9 3
12 2
3 2
10 rows selected.but i want it like this
Loc Grp
2 1
8 1
4 1
5 1
1 1
12 2
3 2
6 3
7 3
9 3So , the sorting for each group Separate based on the percentage column.
many thanks
Edited by: Ayham on Nov 30, 2012 9:43 AM -
Rewrite the query with out joins and group by
Hi,
This was an interview question.
Table Names: bookshelf_checkout
bookshelf
And the join condition between these two tables is title
We need to rewrite below query without using join condition and group by clause ?
SELECT b.title,max(bc.returned_date - bc.checkout_date) "Most Days Out"
FROM bookshelf_checkout bc,bookshelf b
WHERE bc.title(+)=b.title
GROUP BY b.title;When I was in college, I read that most of the SELECT statements can be replaced by basic SQL operations (SET OPERATORS). Now I am trying to rewrite the query with SET operators but not able to get the exact result.
Kindly help me on this.
Thanks,
SuriSomething like this?
1 WITH books AS (
2 SELECT 'title 1' title FROM dual UNION ALL
3 SELECT 'title 2' FROM dual UNION ALL
4 SELECT 'title 3' FROM dual ),
5 bookshelf AS (
6 SELECT 'title 1' title, DATE '2012-05-01' checkout_date, DATE '2012-05-15' returned_date FROM dual UNION ALL
7 SELECT 'title 1' title, DATE '2012-05-16' checkout_date, DATE '2012-05-20' returned_date FROM dual UNION ALL
8 SELECT 'title 2' title, DATE '2012-04-01' checkout_date, DATE '2012-05-15' returned_date FROM dual )
9 SELECT bs.title, MAX(bs.returned_date - bs.checkout_date) OVER (PARTITION BY title) FROM bookshelf bs
10 UNION
11 (SELECT b.title, NULL FROM books b
12 MINUS
13* SELECT bs.title, NULL FROM bookshelf bs)
SQL> /
TITLE MAX(BS.RETURNED_DATE-BS.CHECKOUT_DATE)OVER(PARTITIONBYTITLE)
title 1 14
title 2 44
title 3Lukasz -
Sharepont Designer saves AND/OR CAML Query groups incorrectly
My objective is to display active tasks on a certain date: Started on or before and Due on or after; Started on or before and not Completed. The date is provided via a webpart connection parameter.
I used CAML Designer 2013 and SP CAML Query 2013 to verify and then modified the Query string for the Tasks WebPart in Sharepoint Designer as follows:
<Query><Where>
<Or>
<And>
<Leq><FieldRef Name="StartDate"/><Value Type="DateTime">{ParmMeetingDate}</Value></Leq>
<Geq><FieldRef Name="DueDate"/><Value Type="DateTime">{ParmMeetingDate}</Value></Geq>
</And>
<And>
<Neq><FieldRef Name="Status"/><Value Type="Text">Completed</Value></Neq>
<Leq><FieldRef Name="StartDate"/><Value Type="DateTime">{ParmMeetingDate}</Value></Leq>
</And>
</Or>
</Where></Query>
However, when I save the page in SharePoint Designer, and edit the web page from the browser, the Filter criteria are:
Start date Less than or equal to {ParmMeetingDate}
AND DueDate Greater than or equal to
AND Task Status is not equal to Completed
OR Start Date is less than or equal to {ParmMeetingDate}
If I correct the settings in the browser and save, the Query String in SPD is changed to:
<Query><Where>
<Or><Or>
<And>
<Leq><FieldRef Name="StartDate"/><Value Type="DateTime">{ParmMeetingDate}</Value></Leq>
<Geq><FieldRef Name="DueDate"/><Value Type="DateTime">{ParmMeetingDate}</Value></Geq>
</And>
<Leq><FieldRef Name="StartDate"/><Value Type="DateTime">{ParmMeetingDate}</Value></Leq>
</Or>
<Neq><FieldRef Name="Status"/><Value Type="Text">Completed</Value></Neq>
</Or></Where></Query>
How can I get SPD/SP to save the CAML query correctly?Update: Another effect of the problem outlined above was that no results were displayed for any parameterised filter values - regardless of the query.
I came across a reference to the Server Render webpart attribute. When this attribute is selected on the webpart a number of things happen:
The Timeline at the top of the Tasks list view webpart is switched off
The completed icon changes to a Yes/No value
The filters work!!!
Saving the filters works!!!
The List View Tools tab appears in SharePoint Designer!!!
I have no idea what the Server Render attribute is and/or why it is set off by default. I don't why it affects the appearance of the List View Tools tab in the ribbon - I can't think of any reason why it should. And I don't know why it affects
the filter query or why it should...
At a high level I presume the Server Render attribute tells sharepoint to process on the server rather than on the client. It may make sense to pas the processing from the server to the client. It makes no sense that this would restrict functionality
(disable List View Tolls in SPD) or produce different results (no results in Filtered webpart).
Do you know if this issue has been identified as a bug; has it been resolved? -
Problem using DECODE() function with a Query of Queries
I
posted
on my blog about an issue I was having trying to use the PL/SQL
DECODE() function with a Coldfusion Query of Queries. This function
works fine when you query a database for information. However, when
you query another query, it seems that CF doesn't recognize it. I
got errors stating that it found a left parenthesis where it
expected a FROM key word. Here is a simplified version of what I am
trying to do:
quote:
<!--- Simulated query; similar to what I was calling from
my database --->
<cfscript>
qOriginal = queryNew("Name,Email,CountryCode",
"VarChar,VarChar,VarChar");
newRow = queryAddRow(qOriginal, 5);
querySetCell(qOriginal, "Name", "Joe", 1);
querySetCell(qOriginal, "Email", "[email protected]", 1);
querySetCell(qOriginal, "CountryCode", "AMER", 1);
querySetCell(qOriginal, "Name", "Sally", 2);
querySetCell(qOriginal, "Email", "[email protected]", 2);
querySetCell(qOriginal, "CountryCode", "AMER", 2);
querySetCell(qOriginal, "Name", "Bob", 3);
querySetCell(qOriginal, "Email", "[email protected]", 3);
querySetCell(qOriginal, "CountryCode", "ASIA", 3);
querySetCell(qOriginal, "Name", "Mary", 4);
querySetCell(qOriginal, "Email", "[email protected]", 4);
querySetCell(qOriginal, "CountryCode", "EURO", 4);
querySetCell(qOriginal, "Name", "John", 5);
querySetCell(qOriginal, "Email", "[email protected]", 5);
querySetCell(qOriginal, "CountryCode", "EURO", 5);
</cfscript>
<cfquery name="qCountries" dbtype="query">
SELECT DISTINCT(CountryCode) AS CountryCode,
DECODE(states, "AMER", "North America & Canada",
"EURO", "Europe & Africa", "ASIA", "Japan &
Asia","") CountryName
FROM qOriginal
ORDER BY CountryCode
</cfquery>
<cfdump var="#qCountries#">
<!--- ========== END OF CODE ========== --->
So running this returned the following error:
Query Of Queries syntax error.
Encountered "(. Incorrect Select Statement, Expecting a
'FROM', but encountered '(' instead, A select statement should have
a 'FROM' construct.
Does anybody know why this doesn't work? Is it just not
supported? Please note that I have also tried to use the CASE()
function instead of DECODE() and that resulted in basically the
same error. For now I an looping over my distinct query with a
switch statement and manually loading a new query with the data how
I want it. But it would be a lot cleaner and less code to have the
DECODE() to work. Thx!DECODE() is an Oracle function, not generic SQL. Q-of-Q is a
very limited subset of SQL and lacks many functions and clauses
available in standard SQL, especially what you may be used to using
in your particular RDBMS.
See
Query
of Queries user guide
Phil -
Partition Name in Select and Group-By
Is there a function that returns the partition name a row is stored in? I'd like to use it in a SELECT statement, if it exists.
The goal is to get row counts per partition to determine skew on a hash-based partition (otherwise, I'd just select and group-by the partition key). I want to do something like this:
SELECT PARTITION_NAME, COUNT(*) as PER_PART_COUNT
FROM SOMETABLE
GROUP BY PARTITION_NAME;Obviously, I would replace the string "*PARTITION_NAME*" with whatever function returns that value.
NOTE: Before the forum sharks jump all over me, I did search the documentation and forums, but I came up empty handed.Hi,
This is hokey - but you can use the undocumented function "tbl$or$idx$part$num" like so:
SELECT atp.partition_name
, COUNT (*) AS count_rows
FROM all_tab_partitions atp
, (SELECT tbl$or$idx$part$num ("SCOTT"."TAB1"
, 0
, 1
, 0
, partition_col1 -- your 1st partition key column
, partition_col2 -- your 2nd partition key column
) AS part_num
, 'TAB1' AS table_name
, 'SCOTT' AS owner
FROM scott.tab1) pt
WHERE atp.table_name = pt.table_name
AND atp.table_owner = pt.owner
AND atp.partition_position = pt.part_num
GROUP BY atp.partition_name;Note - this probably won't perform well at all... but it could be an option...
Message was edited by:
PDaddy
... On 2nd thought - don't do it - it seems it is pretty unstable - brought my session to a halt a couple of times... Forget I mentioned it :)
... On 3rd thought - if you add ROWNUM - it works fine - seems you need to materialize the result set in the inner query - like so:
CREATE TABLE part_tab (part_key int
, a int
partition by range (part_key)
(partition p1 values less than (100)
,partition p2 values less than (200)
,partition p3 values less than (maxvalue)
insert into part_tab
select rownum
, rownum
FROM all_objects
where rownum <= 1000; SELECT atp.partition_name
, COUNT(*) AS count_rows
FROM all_tab_partitions atp
, (SELECT TBL$OR$IDX$PART$NUM("PART_TAB", 0, 1, 0, part_key) AS part_num
, 'PART_TAB' AS table_name
, user AS owner
, ROWNUM AS rn -- Materialize the result set by adding ROWNUM...
FROM part_tab) pt
WHERE atp.table_name = pt.table_name
AND atp.table_owner = pt.owner
AND atp.partition_position = pt.part_num
GROUP BY atp.partition_name; -
"median count" in a single group by query
Hallo following problem:
i use a single group by query to analyze a data table.
like "select avg(parameter1), sum(parameter2), count(case when...end) from datatable where ....".
Following problem: I want a median of a count without rewriting the query completely, accessing the table several times or something.
Easy example - in Detail:
Create table and fill with example data
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> CREATE TABLE datatable
2 (
3 SLOT NUMBER
4 , DATA NUMBER
5 );
Table created.
SQL> INSERT INTO datatable VALUES (1,1);
1 row created.
SQL> INSERT INTO datatable VALUES (1,2);
1 row created.
SQL> INSERT INTO datatable VALUES (1,3);
1 row created.
SQL> INSERT INTO datatable VALUES (1,4);
1 row created.
SQL> INSERT INTO datatable VALUES (1,5);
1 row created.
SQL> INSERT INTO datatable VALUES (2,1);
1 row created.
SQL> INSERT INTO datatable VALUES (3,1);
1 row created.
SQL> INSERT INTO datatable VALUES (3,2);
1 row created.
SQL> INSERT INTO datatable VALUES (3,3);
1 row created.
SQL> INSERT INTO datatable VALUES (3,4);
1 row created.
SQL> INSERT INTO datatable VALUES (3,5);
1 row created.
SQL> INSERT INTO datatable VALUES (4,1);
1 row created.
SQL> INSERT INTO datatable VALUES (4,2);
1 row created.
SQL> INSERT INTO datatable VALUES (4,3);
1 row created.
SQL> INSERT INTO datatable VALUES (4,4);
1 row created.
SQL> INSERT INTO datatable VALUES (4,5);
1 row created.
SQL> INSERT INTO datatable VALUES (5,1);
1 row created.
SQL> INSERT INTO datatable VALUES (5,2);
1 row created.
SQL> INSERT INTO datatable VALUES (5,3);
1 row created.
SQL> INSERT INTO datatable VALUES (5,4);
1 row created.
SQL> INSERT INTO datatable VALUES (5,5);
1 row created.In the table there are several items (here slots) with a for each slot unique data-value.
I want to have the median count of data values, to filter out slots with more or less values.
this worked, until there where only slots with less data:
SQL> SELECT FLOOR(COUNT(DISTINCT SLOT||DATA)/COUNT(DISTINCT DATA)) FROM datatabl
e;
FLOOR(COUNT(DISTINCTSLOT||DATA)/COUNT(DISTINCTDATA))
4but when there is a slot having more data - it won't work, the very simple and stupid calculation will give a too little value
SQL>
SQL> INSERT INTO datatable VALUES (4,6);
1 row created.
SQL>
SQL> SELECT FLOOR(COUNT(DISTINCT SLOT||DATA)/COUNT(DISTINCT DATA)) FROM datatabl
e;
FLOOR(COUNT(DISTINCTSLOT||DATA)/COUNT(DISTINCTDATA))
3so what i would need is this:
SQL>
SQL> SELECT MEDIAN(count(DISTINCT SLOT) over (partition by DATA)) FROM datatable
SELECT MEDIAN(count(DISTINCT SLOT) over (partition by DATA)) FROM datatable
ERROR at line 1:
ORA-30483: window functions are not allowed hereIn detail:
the count delivers the distinct count of slots for each data (possible duplicated entrys should not be counted)
And I want the median, which should be 4.
SQL> SELECT count(DISTINCT SLOT) over (partition by DATA) FROM datatable;
COUNT(DISTINCTSLOT)OVER(PARTITIONBYDATA)
5
5
5
5
5
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
COUNT(DISTINCTSLOT)OVER(PARTITIONBYDATA)
1
22 rows selected.Is it -anyhow- possible to do this without rebuilding the whole query?
Thanks a lotok, an example:
CREATE TABLE "DATATABLE"
( "TOOL" CHAR(5 BYTE),
"SLOT" NUMBER,
"LOTID" CHAR(4 BYTE),
"STEP" VARCHAR2(44 BYTE),
"ENDTIME" DATE,
"PARAMETER1" NUMBER,
"PARAMETER6" NUMBER
Insert into DATATABLE values ('TOOL1',-1,'LOT1','STEP1',to_timestamp('02-FEB-12 03.09.42 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',-1,'LOT1','STEP2',to_timestamp('02-FEB-12 03.18.47 PM','DD-MON-RR HH.MI.SS AM'),42,0);
Insert into DATATABLE values ('TOOL1',-1,'LOT1','STEP3',to_timestamp('02-FEB-12 03.09.44 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',-1,'LOT1','STEP4',to_timestamp('02-FEB-12 02.20.38 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',-1,'LOT1','STEP5',to_timestamp('02-FEB-12 02.20.35 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',1,'LOT1','STEP1',to_timestamp('02-FEB-12 01.51.28 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',1,'LOT1','STEP2',to_timestamp('02-FEB-12 01.52.40 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',1,'LOT1','STEP3',to_timestamp('02-FEB-12 01.54.20 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',1,'LOT1','STEP4',to_timestamp('02-FEB-12 01.55.32 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',1,'LOT1','STEP5',to_timestamp('02-FEB-12 01.56.36 PM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',2,'LOT1','STEP1',to_timestamp('02-FEB-12 01.52.41 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',3,'LOT1','STEP1',to_timestamp('02-FEB-12 02.00.29 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',3,'LOT1','STEP2',to_timestamp('02-FEB-12 02.01.43 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',3,'LOT1','STEP3',to_timestamp('02-FEB-12 02.03.23 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',3,'LOT1','STEP4',to_timestamp('02-FEB-12 02.04.34 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',3,'LOT1','STEP5',to_timestamp('02-FEB-12 02.05.40 PM','DD-MON-RR HH.MI.SS AM'),19,0);
Insert into DATATABLE values ('TOOL1',4,'LOT1','STEP1',to_timestamp('02-FEB-12 02.02.11 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',4,'LOT1','STEP2',to_timestamp('02-FEB-12 02.03.26 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',4,'LOT1','STEP3',to_timestamp('02-FEB-12 02.05.07 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',4,'LOT1','STEP4',to_timestamp('02-FEB-12 02.06.19 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',4,'LOT1','STEP5',to_timestamp('02-FEB-12 02.07.27 PM','DD-MON-RR HH.MI.SS AM'),20,0);
Insert into DATATABLE values ('TOOL1',5,'LOT1','STEP1',to_timestamp('02-FEB-12 02.03.54 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',5,'LOT1','STEP2',to_timestamp('02-FEB-12 02.05.08 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',5,'LOT1','STEP3',to_timestamp('02-FEB-12 02.06.49 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',5,'LOT1','STEP4',to_timestamp('02-FEB-12 02.08.01 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',5,'LOT1','STEP5',to_timestamp('02-FEB-12 02.14.26 PM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',6,'LOT1','STEP1',to_timestamp('02-FEB-12 02.05.35 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',6,'LOT1','STEP2',to_timestamp('02-FEB-12 02.06.50 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',6,'LOT1','STEP3',to_timestamp('02-FEB-12 02.15.14 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',6,'LOT1','STEP4',to_timestamp('02-FEB-12 02.16.26 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',6,'LOT1','STEP5',to_timestamp('02-FEB-12 02.17.31 PM','DD-MON-RR HH.MI.SS AM'),19,0);
Insert into DATATABLE values ('TOOL1',7,'LOT1','STEP1',to_timestamp('02-FEB-12 02.06.42 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',8,'LOT1','STEP1',to_timestamp('02-FEB-12 02.14.14 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',8,'LOT1','STEP2',to_timestamp('02-FEB-12 02.15.29 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',8,'LOT1','STEP3',to_timestamp('02-FEB-12 02.17.09 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',8,'LOT1','STEP4',to_timestamp('02-FEB-12 02.18.22 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',8,'LOT1','STEP5',to_timestamp('02-FEB-12 02.23.31 PM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',9,'LOT1','STEP1',to_timestamp('02-FEB-12 02.58.14 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',9,'LOT1','STEP2',to_timestamp('02-FEB-12 02.15.32 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',9,'LOT1','STEP3',to_timestamp('02-FEB-12 02.59.30 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',9,'LOT1','STEP4',to_timestamp('02-FEB-12 03.01.15 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',9,'LOT1','STEP5',to_timestamp('02-FEB-12 03.07.52 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',10,'LOT1','STEP1',to_timestamp('02-FEB-12 02.23.20 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',10,'LOT1','STEP2',to_timestamp('02-FEB-12 02.24.39 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',10,'LOT1','STEP3',to_timestamp('02-FEB-12 02.26.19 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',10,'LOT1','STEP4',to_timestamp('02-FEB-12 02.27.30 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',10,'LOT1','STEP5',to_timestamp('02-FEB-12 02.28.34 PM','DD-MON-RR HH.MI.SS AM'),17,0);
Insert into DATATABLE values ('TOOL1',11,'LOT1','STEP1',to_timestamp('02-FEB-12 02.59.37 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',11,'LOT1','STEP2',to_timestamp('02-FEB-12 03.10.51 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',11,'LOT1','STEP3',to_timestamp('02-FEB-12 02.24.52 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',11,'LOT1','STEP4',to_timestamp('02-FEB-12 03.12.03 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',11,'LOT1','STEP5',to_timestamp('02-FEB-12 03.13.41 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',12,'LOT1','STEP1',to_timestamp('02-FEB-12 02.32.30 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',12,'LOT1','STEP2',to_timestamp('02-FEB-12 02.33.43 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',12,'LOT1','STEP3',to_timestamp('02-FEB-12 02.35.24 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',12,'LOT1','STEP4',to_timestamp('02-FEB-12 02.36.35 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',12,'LOT1','STEP5',to_timestamp('02-FEB-12 02.37.41 PM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',13,'LOT1','STEP1',to_timestamp('02-FEB-12 02.34.11 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',13,'LOT1','STEP2',to_timestamp('02-FEB-12 02.35.26 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',13,'LOT1','STEP3',to_timestamp('02-FEB-12 02.37.06 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',13,'LOT1','STEP4',to_timestamp('02-FEB-12 02.38.19 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',13,'LOT1','STEP5',to_timestamp('02-FEB-12 02.39.29 PM','DD-MON-RR HH.MI.SS AM'),17,0);
Insert into DATATABLE values ('TOOL1',14,'LOT1','STEP1',to_timestamp('02-FEB-12 02.35.54 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',14,'LOT1','STEP2',to_timestamp('02-FEB-12 02.37.08 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',14,'LOT1','STEP3',to_timestamp('02-FEB-12 02.38.48 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',14,'LOT1','STEP4',to_timestamp('02-FEB-12 02.40.01 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',14,'LOT1','STEP5',to_timestamp('02-FEB-12 02.41.13 PM','DD-MON-RR HH.MI.SS AM'),13,0);
Insert into DATATABLE values ('TOOL1',15,'LOT1','STEP1',to_timestamp('02-FEB-12 02.37.37 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',15,'LOT1','STEP2',to_timestamp('02-FEB-12 02.38.52 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',15,'LOT1','STEP3',to_timestamp('02-FEB-12 02.40.33 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',15,'LOT1','STEP4',to_timestamp('02-FEB-12 02.41.46 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',15,'LOT1','STEP5',to_timestamp('02-FEB-12 02.42.58 PM','DD-MON-RR HH.MI.SS AM'),17,0);
Insert into DATATABLE values ('TOOL1',16,'LOT1','STEP1',to_timestamp('02-FEB-12 02.39.20 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',16,'LOT1','STEP2',to_timestamp('02-FEB-12 02.40.34 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',16,'LOT1','STEP3',to_timestamp('02-FEB-12 02.42.16 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',16,'LOT1','STEP4',to_timestamp('02-FEB-12 02.43.29 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',16,'LOT1','STEP5',to_timestamp('02-FEB-12 02.44.42 PM','DD-MON-RR HH.MI.SS AM'),15,0);
Insert into DATATABLE values ('TOOL1',17,'LOT1','STEP1',to_timestamp('02-FEB-12 02.41.04 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',17,'LOT1','STEP2',to_timestamp('02-FEB-12 02.42.19 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',17,'LOT1','STEP3',to_timestamp('02-FEB-12 02.43.59 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',17,'LOT1','STEP4',to_timestamp('02-FEB-12 02.45.13 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',17,'LOT1','STEP5',to_timestamp('02-FEB-12 02.46.26 PM','DD-MON-RR HH.MI.SS AM'),13,0);
Insert into DATATABLE values ('TOOL1',18,'LOT1','STEP1',to_timestamp('02-FEB-12 02.42.49 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',18,'LOT1','STEP2',to_timestamp('02-FEB-12 02.44.03 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',18,'LOT1','STEP3',to_timestamp('02-FEB-12 02.45.44 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',18,'LOT1','STEP4',to_timestamp('02-FEB-12 02.47.01 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',18,'LOT1','STEP5',to_timestamp('02-FEB-12 02.48.10 PM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',19,'LOT1','STEP1',to_timestamp('02-FEB-12 02.44.33 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',19,'LOT1','STEP2',to_timestamp('02-FEB-12 02.45.47 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',19,'LOT1','STEP3',to_timestamp('02-FEB-12 02.47.31 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',19,'LOT1','STEP4',to_timestamp('02-FEB-12 02.48.45 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',19,'LOT1','STEP5',to_timestamp('02-FEB-12 02.49.58 PM','DD-MON-RR HH.MI.SS AM'),14,0);
Insert into DATATABLE values ('TOOL1',20,'LOT1','STEP1',to_timestamp('02-FEB-12 02.46.17 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',20,'LOT1','STEP2',to_timestamp('02-FEB-12 02.47.31 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',20,'LOT1','STEP3',to_timestamp('02-FEB-12 02.49.16 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',20,'LOT1','STEP4',to_timestamp('02-FEB-12 02.50.31 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',20,'LOT1','STEP5',to_timestamp('02-FEB-12 02.51.42 PM','DD-MON-RR HH.MI.SS AM'),14,0);
Insert into DATATABLE values ('TOOL1',21,'LOT1','STEP1',to_timestamp('02-FEB-12 02.48.01 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',21,'LOT1','STEP2',to_timestamp('02-FEB-12 02.49.16 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',21,'LOT1','STEP3',to_timestamp('02-FEB-12 02.51.02 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',21,'LOT1','STEP4',to_timestamp('02-FEB-12 02.52.16 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',21,'LOT1','STEP5',to_timestamp('02-FEB-12 02.55.04 PM','DD-MON-RR HH.MI.SS AM'),19,0);
Insert into DATATABLE values ('TOOL1',22,'LOT1','STEP1',to_timestamp('02-FEB-12 02.49.48 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',22,'LOT1','STEP2',to_timestamp('02-FEB-12 02.51.02 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',22,'LOT1','STEP3',to_timestamp('02-FEB-12 02.52.47 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',22,'LOT1','STEP4',to_timestamp('02-FEB-12 02.55.39 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',22,'LOT1','STEP5',to_timestamp('02-FEB-12 02.56.45 PM','DD-MON-RR HH.MI.SS AM'),15,0);
Insert into DATATABLE values ('TOOL1',23,'LOT1','STEP1',to_timestamp('02-FEB-12 02.51.33 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',23,'LOT1','STEP2',to_timestamp('02-FEB-12 02.52.48 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',23,'LOT1','STEP3',to_timestamp('02-FEB-12 02.56.11 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',23,'LOT1','STEP4',to_timestamp('02-FEB-12 02.57.23 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',23,'LOT1','STEP5',to_timestamp('02-FEB-12 02.58.29 PM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',24,'LOT1','STEP1',to_timestamp('02-FEB-12 02.53.18 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',24,'LOT1','STEP2',to_timestamp('02-FEB-12 02.56.00 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',24,'LOT1','STEP3',to_timestamp('02-FEB-12 02.57.53 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',24,'LOT1','STEP4',to_timestamp('02-FEB-12 02.59.05 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',24,'LOT1','STEP5',to_timestamp('02-FEB-12 03.00.12 PM','DD-MON-RR HH.MI.SS AM'),17,0);
Insert into DATATABLE values ('TOOL1',25,'LOT1','STEP1',to_timestamp('02-FEB-12 02.56.29 PM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',25,'LOT1','STEP2',to_timestamp('02-FEB-12 02.57.44 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',25,'LOT1','STEP3',to_timestamp('02-FEB-12 02.59.35 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',25,'LOT1','STEP4',to_timestamp('02-FEB-12 03.00.46 PM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',25,'LOT1','STEP5',to_timestamp('02-FEB-12 03.07.19 PM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',-1,'LOT2','STEP1',to_timestamp('24-FEB-12 03.19.26 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',1,'LOT2','STEP1',to_timestamp('24-FEB-12 03.00.47 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',1,'LOT2','STEP2',to_timestamp('24-FEB-12 03.02.56 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',1,'LOT2','STEP3',to_timestamp('24-FEB-12 03.03.56 AM','DD-MON-RR HH.MI.SS AM'),19,0);
Insert into DATATABLE values ('TOOL1',2,'LOT2','STEP1',to_timestamp('24-FEB-12 03.02.22 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',2,'LOT2','STEP2',to_timestamp('24-FEB-12 03.05.06 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',2,'LOT2','STEP3',to_timestamp('24-FEB-12 03.06.06 AM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',3,'LOT2','STEP1',to_timestamp('24-FEB-12 03.03.56 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',3,'LOT2','STEP2',to_timestamp('24-FEB-12 03.07.15 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',3,'LOT2','STEP3',to_timestamp('24-FEB-12 03.13.53 AM','DD-MON-RR HH.MI.SS AM'),19,0);
Insert into DATATABLE values ('TOOL1',4,'LOT2','STEP1',to_timestamp('24-FEB-12 03.05.54 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',4,'LOT2','STEP2',to_timestamp('24-FEB-12 03.15.03 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',4,'LOT2','STEP3',to_timestamp('24-FEB-12 03.16.04 AM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',5,'LOT2','STEP1',to_timestamp('24-FEB-12 03.05.58 AM','DD-MON-RR HH.MI.SS AM'),0,0);
Insert into DATATABLE values ('TOOL1',5,'LOT2','STEP2',to_timestamp('24-FEB-12 03.25.35 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',5,'LOT2','STEP3',to_timestamp('24-FEB-12 03.29.56 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',5,'LOT2','STEP4',to_timestamp('24-FEB-12 03.30.57 AM','DD-MON-RR HH.MI.SS AM'),16,0);
Insert into DATATABLE values ('TOOL1',6,'LOT2','STEP1',to_timestamp('24-FEB-12 03.14.18 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',6,'LOT2','STEP2',to_timestamp('24-FEB-12 03.17.13 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',6,'LOT2','STEP3',to_timestamp('24-FEB-12 03.19.55 AM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',7,'LOT2','STEP1',to_timestamp('24-FEB-12 03.15.51 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',7,'LOT2','STEP2',to_timestamp('24-FEB-12 03.21.18 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',7,'LOT2','STEP3',to_timestamp('24-FEB-12 03.22.19 AM','DD-MON-RR HH.MI.SS AM'),19,0);
Insert into DATATABLE values ('TOOL1',8,'LOT2','STEP1',to_timestamp('24-FEB-12 03.17.50 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',8,'LOT2','STEP2',to_timestamp('24-FEB-12 03.23.28 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',8,'LOT2','STEP3',to_timestamp('24-FEB-12 03.24.29 AM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',9,'LOT2','STEP1',to_timestamp('24-FEB-12 03.21.42 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',9,'LOT2','STEP2',to_timestamp('24-FEB-12 03.25.37 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',9,'LOT2','STEP3',to_timestamp('24-FEB-12 03.26.38 AM','DD-MON-RR HH.MI.SS AM'),19,0);
Insert into DATATABLE values ('TOOL1',10,'LOT2','STEP1',to_timestamp('24-FEB-12 03.23.25 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',10,'LOT2','STEP2',to_timestamp('24-FEB-12 03.27.47 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',10,'LOT2','STEP3',to_timestamp('24-FEB-12 03.28.47 AM','DD-MON-RR HH.MI.SS AM'),19,0);
Insert into DATATABLE values ('TOOL1',11,'LOT2','STEP1',to_timestamp('24-FEB-12 03.27.44 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',11,'LOT2','STEP2',to_timestamp('24-FEB-12 03.32.06 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',11,'LOT2','STEP3',to_timestamp('24-FEB-12 03.33.07 AM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',12,'LOT2','STEP1',to_timestamp('24-FEB-12 03.29.54 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',12,'LOT2','STEP2',to_timestamp('24-FEB-12 03.34.16 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',12,'LOT2','STEP3',to_timestamp('24-FEB-12 03.35.17 AM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',13,'LOT2','STEP1',to_timestamp('24-FEB-12 03.32.04 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',13,'LOT2','STEP2',to_timestamp('24-FEB-12 03.36.26 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',13,'LOT2','STEP3',to_timestamp('24-FEB-12 03.37.27 AM','DD-MON-RR HH.MI.SS AM'),19,0);
Insert into DATATABLE values ('TOOL1',14,'LOT2','STEP1',to_timestamp('24-FEB-12 03.34.14 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',14,'LOT2','STEP2',to_timestamp('24-FEB-12 03.38.36 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',14,'LOT2','STEP3',to_timestamp('24-FEB-12 03.39.37 AM','DD-MON-RR HH.MI.SS AM'),19,0);
Insert into DATATABLE values ('TOOL1',15,'LOT2','STEP1',to_timestamp('24-FEB-12 03.36.24 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',15,'LOT2','STEP2',to_timestamp('24-FEB-12 03.40.46 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',15,'LOT2','STEP3',to_timestamp('24-FEB-12 03.41.46 AM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',16,'LOT2','STEP1',to_timestamp('24-FEB-12 03.38.34 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',16,'LOT2','STEP2',to_timestamp('24-FEB-12 03.42.55 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',16,'LOT2','STEP3',to_timestamp('24-FEB-12 03.43.56 AM','DD-MON-RR HH.MI.SS AM'),19,0);
Insert into DATATABLE values ('TOOL1',17,'LOT2','STEP1',to_timestamp('24-FEB-12 03.40.43 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',17,'LOT2','STEP2',to_timestamp('24-FEB-12 03.45.05 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',17,'LOT2','STEP3',to_timestamp('24-FEB-12 03.46.06 AM','DD-MON-RR HH.MI.SS AM'),17,0);
Insert into DATATABLE values ('TOOL1',18,'LOT2','STEP1',to_timestamp('24-FEB-12 03.42.53 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',18,'LOT2','STEP2',to_timestamp('24-FEB-12 03.47.15 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',18,'LOT2','STEP3',to_timestamp('24-FEB-12 03.48.16 AM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',19,'LOT2','STEP1',to_timestamp('24-FEB-12 03.45.03 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',19,'LOT2','STEP2',to_timestamp('24-FEB-12 03.49.25 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',19,'LOT2','STEP3',to_timestamp('24-FEB-12 03.50.26 AM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',20,'LOT2','STEP1',to_timestamp('24-FEB-12 03.47.13 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',20,'LOT2','STEP2',to_timestamp('24-FEB-12 03.51.34 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',20,'LOT2','STEP3',to_timestamp('24-FEB-12 03.52.35 AM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',21,'LOT2','STEP1',to_timestamp('24-FEB-12 03.49.22 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',21,'LOT2','STEP2',to_timestamp('24-FEB-12 03.53.44 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',21,'LOT2','STEP3',to_timestamp('24-FEB-12 03.54.45 AM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',22,'LOT2','STEP1',to_timestamp('24-FEB-12 03.51.32 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',22,'LOT2','STEP2',to_timestamp('24-FEB-12 03.55.54 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',22,'LOT2','STEP3',to_timestamp('24-FEB-12 03.56.55 AM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',23,'LOT2','STEP1',to_timestamp('24-FEB-12 03.53.42 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',23,'LOT2','STEP2',to_timestamp('24-FEB-12 03.58.03 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',23,'LOT2','STEP3',to_timestamp('24-FEB-12 03.59.04 AM','DD-MON-RR HH.MI.SS AM'),19,0);
Insert into DATATABLE values ('TOOL1',24,'LOT2','STEP1',to_timestamp('24-FEB-12 03.55.51 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',24,'LOT2','STEP2',to_timestamp('24-FEB-12 04.00.14 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',24,'LOT2','STEP3',to_timestamp('24-FEB-12 04.01.15 AM','DD-MON-RR HH.MI.SS AM'),18,0);
Insert into DATATABLE values ('TOOL1',25,'LOT2','STEP1',to_timestamp('24-FEB-12 03.58.01 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',25,'LOT2','STEP2',to_timestamp('24-FEB-12 04.02.23 AM','DD-MON-RR HH.MI.SS AM'),1,0);
Insert into DATATABLE values ('TOOL1',25,'LOT2','STEP3',to_timestamp('24-FEB-12 04.03.24 AM','DD-MON-RR HH.MI.SS AM'),18,0);(code generated by sqldeveloper)
In the example:
LOT1 has two slot, with only 1 step instead of 5 --> these slots should not be counted --> result 23
LOT2 has one slot, with 4 instead of 3 --> this slot is ok and should be counted --> result 25
as previously mentioned, i want to count all slots, which got at least the median amount of steps [edit: slot -1 should also not be counted]
LOT1:
SELECT
sum(CASE WHEN SLOT != -1 THEN parameter1 END) parameter1,
min(CASE WHEN SLOT != -1 THEN EndTime END) first_time,
max(CASE WHEN SLOT != -1 THEN EndTime END) last_time,
sum(CASE WHEN SLOT != -1 THEN parameter6 END) parameter6,
CASE WHEN count(DISTINCT CASE WHEN SLOT != -1 THEN SLOT END) > 0 AND ROUND(count(DISTINCT CASE WHEN SLOT != -1 THEN SLOT||STEP END)/count(DISTINCT CASE WHEN SLOT != -1 THEN SLOT END)) > 0 THEN FLOOR(count(DISTINCT CASE WHEN SLOT != -1 THEN SLOT||STEP END)/ROUND(count(DISTINCT CASE WHEN SLOT != -1 THEN SLOT||STEP END)/count(DISTINCT CASE WHEN SLOT != -1 THEN SLOT END))) ELSE NULL END num_slots,
sum(CASE WHEN SLOT = -1 THEN parameter1 END) minusone_parameter1,
min(CASE WHEN SLOT = -1 THEN EndTime END) minusone_first_time,
max(CASE WHEN SLOT = -1 THEN EndTime END) minusone_last_time,
sum(CASE WHEN SLOT = -1 THEN parameter6 END) minusone_parameter6,
count(CASE WHEN SLOT = -1 THEN 1 END) num_minusone
FROM
datatable
WHERE
tool = 'TOOL1'
AND lotid = 'LOT1';
PARAMETER1 FIRST_TIME LAST_TIME PARAMETER6 *NUM_SLOTS* MINUSONE_PARAMETER1 MINUSONE_FIRST_TIME MINUSONE_LAST_TIME MINUSONE_PARAMETER6 NUM_MINUSONE
423 02.02.12 13:51:28 02.02.12 15:13:41 0 *23* 46 02.02.12 14:20:35 02.02.12 15:18:47 0 5 this is the desired result
same query with Lot2:
PARAMETER1 FIRST_TIME LAST_TIME PARAMETER6 *NUM_SLOTS* MINUSONE_PARAMETER1 MINUSONE_FIRST_TIME MINUSONE_LAST_TIME MINUSONE_PARAMETER6 NUM_MINUSONE
506 24.02.12 03:00:47 24.02.12 04:03:24 0 *25* 1 24.02.12 03:19:26 24.02.12 03:19:26 0 1 so right now i get the desired results with this ugly query... but with combinations of several different conditions - e.g. several slots with more steps and a few with less... - it may not work.
Edited by: Paneologist on Feb 24, 2012 7:42 AM -
FRM - 40212 / FRM - 40222 error on a radio group during query
Hi all,
This is my first post so please bear with me if I haven't provided sufficient information or am unclear at all.
I'm using Forms Builder (Web) on a 10g Database. I have a number of database and non-database items as part of a data block.
My problem is that, when I enter a value in any field and click the query button, I get a FRM-40212 Invalid value for field error on my radio group (disabled, non-database item that is programatically populated in the post-query and list-changed triggers only). When I click ok, I get a FRM-40222 Disabled Item Failed Validation error on the same radio group.
This does not happen if I click the 'Enter Query' button before entering values into fields, however I don't want my users to encounter this error if they try to query without clicking on 'Enter Query' first.
I'd like to know why exactly does this error happen - what does it mean?
I've read in other forums that setting the item's Required property to false solves this issue. But how can I do this with a radio group? And if it's not possible, does anyone have any suggestions for other workarounds?
Thanks in advance,
AbigailHi,
You can avoid this by setting 'Mapping of other values' to the one fo the radio buttons value.Like if you have to radio button radio1 and radio2 associated with radio group R1 ,then set any radio buttons initial value to this 'Mapping of other values' property of radio button R1.You won't see this error.
This error occurs because your loading a screen without assigning a value to the radio button.
If this helps mark question as answered or helpfull.
Thanks,
Pavan. -
Hi,
Please help me in the following query.
SELECT
a.bcast_id ,
a.bcast_file_nm ,
a.clickthru_url_cd ,
a.list_id ,
a.prs_id ,
a.resp_cd ,
a.run_seq ,
COUNT(a.resp_cd) ,
c.src_grp_cd ,
b.site_cd
FROM
gca_cbx_response_test a ,
gca_program_run_hist b ,
campaign_master c
WHERE
a.list_id=b.list_id
AND
a.run_seq=b.campaign_run_seq
AND
b.campaign_cd=c.campaign_cd
GROUP BY
a.bcast_id ,
a.bcast_file_nm ,
a.clickthru_url_cd ,
a.list_id ,
a.prs_id ,
a.resp_cd ,
a.run_seq ,
c.src_grp_cd ,
b.site_cd
HAVING
a.resp_ts
BETWEEN
to_date('04-AUG-2005 00:01:32','DD-MON-YYYY HH24:MI:SS')
AND
to_date('04-AUG-2005 00:01:32','DD-MON-YYYY HH24:MI:SS');
But the following group by query is throwing error that a.resp_ts is not a group by function.
But i don't want to add a.resp_ts in group by clause.
Please help me in this query.
Thanks,
DilipHow about:
SELECT a.bcast_id ,
a.bcast_file_nm ,
a.clickthru_url_cd ,
a.list_id ,
a.prs_id ,
a.resp_cd ,
a.run_seq ,
COUNT(a.resp_cd) ,
c.src_grp_cd ,
b.site_cd
FROM gca_cbx_response_test a ,
gca_program_run_hist b ,
campaign_master c
WHERE a.list_id=b.list_id
AND a.run_seq=b.campaign_run_seq
AND b.campaign_cd=c.campaign_cd
AND a.resp_ts BETWEEN to_date('04-AUG-2005 00:01:32','DD-MON-YYYY HH24:MI:SS')
AND to_date('04-AUG-2005 00:01:32','DD-MON-YYYY HH24:MI:SS');
GROUP BY a.bcast_id ,
a.bcast_file_nm ,
a.clickthru_url_cd ,
a.list_id ,
a.prs_id ,
a.resp_cd ,
a.run_seq ,
c.src_grp_cd ,
b.site_cd; -
How to Create and External Hierarchy and group values of IO in node
Good morning
BI 7:
Please give me guidance on the following?
I need to either to restrict a characteristic in a query to more than 800 values OR exclude values where it contains the pattern 'Z7' and 'Z8'. There are thousands of values which contains the pattern and they are not listed in such a way that I can exclude them as a value range, thus I would have to include all the values I want into the restriction, which is more than 800. An error displays when I check the query:
""In the structural component Warranty Damage Code, characteristic ZWR_DMGC is restricted to 838 values. This number is very large and will probably meet with technical limitations""
The proposed solution is:
""Create an external hierarchy for characteristic ZWR_DMGC and group the 838 values in a hierarchy node. You can then work with the node instead of the 838 individual values.
Alternatively, you can define a corresponding navigation attribute for ZWR_DMGC""
I know where to create the hierarchy, but I am confused how to only include the values of the applicable IO where pattern contains 'Z7' and 'Z8'.......??
The following are some of the steps proposed in a related thread, but I am loosing it at step 7.
5. Confirm your entries. The Maintain Hierarchy screen appears. You can define the structure of a hierarchy here. ok
6. To create a hierarchy node, you first need to choose an insertion mode: Insert as First Child or Insert As Next Neighbor (see Hierarchy Editing Functions). I selected first child
7. Choose the type of node you want to create: Text Node, Characteristic Node, <Hierarchy Basic Characteristic Node> or Interval (see Hierarchy Nodes) *this is where I am lost, which should I select to list values with pattern ' *Z7' and ' Z8' in a node or two
8. Repeat this procedure until the hierarchy structure has been set. For more information, see Modeling Nodes and Leaves.
A hierarchy can contain 50,000-100,000 leaves at most. If your hierarchy is larger, you should insert a level that is used as a navigation attribute or preferably as a separate characteristic in the dimension table.
9. You can use Level Maintenance and Hierarchy Attributes to set how the hierarchy is to be displayed and processed in reporting (see Level Maintenance and Hierarchy Attributes).
10. Save the hierarchy.
Your assistance will be appreciated.Hierarchy not used in this case. Could not fnd an answer.
-
Problem in creating group above AND group left in one report!
Hi all,
I need a report that is a combination of group above and group
left.
Suppose I have 3 table (Emp, Sales, Product):
Emp Table has 2 column
- Emp_PK
- Emp_Name
Sales Table has 4 column
-Sales_PK
-Sales_Date
-Emp_FK
-Produck_FK
-Quantity
Product Table has 3 column
-Product_PK
-Product_Name
-Product_Price
I want to make Employee Sales Report For The Month that will
look like this:
Emp Number___: Emp_PK
Emp Name_____: Emp_Name
Sales Date______Product_Name____Quantity \(2 sales
________________Product_Name____Quantity /the date)
Sales_Date______Product_Name____Quantity
As you can see this consist of group above (The Employee) and
group left (The Sales and Product).
I create this by using 2 queries and link them (the Emp_PK from
1st query and Emp_FK from 2nd query) on the report builder using
data link.
The first query is:
Select Emp_PK, Emp_Name from Emp
The second query is
Select Emp_FK, Sales_Date, Product_Name, Quantity
From Sales, Product
Where Product_PK=PRODUCT_FK
I then create the layout for second query and choose group left
for Sales_Date using wizard and I create additional layout to
for the employee.
The problem is that when I run this report, it will print ALL
the employee record first (including employee who has NOT sale
anything) and then on the last page it will print the record of
Last employee on the Emp table and ALL sales record (including
those that is done by other employee).
This report will run correctly if I choose an exact employee
(For example by adding Where Emp_PK=1111 in the first query) to
report all of the sales done by this person (employee with emp
number of 1111). However I need the report to run and print
ONLY those employee who has Sales Records!
I thought that by linking the 2 queries in Data Model, it will
have the same effect as linking using the WHERE clause in query.
If suppose I create a query like this:
SELECT Emp_PK, Emp_Name, Sales_Date, Product_Name, Quantity
FROM Emp, Sales, Product
WHERE Emp_PK=Emp_FK AND Product_PK=Product_FK
The report will run OK but I can only choose EITHER group above
or group left for this ONE query methods in report Wizard.
Sorry if it is a long question but I hope you can see what I am
trying to do.
Thanks in advance for any tip.hello,
of course you can create group left and group above blocks in a
single report.
you might want to use the INSERT REPORT BLOCK instead of the
report wizard, as the report wizard only allows you to use one
report layout per report, where the report block wizard (invoked
by INSERT REPORT BLOCK) allows you to choose on a per-block
basis.
of course you can create the blocks completely from scarth by
hand, if you want to.
regards,
the oracle reports team --pw -
How I check in group by query the group change
How I check in group by query the group change
Hi master
Sir I have master detail table
This is my query
select rownum,chartofacc.accid,title,nvl(drbal,0),nvl(crbal,0),
(select case when nvl(sum(debit),0)-nvl(sum(credit),0)>0 then
nvl(sum(debit),0)-nvl(sum(credit),0)
else
0
end mfadrttt
from voudetail where voudetail.accid=chartofacc.accid) as mfadr,
(select case when nvl(sum(credit),0)-nvl(sum(debit),0)>0 then
nvl(sum(credit),0)-nvl(sum(debit),0)
else
0
end mfacrttt
from voudetail where voudetail.accid=chartofacc.accid) as mfacr
,nvl(debit,0),nvl(credit,0),voumaster.entdate,voumaster.vno from chartofacc ,accbal,voudetail,voumaster where chartofacc.accid=accbal.accid(+) and chartofacc.accid=voudetail.accid(+) and voumaster.vno=voudetail.vno order by chartofacc.accid,voumaster.entdate,voudetail.VNO;
Sir I need add opbal from master section to debit in detail section when new group start only after adding I use that column for accumulative total or running balance
If I get any method when group change system give me any key or indication then I use
Please give me idea in both field oracle sql and oracle report 6i
Thank
aamirHi,
Please send tables structures and sample data from that tables. And, of course what should be the output. :) Just sending your query won't help us to find a solution.
Peter D. -
Execution sequence of connect by and group by
Hi All,
I know 'connect by' precedes 'where clause'. And I can use a test case to test this.
But I can't figure out which comes first, connect by and group by.
Can someone give me some tips on this, pleaes?
And another confusion of mine is execution sequence of select and order by.
In my opinion, since order by can read the alias of selected column, I think the sequence is that oracle select rows first and then sort them.
Please correct or confirm my statement.
Best regards,
LeonHi, Leon,
user12064076 wrote:
Hi All,
I know 'connect by' precedes 'where clause'. And I can use a test case to test this.
But I can't figure out which comes first, connect by and group by. Can you figure out if WHERE precedes GROUP BY?
SELECT job
, COUNT (*) AS cnt
FROM scott.emp
WHERE sal < 2500
GROUP BY job
;Aggregate functions, like COUNT, are evaluated as the GROUP BY clause is being performed. After the GROUP BY clause, only the ABC's (<b>A</b>ggregates, Group <b>B</b>Y expressions, <b>C</b>onstants, and <b>D</b>eterministic combinations of these) can be referenced.
Can someone give me some tips on this, pleaes? Consider this query:
SELECT LEVEL
, COUNT (*) AS cnt
FROM scott.emp
START WITH mgr IS NULL
CONNECT BY mgr = PRIOR empno
GROUP BY LEVEL
;Output:
` LEVEL CNT
1 1
2 3
4 2
3 8
And another confusion of mine is execution sequence of select and order by.
In my opinion, since order by can read the alias of selected column, I think the sequence is that oracle select rows first and then sort them.
Please correct or confirm my statement. Yes, the ORDER BY clause is evaluated after the SELECT clause. The ability to reference column aliases in the ORDER BY clause hints at this. Also, you can say
ORDER BY 1 -
More effecient way of using Decode and CASE
Is it possible to use both case and decode together? I feel I have too many decode and I am not sure how to write this in a more efficient way.
I would really appreciate any help.
Thank you so much in advance!!!
SELECT Person_ID,Work_ID,
CASE WHEN NBR = 1 THEN
MIN(DECODE(NBR, 1, field1)) aug_one_field1;
MIN(DECODE(NBR, 1, field2)) aug_one_field2;
MIN(DECODE(NBR, 1, field3)) aug_one_field3;
MIN(DECODE(NBR, 1, field4)) aug_one_field4;
MIN(DECODE(NBR, 1, field5)) aug_one_field5;
MIN(DECODE(NBR, 1, field6)) aug_one_field6;
CASE WHEN NBR = 2 THEN
MIN(DECODE(NBR, 2, field1)) aug_two_field1;
MIN(DECODE(NBR, 2, field2)) aug_two_field2;
MIN(DECODE(NBR, 2, field3)) aug_two_field3;
MIN(DECODE(NBR, 2, field4)) aug_two_field4;
MIN(DECODE(NBR, 2, field5)) aug_two_field5;
MIN(DECODE(NBR, 2, field6)) aug_two_field6;
CASE WHEN NBR = 3 THEN
MIN(DECODE(NBR, 3, field1)) aug_three_field1;
MIN(DECODE(NBR, 3, field2)) aug_three_field2;
MIN(DECODE(NBR, 3, field3)) aug_three_field3;
MIN(DECODE(NBR, 3, field4)) aug_three_field4;
MIN(DECODE(NBR, 3, field5)) aug_three_field5;
MIN(DECODE(NBR, 3, field6)) aug_three_field6;
CASE WHEN NBR = 4 THEN
MIN(DECODE(NBR, 4, field1)) aug_four_field1;
MIN(DECODE(NBR, 4, field2)) aug_four_field2;
MIN(DECODE(NBR, 4, field3)) aug_four_field3;
MIN(DECODE(NBR, 4, field4)) aug_four_field4;
MIN(DECODE(NBR, 4, field5)) aug_four_field5;
MIN(DECODE(NBR, 4, field6)) aug_four_field6;
END
FROM (SELECT Person_ID,Work_ID, NBR
fiel1, field2, field3,field4,field5, field6,
FROM field_rep
GROUP BY Person_ID,Work_IDThanks alot John and Frank.
John to answer your question, I just felt the 24 or more decode will slow down the systems performance, hence I was trying to find a better way to do it.
Frank
This is a sample data but I want it pivoted hence the reason for using the decode. I have oracle 10g. These are sample data
Person_id work_id NBR field1 field2 field3 field4 field5 field6
1 ao334 1 1/2/2009 1/9/2010 block_A HH 55667 1
1 ao334 2 5/2/2011 9/9/2013 block_Z HL 11111 3
1 ao334 2 1/2/2009 1/9/2010 block_A HH 22222 1
1 ao334 4 1/2/2009 1/9/2010 block_A HH zzzzz 7
1 z5521 1 10/5/2006 12/31/2012 block_C SS 33322 1
1 z5521 2 1/2/2009 1/9/2010 block_C SS 21550 1
1 z5521 3 1/2/2009 1/9/2010 block_R SS 10000 1
1 z5521 4 1/2/2009 1/9/2010 block_D SS 99100 5
1 z5521 5 1/2/2009 1/9/2010 block_P SS 88860 1
1 z5521 6 1/2/2009 1/9/2010 block_G SS 99660 8
1 ob114 1 1/2/2009 1/9/2010 block_A HH 52333 1
1 ob114 2 1/2/2009 1/9/2010 block_A HH 88888 1Output will look like this
Person_id work_id aug_one_field1 aug_one_field2 aug_one_field3 aug_one_field4 aug_one_field5 aug_one_field6 aug_two_field1 aug_two_field2 aug_two_field3 aug_two_field4 aug_two_field5 aug_two_field6
1 ao334 1/2/2009 1/9/2010 block_A HH 55667 1 5/2/2011 9/9/2013 block_Z HL 11111 3
Maybe you are looking for
-
Data selection in infopackage to exclude 3 values
Hi, I want to exclude 3 values for ZCOUNTRY field in the data selection of an infopackage. I don't want to do this using start routine(in transfer structure or update rules). I just need to do the coding in infopackage level. Can anybody plz tell me
-
VPN settings not saved after upgrading ipad
I got an ipad mini so I did a backup of my ipad 3 and restored that copy to the ipad mini. Everything was restored ok with the exception of my VPN settings, it's a VPN from work and now I can only access that network from my ipad 3, not form ipad min
-
Tables with different-width columns
Whist creating a table with multiple rows and columns, I need some of the columns to be different widths on each row. I can do this easily in Word by simply selecting the cell and command-drag the vertical line at the left or right hand side. When I
-
Lync 2010 phone not available when users have two Directory Number Associations in CUCM
Hello everyone, We currently have a little issue with our LYNC 2010 to Cisco UC Integration (CUCM 8.5.1), I'm wondering if someone can shed some light please. There are some users in our organisation having two Directory Number Associations in CUCM (
-
Opening an external QuickTime movie
How simple but I can't get it working. I want to open an external mov. file from a button within Flash, exactly as you would from an html button. you know... opens in its own window. What would the script be for this? Thanks John