How to use Group by clause in Infoset
Hi,
I have a infoset where I am using two DSO .Now want to use the group by clause on basis of day, month, quarter .And also I want to use the left outer join .SO how will I do that ?
Can somebody help me to to get these solved ?
Regards
Sunit
Hi,
for me it seems like Multiprovider is the one which we use in case when we want to go for group by option. This infoset is more kind of intersection operation.
go through this link for more detailed info on Infoset
http://help.sap.com/saphelp_nw2004s/helpdata/en/67/7e4b3eaf72561ee10000000a114084/content.htm
Regards,
rik
Similar Messages
-
How to write a SQL Query without using group by clause
Hi,
Can anyone help me to find out if there is a approach to build a SQL Query without using group by clause.
Please site an example if is it so,
RegardsI hope this example could illuminate danepc on is problem.
CREATE or replace TYPE MY_ARRAY AS TABLE OF INTEGER
CREATE OR REPLACE FUNCTION GET_ARR return my_array
as
arr my_array;
begin
arr := my_array();
for i in 1..10 loop
arr.extend;
arr(i) := i mod 7;
end loop;
return arr;
end;
select column_value
from table(get_arr)
order by column_value;
select column_value,count(*) occurences
from table(get_arr)
group by column_value
order by column_value;And the output should be something like this:
SQL> CREATE or replace TYPE MY_ARRAY AS TABLE OF INTEGER
2 /
Tipo creato.
SQL>
SQL> CREATE OR REPLACE FUNCTION GET_ARR return my_array
2 as
3 arr my_array;
4 begin
5 arr := my_array();
6 for i in 1..10 loop
7 arr.extend;
8 arr(i) := i mod 7;
9 end loop;
10 return arr;
11 end;
12 /
Funzione creata.
SQL>
SQL>
SQL> select column_value
2 from table(get_arr)
3 order by column_value;
COLUMN_VALUE
0
1
1
2
2
3
3
4
5
6
Selezionate 10 righe.
SQL>
SQL> select column_value,count(*) occurences
2 from table(get_arr)
3 group by column_value
4 order by column_value;
COLUMN_VALUE OCCURENCES
0 1
1 2
2 2
3 2
4 1
5 1
6 1
Selezionate 7 righe.
SQL> Bye Alessandro -
How to use the Output clause for the updated statment
How to use the output clause for the below update stament,
DECLARE @MyTableVar table(
sname int NOT NULL)
update A set stat ='USED'
from (select top 1 * from #A
where stat='AVAILABLE' order by sno)A
Output inserted.sname
INTO @MyTableVar;
SELECT sname
FROM @MyTableVar;
Here am getting one error incorrect syntax near Output
i want to return the updated value from output clausesee
http://blogs.msdn.com/b/sqltips/archive/2005/06/13/output-clause.aspx
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
how to use GROUP BY in ODI tool
Hi ,
you can combine the insert stamt with the select ....so that in the target u will get a single line .....
SQL> select * from prop_details;
PROPERTY RELAVANTD NOTICES
10100 25-JAN-09 30
10100 03-JAN-09 30
10100 02-DEC-08 20
10100 01-DEC-08 10
10100 31-DEC-08 20
10101 10-JAN-09 10
10101 20-JAN-07 15
10101 30-DEC-08 45
10101 20-FEB-08 35
10101 31-JAN-09 25
10 rows selected.
SQL> select PROPERTY,max(RELAVANTDATE),SUM(NOTICES) from PROP_DETAILS GROUP BY P
ROPERTY;
PROPERTY MAX(RELAV SUM(NOTICES)
10101 31-JAN-09 130
10100 25-JAN-09 110
SQL> -
ORA-00907: missing right parenthesis when using group by clause with xmlagg
I have the following query and I am getting ORA 00907 Error when I am using group by clause with the xmlagg function.
select xmlelement("Mitigation",
xmlelement("m_szMethodName",tm.DisplayName),
xmlelement("SubstanceInterferenceProtocolList",
(select xmlagg(xmlelement("MitigationProtocol",
xmlelement("m_szMethodName",tm.DisplayName),
xmlelement("m_szInterferenceProtocolName",tmp.protocol_name),
xmlelement("m_szInterferenceSubstance",tmp.intf_mtrl_prod_code),
xmlelement("m_ProtocolParameters",
xmlelement("m_szProtocolName",tmp.protocol_name),
xmlelement("m_Consumables",
xmlelement("Consumable",
xmlelement("m_szConsumId", xrl.rgnt_pack_name),
xmlelement("m_szProductCode",xrl.pack_prod_code),
xmlelement("m_nVolume",tmp.fluid_vol),
xmlelement("m_szProtocolStep",xps.protocol_step_name))),
xmlelement("m_ProtParamList",
xmlagg(
xmlelement("ParameterValues",
xmlelement("m_szProtocolName",tmp.protocol_name),
xmlelement("m_Time",xpsd.parameter_ntime_value))
group by tmp.ccd_test_id,tmp.intf_mtrl_prod_code)
order by tmp.ccd_test_id, tmp.intf_mtrl_prod_code, xps.protocol_step_intprotocolstep )
from XPR_tdef_mitigation_protocol tmp, xp_reagentlist xrl,
xpr_protocol_settings xps, xpr_protocol_settings_default xpsd
where tmp.ccd_test_id = tm.ccd_test_id
and tmp.ccd_test_id = xrl.ccd_test_id
and tmp.pack_prod_code = xrl.pack_prod_code
and tmp.intf_type = 1
and xps.protocol_name = xpsd.protocol_name
and xps.protocol_step_name = xpsd.protocol_step_name
and xps.ps_action_parameterlist = xpsd.ps_action_parameterlist
and xps.protocol_name = tmp.PROTOCOL_NAME
from XPtoXPRTdef_defn_mapping tm
where tm.DisplayName = 'SYPH'If I remove the xmlagg clause along with the group by clause, the query runs fine and give me the output.
But in that XML format of the output is incorrect for my application.
Could someone help here?Hi,
userAtoZ wrote:
I have the following query and I am getting ORA 00907 Error when I am using group by clause with the xmlagg function.
... xmlagg(
xmlelement("ParameterValues",
xmlelement("m_szProtocolName",tmp.protocol_name),
xmlelement("m_Time",xpsd.parameter_ntime_value))
group by tmp.ccd_test_id,tmp.intf_mtrl_prod_code)Please don't post unformatted code. When posting any formatted text on this site, type these 6 characters:
\(small letters only, inside curly brackets) before and after each section of formatted text, to preserve spacing.
If the code above were formatted well, so that you could match each '(' with its closing ')', it would look something like this:... xmlagg ( xmlelement ( "ParameterValues"
, xmlelement ( "m_szProtocolName"
, tmp.protocol_name
, xmlelement ( "m_Time"
, xpsd.parameter_ntime_value
group by tmp.ccd_test_id
, tmp.intf_mtrl_prod_code
This is exactly what you posted, only the whitespace has been changed.
This makes it clear that the GROUP BY is inside the parentheses with the argument to XMLAGG. You can have an ORDER BY clause there, but not a GROUP BY clause. -
How to use "group" in iTunes?
Hi...
Need advice:
Any ideas for how to use "Groups" under album "info" (cmd i)
(my iTunes is in Swedish, I am not sure what the English names are)
This function has such a central position in "song info" but I cant understand how to use it...
Best regardsWhen I look in Edit > Preferences > General tab I find that the Libray name is still one of the old ones
Then you are not opening a new library.
If I rename to the library name it should be it still puts files in the wrong place.
You should not rename the libraries. -
Can we use Group by Clause here?
All,
Can we use group by clause in the date column?
If yes, will it work for these kind of values '11/12/2009 12:30:45 PM' and '11/12/2009 4:30:45 PM'......Hi,
frontier007 wrote:
All,
Can we use group by clause in the date column?
If yes, will it work for these kind of values '11/12/2009 12:30:45 PM' and '11/12/2009 4:30:45 PM'......Yes, GROUP BY works with DATEs.
Remember that DATEs always include hours, minutes and seconds, so '11/12/2009 12:30:45 PM' and '11/12/2009 4:30:45 PM', though they are in the same calendar day, are different DATE values. If you want them to be in the same group, then use TRUNC.
For example:
SELECT TRUNC (entry_date) AS entry_dt
, SUM (amount) AS daily_amount
FROM orders
GROUP BY TRUNC (entry_date)
;Edited by: Frank Kulash on Oct 30, 2009 4:55 AM -
HOW TO ADD GROUP BY CLAUSE WHEN USING Jbo:Datatable
Would like to know if there are any provisions for adding a Group by clause so the data shown using DataTable Component cn be grouped.
eg:
Currently using DataTable component shows data as shown below.
Dept Name
10 ABC
10 DEF
10 PQR
20 XYZ
20 QQQ
Can this be done as shown bewlow
Dept Name
10 ABC
DEF
PQR
20 XYZ
QQQ
ThanksHi Sashi,
For a bc4j view object, the shape of the result set needs to be consistent. So, there can not be a groupby directly in the result set.
However, that does not prevent you from inserting a calculated column that performs a similar calculation.
Another mechanism might be to consider a master detail arrangement of the views where the master contains an aggregation of data from its children. You are then free to access and display this data as you choose.
Hope this helps,
Pete -
How to use group by in PL/SQL
Can anyone give me a clue how to group rows using PL/SQL? I want to make a push button that groups a number of rows. When I run the form and push the button, I get the Oracle 01422 error. I am using one data block and, after pressing execute on the Oracle form in the web browser, I want to sort the rows using the group by clause as a pl sql trigger in a push button (with the WHEN BUTTON PRESSED trigger). I am new to Oracle Forms.
I managed to use a cursor to access and display each row. I have to press the command button I created once for access of each row individually. I want to be able to push the button once, and populate each row with a record from my table. I am using the tabular format. Here is my code:
DECLARE
CURSOR email_message_cur
IS
SELECT sender, subject, body, date_time_sent
FROM Email_Message
ORDER BY sender;
BEGIN
OPEN email_message_cur;
FETCH email_message_cur
INTO :GROUP_EMAIL_MESSAGE.SENDER, :GROUP_EMAIL_MESSAGE.SUBJECT, :GROUP_EMAIL_MESSAGE.BODY, :GROUP_EMAIL_MESSAGE.DATE_TIME_SENT;
WHILE email_message_cur%FOUND LOOP
IF :GROUP_EMAIL_MESSAGE.SENDER IS NOT NULL THEN
CREATE_RECORD;
END IF;
FETCH email_message_cur INTO :GROUP_EMAIL_MESSAGE.SENDER, :GROUP_EMAIL_MESSAGE.SUBJECT, :GROUP_EMAIL_MESSAGE.BODY, :GROUP_EMAIL_MESSAGE.DATE_TIME_SENT;
END LOOP;
CLOSE email_message_cur;
END; -
Output not sorted when using group by clause
Recently we migrated our application from Forms5 to Forms10g and database from 7.3.2 to 10gR2.
More than 400 applications using sql stmt with "group by" clause and without "order by".
In Earlier version of oracle 7.3.2 "group by" clause in SQL stmt sorts the output by order of the column in the "group by"
stmt, where new version of oracle 10g (10.2.0.1.0 - 64bit Production) doesnt behave like older version.
eg select div_cd,dept_cd,count(*) from class group by div_cd,dept_cd
Output of the above query in Oracle7
DIV_CD DEPT_CD COUNT(*)
0 1 120
0 9 131
1 4 938
1 6 1
4 1 1490
5 2 59
6 6 848
6 9 295
8 1 45
9 5 19
Output of same query in Oracle10g
DIV_CD DEPT_CD COUNT(*)
0 6 120
0 9 131
4 1 1490
6 9 295
8 1 45
9 5 19
1 4 938
1 6 1
5 2 59
6 6 848
My question is
a) Does the oracle behave in that manner?.
b) if so, Any patch set available for this?
c) if no patch set how to resolve this issue.
if i use "order by" clause
along with group by then i can get the output how i want.
BUt problem is more than 400 applications (forms) using above method.
Identify Forms/Reports and rectifing is a tedious job.
Anyone can give me a good solution to solve the above issueGroup By does not, and never has guaranteed order. Just because it happened that way on the past does not mean it will continue to do so.
In the past, the algorithm used for Group By invoked a sort. It was convenient for the system to simply dump the output in that resulting order. These days, Group By could also be accomplished using a hash algorithm. Walking through the hash can easily result in a completely different ordering, as you have seen.
Your problem is that the assumptions made previously are now invalid. Oracle is still working correctly. No patch, but you might be able to work around it by crippling your database and using the COMPATIBLE parameter (although the official lower limit is 9.2.0) -
Using indexes when using group by clause
How can I make use of indexes when there is a group by clause in the sql/ pl/sql. Heard that when ever there is a group by clause , sql bypasses use of indexes. Is it true?
Thanks in advanceHi,
Depending on the query containing the group by, indexes will still be used.
For example, create a big table based on the all_objects table. Then create an index on the object_type column. Then run this query:
select count(*), object_type from big_table where object_type != 'PACKAGE' group by object_type
The execution plan for this query will show the index to be used, the group by does not prevent the optimizer from using an index. Then run this query:
select count(*), object_type from big_table group by object_type
The execution plan for this query will show the index not to be used because the whole table - no restrictions - needs to be read to get the result.
Hope this helps!
Regards,
Marco Stuijvenberg
=
www.marcostuijvenberg.nl -
How to use group function in insert or update
Hai All
How can we use group function in insert or update statement
I am generating an attendance so i have different set of timing for example
0800,1200,1230, 1700 and i need to insert into these data into table with min value to intime and max value to
outtime and othere to inertval time in or out
Pls tell me with some example
For example
For INSERT
insert into T2 (barcode,empcode,intime,attend_date)
values(r2.cardn,r2.enpno,MIN(r2.ptime),r2.pdate);
For UPDATE
update dail_att set outtime= MAX(r2.ptime) where empcode=r2.enpno and barcode=r2.cardn and
attend_date=r2.pdate;
Here instead of where i need to use having so pls tell how to use
Thanks & Regards
Srikkanth.MHai Man
R2 is not a table name its a record
Let me explain clearly
I have to generate daily attendance for lot of employees So i have two table t1 and t2
T1 consist of three column empno,date,time
T2 consist of empno,name,date,intime,outtime,intrin,introut
So now i need to give the T1 Min value Of time to T2 Intime and T1 Max value of Time to T2 Outtime fields so there so many records while i am using
max(time) it gives the max value of all so i seperated by group function so now i have an error in subquery ie it is an single row subquery so i need to use multiple row subquery how i can use multiple row subquery in update statement
Thanks In Advance
Srikkanth.M -
How to use "Order by" clause dynamically on LOV values in 10g r2 forms
Hi ,
I have following requirement,please guide me.
1 Create a List Of Values with 2 fields, Code and Description
2. Do not use order by clause in record Group Query
3. Attach this LOV to a field in Form
4. When user invokes the LOV user will see two fields in LOV with header as Code and Description
5. Now when user clicks on Column Header “Code” then LOV should be sorted on Code
6. And if User clicks on Column Header “Description” then LOV should be sorted on Description
Thanks in Advance.Kindly post this problem in this forum ->
[Forms Forum|http://forums.oracle.com/forums/forum.jspa?forumID=82]
And, close this thread by marked it as answered. ;)
Regards.
Satyaki De. -
How to handle Group by clause Dynamically in Oracle Form
Hi Expert,
Here i have problem :
i want display record with passing group by clause Parameter
Example :
Select zone,district,postal,count(Do_no) ,sum(Sales_Amt)
from DLV_ORD_mast
group by :zone,:district,:Postal
1-o/p like :
if user pass the :zone parameter in group by clause then record display like below o/p
zone count sls_amt
South 2 1000
central 3 5000
East 4 600
2-o/p
if use pass the :District parameter in group by clause then record display like below O/P
zone count sls_amt
South/Dist1 2 1000
central /Dist2 3 5000
central /Dist3 1 500
East /Dist4 4 600
2-o/p
if use pass the :postal parameter in group by clause then record display like below O/P
zone count sls_amt
South/Dist1/postal1 2 1000
central /Dist2/Postal2 3 5000
central /Dist3/postal3 1 500
East /Dist4/postal4 4 600
so if anybody come across same senario then Please give me the solution for this problem .
pleassssssssssssssssssssssssss
Thanks
AbhishekBuild a block one a Query FROM clause, like
SELECT GROUPCOL,
CNT,
SUMM
FROM (Select zone GROUPCOL,
count(Do_no) CNT,
sum(Sales_Amt) SUMM
from DLV_ORD_mast
group by zone
)Then at runtime, change the the block QUERY_DATASOURCE_NAME by SET_BLOCK_PROPERTY depending on the parameter, e.g. to
SELECT GROUPCOL,
CNT,
SUMM
FROM (Select zone ||', '|| DISTRICT GROUPCOL,
count(Do_no) CNT,
sum(Sales_Amt) SUMM
from DLV_ORD_mast
group by zone ||', '|| DISTRICT
) -
Can u write the following query without using group by clause
select sp.sid, p.pid, p.name from product p, supp_prod sp
where sp.pid= p.pid and
sp.sid = ( select sid from supp_prod group by sid
having count(*) =(select count(*) from product));
thru this, we retrieving all the products delivered by the supplier.
Can you write the following query without using the group by clauseselect sp.sid, p.pid, p.name
from product p, supp_prod sp
where sp.pid= p.pid the above query will still retrieve all the products supplied by the supplier. sub-query is not necessary.
maybe if you can post some sample data and output will help us understand what you want to achieve.
Maybe you are looking for
-
Hi All Is there any standard report for getting the change history of PO's? Regards.
-
I got a PDF file that has multiple links/buttons and I'm placing into an InDesign CS2 document with other items and then exporting out as another PDF for a digital edition magazine. I want to retain all the links/button once I export?
-
Mocha AE CS6 - Splines not showing so tracking is unavailable
It always seems to be me that has issues with every project he works on. Typical. So, as expected, I'm having issues with my latest project, and the client needs the completed film back fairly soon, so I'm running out of time. My issue, is that in AE
-
MTTR/MTBR Breakdown and Machine Failure Time
We create PM Notification with the IW24 where we enter the Breakdown time. The problem is that we need to monitor the MTTR/MTBR (MCJB, MCJC & MCI7) but only when there is a breakdown because of a malfuction of the machine (machine failure) and not fo
-
Can't recover my system using the system recovery media
Last month my computer started reporting an imminent hard disk failure. So I created a set of system recovery discs, purchased a new hard drive, and tried to start the recovery process. But in the process my DVD drive failed, and then my BIOS chip ha