Query for reporting need to be tuned
Hi,
I working on aoracle 10.2.0.4 on solaris platform 32 GB physical memory.This database is being used for both daily transaction and reporting purpose.One of the reporting query taking high time..
SQL> set autotrace traceonly
SQL> select substr(tr_ldt,4,6),tr_di,sum(tr_val) from tr_all
2 where tr_ay_bt>='15-APR-11'
3 group by substr(tr_ldt,4,6),tr_di
4 order by substr(tr_ldt,4,6),tr_di;
Execution Plan
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | 1488 | 37200 | 198K|
| 1 | SORT GROUP BY | | 1488 | 37200 | 198K|
| 2 | TABLE ACCESS FULL| TR_ALL | 6575K| 156M| 197K|
Statistics
1030 recursive calls
0 db block gets
721737 consistent gets
624840 physical reads
0 redo size
1682 bytes sent via SQL*Net to client
514 bytes received via SQL*Net from client
4 SQL*Net roundtrips to/from client
23 sorts (memory)
0 sorts (disk)
33 rows processed
and i have tried autometic sql tuning...
But the result of tuning task is null. No suggestion.
Can u tell me how can i reduce the time of execution.
1.The wait event involved is *'db file scatter read'*.
I have index on tr_ldt column and bitmap index on tr_di column.
Pls suggest how to tune this query????
See template postings:
[url https://forums.oracle.com/forums/thread.jspa?threadID=863295]How to post a sql tuning request
[url https://forums.oracle.com/forums/thread.jspa?messageID=1812597]When your query takes too long
The wait event involved is 'db file scatter read'.Subject to oracle version, "db file scattered read" is the expected wait event for a FULL TABLE SCAN where the blocks are not in the buffer cache and physical IO is required.
where tr_ay_bt>='15-APR-11'As an aside, never rely on implicit conversions, use TO_DATE('15-APR-2011','DD-MON-YYYY').
It wouldn't make a difference to your full table scan, unless the relevant column was indexed but an implcit datatype conversion was preventing usage thereof.
I have index on tr_ldt column and bitmap index on tr_di column.But the query restricts by TR_AY_BT.
If this is unindexed a full table scan is pretty much inevitable.
In the continued absence of an index, perhaps doing the work in parallel is an option?
Similar Messages
-
Dynamic sql query for report based on user input
Hi everyone,
I have built custom search fields (name, date born, gender etc.) in the search region and in the results region a report need to be displayed.
Now I'm not very experienced with Apex or Oracle sql, but could anyone telll me how to first check if a user filled in a field and then build a query based upon what field the user filled in to submit.
Any help would be appreciated, thanks in advance.
regards,
Cleo
Edited by: Cleopatra on Jan 18, 2011 5:51 AMHi, Cleopatra. Welcome to OTN!
If you don't have too many fields instead of checking to see if they're filled in you can use OR conditions in yoru WHERE_CLAUSE to check for NULLS to ignore NULLS, something like (you will have to test this carefully!)
AND some_column = NVL(:P24_1,some_column)the idea being that if the field is NULL then the column will match itself - in this case assuming the column itself does not have a null value -
Hi !!
I have to create a report,which would be called from a form, and I require your help to code a query for a complex logic involving two tables. My application is on Oracle8i and Developer6. The table structures and their values are as below:
Table1
(Main-Part, Sub-Part is a composite key)
MainPart Sub-part
M0001 S0001
M0001 S0002
M0001 S0003
M0002 S0004
M0002 S0101
M0002 S0909
M0003 S1909
Table2 (Part is a primary key)
Part Qty-in-store qty-in-prodn qty-rejected
M0001 10 10 10
S0001 1 10 1
M0003 1 1 1
M0002 2 1 2
S0004 3 2 5
S0003 1 1 8
S0002 10 11 12
S0101 100 200 100
The requirement is that for every fetch of the Main-Sub part pair from table1, details should be fetched from the table2. Since the Main-Sub part pair is a composite key in table1, details from Table2 should be fetched only once for a repeating Main part but as many times for the number of sub-parts. For example, although M0001 is repeated 3 times in table1, it's details should be fetched only once from table2 whereas for the sub-parts of M0001(S0001, S0002, S0003) details should be fetched from table2 for each sub-part.
I tried a query which first fetches the details for the main-part, and in the repeating frame I put formula columns(with appropriate select stmts) for sub-parts. This approach I feel could affect performance because select statement is fired as many times as the number of formula columns.
My report should look like this
============================================================
Part qty-in-store qty-in-prodn qty-rejected
============================================================
M0001 10 10 10
S0001 1 10 1
S0002 10 11 12
S0003 1 1 8
Total 22 32 31
M0002 2 1 2
S0004 3 2 5
S0101 100 200 100
Total 105 203 107
I would like your help to know if there is another way to code a query(or queries) in report builder which will help me solve this above requirement.
Also, is it possibe to do an Update operation on a Database Table from within a report, bcos the totals as shown above need to be updated to the table?
Thanks in advance for the help?
Regards,
AjayJohn,
I believe this is to create the column types in BIRT. Can you open a
bugzilla entry to look at this?
Jason
On 7/27/2010 10:45 AM, john mcteague wrote:
> I have resolved this by changing config.xml in oda-jdbc.jar to use
> policy 1 for the jConnect driver.
>
> Policy 2 executes the query with a maxrows of 1, gets the metadata then
> executes the query again with the desired number of rows.
> Does anyone know why jConnect was set to policy 2 in the first place? -
Executing the saved query for views -Need Help
How can i run get the query for the saved search in views and execute it to view the results ?Can some one help on this pl
Thanks!Hi,
I am not able to get your requirement. Share in little details.
As of my understanding, you want to get the query which is being executed.
Regards,
Gyan -
Query for report to show Invoices, Payments and Discounts
Hi All
I am hoping someone can help me with this query.
What the customer needs is the invoices for a specific date range, the payments applied to the invoices and the discount amount
Eg...
Invoice payment discount
100 90 10
This would be easy to get from the ORCT and RCT2 tables.
However, sometime the users add the payment on account and reconciles the invoices and a manual journal for the discounts.
So it would be best to look at the OITR and ITR1 tables?
This is what I have so far and it almost balances...
I am using this query to create the report in crystal,
To create the discount amount from the incoming payment window i said (T0.ReconSum - T3.TrsfrSum)
I also took out the vat amount within that formula.
With the amounts from the manual journal, i just took the amount as is.
select T2.CardCode, T2.CardName, T0.SrcObjTyp, T0.SrcObjAbs, T0.ReconSum, T3.TrsfrSum, T4.ReconDate, T2.U_FundedNonFunded, (T5.Debit - T5.Credit), T6.PymntGroup
from ITR1 T0
inner join OCRD T2 on T0.Shortname = T2.CardCode
left outer join ORCT T3 on T3.DocEntry = T0.SrcObjAbs and T3.CardCode = T0.ShortName
inner join OITR T4 on T4.ReconNum = T0.ReconNum
left outer join JDT1 T5 on T5.TransId = T0.TransId and T5.ObjType = T0.SrcObjAbs and T0.ShortName = T5.ShortName
inner join OCTG T6 on T6.GroupNum = T2.GroupNum
where T3.DocDate <= getdate() or T5.ContraAct = '1127331'
the account 1127331 is the Discount GL account.
Based on the example the Payment + discount = Invoices
however not all the customers are balancing..
any ideas? it looks like my query is getting only the invoices where a payment has been done. The amounts just dont seem to match.
Thank you
Jerushahi
I think your join with OJDT is wrong in this part : T5.ObjType = T0.SrcObjAbs
you should write
T5.ObjType = T0.SrcObjTyp
(I think you don't need this part at all )
try this:
select T2.CardCode, T2.CardName, T0.SrcObjTyp, T0.SrcObjAbs, T0.ReconSum, T3.TrsfrSum, T4.ReconDate, T2.U_FundedNonFunded, (T5.Debit - T5.Credit), T6.PymntGroup
from
ITR1 T0
inner
join OITR T4 on T4.ReconNum = T0.ReconNum
inner
join OCRD T2 on T0.Shortname = T2.CardCode
left
outer join ORCT T3 on T3.DocEntry = T0.SrcObjAbs and T3.CardCode = T0.ShortName
left
outer join JDT1 T5 on T5.TransId = T0.TransId and T5.ObjType = T0.SrcObjTyp and T0.ShortName = T5.ShortName
inner
join OCTG T6 on T6.GroupNum = T2.GroupNum
where
T3.DocDate <= getdate() or T5.ContraAct =
'1127331'
please let me know if it works now
shachar -
SAP Query-for Reporting how to create and use it
Hi SAP Gurus,
i need your help. in my project, client is asking to create queries to generate reports, i am not familiar with queries, so would appreciate it if any one can guide me and tell me the procedure for writing and creating queries soon.
also if you have any study material on steps on How to write and create queries for PP module
thank you very muchHi
Please refer below document
http://www.thespot4sap.com/Articles/SAP_ABAP_Queries_Introduction.asp
Also refer below
How to Create Infoset Query (SAP Query)
Steps on how to proceed to create a Query:
ADHOC QUERY
A query can be created to extract information from master records i.e Infotypes. For example, by creating a query , the data relating to an employee contained in various Infotypes can be extracted.
Proceedure :
Decide on the various Infotypes we want to make the query. Decide on the area where we want to query i.e Global area or Standard area. Standard area is client specific and globel area will include all clients.
Menu : HR PM Admn - Information System - Adhoc Query
Select area standard and select the user group already created
Creation of new query :
TC SQ03 - Select Environment Select Standard Area - Enter -- If new user group is to be created, enter name of the user group, click on create and enter necessary information and exit after saving
TC SQ02 - Enter name of the Infoset Create enter name of Infoset - Data source -- > Table join by basis table give name of table e.g pa0000 - Enter - Click on insert table if we want to include more tables give name of table one by one and after finishing, place cursor on the joining lines and right click to delete unwanted relationships - check - and go back - field groups - include all table fields - click on generate button - go out
TC SQ03 - Select user group - eg. Payroll
Infoset - Enter name of newly created Infoset
Assign users and Infosets - Assign infosets - put tick on payroll - save and go back
TC PAAH - Expand the nodes and put tick on relevant fields depending upon necessity
Save the query by giving the same name as infoset for easyness..
For executing a query which is already created
1. Go to SQ01 transaction
2. Go to Environment menu->query areas->std areas
3. Then choose the user group where the query is created
4. It will display all the queries created for the group.choose the query you want to executeand click execute.
5. will take to the initial screen
6. Enter the required parameters and execute
Regards
Ranga
Message was edited by:
Ranganathan Srinivasamurthy -
Hi All
I have a table called Agent. Each Agent processes requests.
So accordingly Request is another table.
Now the Agent can process the request successfully, fail or it could be
in progress.
So accordingly I have a status column in the Request table which can have the following values
New - when the request is allocated to the agent
Open- When the agent opens the request
Action- when the agent acted upon the request
Sold - when the agent was successful in processing the request
Fail - when the agent could not process the request
In the Request table there is column called requestDate which is the
date when the Request was first inserted (i.e when its New)
Now whenever the agent acts upon the request from the front end
the status change is logged in a RequestLog table.
So when the agent changes the status to Open, an entry is logged into
RequestLog table.
So when the agent open the request an entry in the RequestLog table
would go with the status as open , the reference of the requestId &
the date on which the status is changed
Similar entries will be logged for each request when the agent acts on
the respective requests like if its Sold then the status will be sold,
the date of sale & the corresponding request Id will be logged into the
RequestLog table.
In the Request table the status will be changed to "Open" or "Sold" but the
requestDate will not change & it will remain the date when it was inserted
Now I want to generate a Report which shows the list of all agents within a state
with all total number of requests they have handled, how many are in Opened status,
how many are in Sold status & how many are in Fail status. I also have to show the
average time(in days) it took for each agent to Open the request, make the sale or qualify it
as Fail. This average time I want it for an agent & not request specific.
& In the end I have to show the grand total of all the requests handled by all the agents,
grand total of opened status requests,grand total of Sold status requests,grand total of Fail status requests as well as the total average time it took to Open ,total average time it took to sale & total average time it takes to Fail
I have dabbled with simple SQL but not a complex report type like above. So I would need help from all you experts.
Here is what I plan to do
my from clause would include the Agent, Request, RequestLog table
where Request.requestdate between <fromDate> and <toDate>
group by agent.agentname,
Select would have count(agent.requestid),
Now how do i show the list of Open requests, sold requests & fail requests in different columns since all these values are in the same column.
Also I am aware of the average fnction but I need help on how to use the same in such a scenario.
Do post your thoughts on the same.
RegardsHi All
I have made some queries to fetch the Report data. I would want you to post your comments on the same.
This is my first query which returns the total count of request per dealer, how much are in open, sent & dead state & total per status.
select AGENT.COMPANY_NAME,count(REQUEST.REQUEST_ID) TOTAL ,
sum(decode(REQUEST.status,'Open',1,0)) OPEN,
sum(decode(REQUEST.status,'Sent',1,0)) SENT,
sum(decode(REQUEST.status,'Dead',1,0)) DEAD
from AGENT, REQUEST
where
AGENT.STATE='ACT'
and REQUEST.REQUEST_TYPE='B'
and REQUEST.CONFIRMATION='Y'
and AGENT.DEALER_ID = REQUEST.DEALER_NUMBER
group by grouping sets(AGENT.COMPANY_NAME, ())
Then I have to retrieve the average number of days it takes to change the request to Open, average number of days it takes to change the request to Sent & average number of days it takes to change the request to Dead
per Agent. The base date is stored in REQUEST table (request_date column) & the subsequent change of status is stored in activity_date column
of ACTIVITY table
Here is what I do get the average number of days it takes to change the status for the Agent
select AGENT.COMPANY_NAME,
avg( decode (REQUEST.status,'Open',ACTIVITY.ACTIVITY_DATE - REQUEST.REQUEST_DATE,0)) AVG_OPEN,
avg( decode (REQUEST.status,'Sent',ACTIVITY.ACTIVITY_DATE - REQUEST.REQUEST_DATE,0)) AVG_SENT,
avg( decode (REQUEST.status,'Dead',ACTIVITY.ACTIVITY_DATE - REQUEST.REQUEST_DATE,0)) AVG_DEAD
from REQUEST, ACTIVITY, AGENT
where
AGENT.STATE='ACT'
and REQUEST.REQUEST_TYPE='B'
and REQUEST.CONFIRMATION='Y '
and REQUEST.dealer_number = AGENT.DEALER_ID
and REQUEST.STATUS = ACTIVITY.STATUS
group by grouping sets(AGENT.COMPANY_NAME, ())
I hope this is the right way for calculating average number of days
Since most part of the queries is the same
I tried to merge both the queries into one because I need to render the report in that fashion. But the moment I merge the query its giving absurd results.
Do post your thoughts on the same
Regards -
Reg.write query for report
Dear Experts
I am MM consultant and I am in need of generate reports.I don't know how to get the data from two table. Pls help me
with some codings
Thanks
Rajakumar.KHi.....
Check this... Here Iam joining MARA and MAKT tables.....
data: begin of itab occurs 0,
matnr like mara-matnr, <----like this you can select no.of fields from MARA
spras like makt-spras, <----like this you declare ur internal table with no.of fields of MAKT table
end of itab.
parameters: p_matnr like mara-matnr. <------ Later according to this material number you can display details
select p~matnr q~spras <----with p~ you can declare no.of from MARA, but those should me mention in above ITAB , also MAKT with q~
from
mara as p <---- p is for first table fileds
inner join <----- key word
makt as q <----- q is for second table fields
on p~matnr = q~matnr <----this is for link
into corresponding fields of table itab
where p~matnr = p_matnr. <------checking where condition with parameter
loop at itab.
write:/ itab-matnr, <--------here you can display the fields which you defined in ITAB
itab-spras.
endloop.
Also check this query....
Here you can display all the details of that tables...
data: begin of itab occurs 0,
matnr like mara-matnr,
spras like makt-spras,
end of itab.
data: p_matnr like mara-matnr.
select-options: g_matnr for p_matnr. <------First change
select p~matnr q~spras from mara as p inner join makt as q
on p~matnr = q~matnr
into corresponding fields of table itab
where p~matnr in g_matnr. <----second change
loop at itab.
write:/ itab-matnr,
itab-spras.
endloop.
Also check this code and get an idea about for all entries method and joining of more than two tables...
data: begin of itab occurs 0,
matnr like mara-matnr,
spras like makt-spras,
end of itab.
data: begin of jtab occurs 0,
matnr like marc-matnr,
werks like marc-werks,
end of jtab.
data: begin of t_out occurs 0,
matnr like mara-matnr,
spras like makt-spras,
werks like marc-werks,
end of t_out.
data: p_matnr like mara-matnr.
select-options: g_matnr for p_matnr.
select p~matnr q~spras from mara as p inner join makt as q
on p~matnr = q~matnr
into corresponding fields of table itab
where p~matnr in g_matnr.
if itab[] is not initial.
select * from marc into corresponding fields of table jtab
for all entries in itab
where matnr = itab-matnr.
endif.
loop at itab.
t_out-matnr = itab-matnr.
t_out-spras = itab-spras.
read table jtab with key matnr = itab-matnr.
if sy-subrc = 0.
t_out-werks = jtab-werks.
endif.
append t_out.
clear t_out.
endloop.
loop at t_out.
write:/ t_out-matnr,
t_out-spras,
t_out-werks.
endloop.
All the best!!
Thanks,
Naveen.I -
Modification of Query for report
Dear All,
In inventory one standard report -- Material account distribution summary and RDF is INVTRACS.rdf. this report will give whole transaction activity amount between two days. but our clients needs details of quantity and cost for every transaction then i will sum all those amounts. for this one i was developed one query. If u ran standard report it will gives net activity amount like--12164931.9 and ran my query it gives total amount -- 12163701.9 .It's having diff . but this query is working for some branches i.e for some branches standard report net activity amount and i developed query is same, but for some branches it's comes diff. same query but it is works for some branches only. and report name is 'INVTRACS.rdf'. my requirement for all branches it should be equal to standard report output amount and my query out. pls any body help me .it's urgent.
i was developed this query..
select mtt.organization_id,
mtts.transaction_type_name,
-- mtts.TRANSACTION_SOURCE_NAME,
msi.segment1 item_code,
mtt.transaction_quantity,
mtt.SHIPMENT_NUMBER,
mtt.TRANSACTION_UOM,
mtt.TRANSACTION_DATE,
imt.TRANSACTION_SRC_HDR,
houv.NAME ,
cid.UNIT_COST ,
round(mtt.transaction_quantity*to_number(cid.UNIT_COST),4) total
from mtl_material_transactions mtt,
mtl_system_items msi,
mtl_transaction_types mtts,
INVFV_MATERIAL_TRANSACTIONS imt,
hr_organization_units houv ,
CST_INV_DISTRIBUTION_V cid
where
to_date(to_char(mtt.transaction_date,'dd-mon-yy')) between '01-jul-08' and '31-jul-08'
--and mtt.organization_id = 115
and msi.inventory_item_id = mtt.inventory_item_id
and msi.organization_id = 105
and cid.TRANSACTION_ID=mtt.TRANSACTION_ID
and mtts.transaction_type_id = mtt.transaction_type_id
and mtt.TRANSACTION_ID=imt.TRANSACTION_ID
and cid.ACCOUNTING_LINE_TYPE='1'
--and mtt.transaction_id = '588156'
and mtt.ORGANIZATION_ID=houv.ORGANIZATION_ID
and houv.NAME = :p_nameany body
-
Very dificult query for me- need help
I have table first column is time( Timestamp) ,
second column is record_num( int )
Now I need get data table for every day 8:00am to previous day 20:00pm, sum(record_num).
How can I do the query.
Thanks for your time and help
original table like
time record_num
03 27 2006 07:32:03 2
03 27 2006 06:20:08 5
03 26 2006 23:30:01 1
03 26 2006 20:00:01 7
03 25 2006 23:00:20 7
wanted query result table
03 27 2006 1234
03 26 2006 3452
or only 1234, 3452......
since I need avg( )
Thanks againI am not sure exactly what you want, but it seems that if a record has a time after 22:00 then it should be included on the next day. And any records that are not between 8:00am and 8:00pm on the previous day should not be reported on. Is this what you are after?
Here is some code to achieve that:
control@DWDEV> create table my_data (my_time timestamp, my_value number);
Table created.
control@DWDEV>
control@DWDEV> -- This row should be included as it is at 1:00am
control@DWDEV> insert into my_data values (to_date('20060328010000','YYYYMMDDHH24MISS'), 1000);
1 row created.
control@DWDEV> -- This row won't be included because it is at 9:00am and not between 8am and 8pm on previous day
control@DWDEV> insert into my_data values (to_date('20060328090000','YYYYMMDDHH24MISS'), 2000);
1 row created.
control@DWDEV> -- This row should be included on the 29th because it is at 10:00pm on previous day
control@DWDEV> insert into my_data values (to_date('20060328220000','YYYYMMDDHH24MISS'), 3000);
1 row created.
control@DWDEV> -- This row should be included on the 29th because it is at 07:00am on same day
control@DWDEV> insert into my_data values (to_date('20060329070000','YYYYMMDDHH24MISS'), 400);
1 row created.
control@DWDEV> -- This row won't be included due to the time of 1:00pm
control@DWDEV> insert into my_data values (to_date('20060328130000','YYYYMMDDHH24MISS'), 600);
1 row created.
control@DWDEV>
control@DWDEV> select from8to8, sum(my_value)
2 from
3 (
4 select case
5 when to_char(my_time, 'HH24') >= 20
6 then to_char(my_time + 1, 'DD-MON-YYYY')
7 when to_char(my_time, 'HH24') < 8
8 then to_char(my_time, 'DD-MON-YYYY')
9 else
10 NULL
11 end as from8to8,
12 my_value
13 from my_data
14 where to_char(my_time, 'HH24') < 8
15 or to_char(my_time, 'HH24') >= 20
16 )
17 group by from8to8;
FROM8TO8 SUM(MY_VALUE)
28-MAR-2006 1000
29-MAR-2006 3400Hope that gives you a few ideas on how to achieve what you need.
Cheers,
Jeff. -
Help with PL/SQL returning SQL query for Report
Hi
I have got a report which I have formatted as PL/SQL function body returning SQL query.
I have the following code
declare
q VARCHAR2(32000); -- query
w VARCHAR2(4000) ; -- where clause
begin
q := 'select min(identified_date) first_identified,' ||
' max(actual_resolution_date) last_closed,' ||
' count("HELPDESK_CALL_ID) total_issues,' ||
' from tbl_helpdesk_calls';
if :P9_call_type != '-1' then
w := 'HELPDESK_CALL_TYPE_ID = :P9_call_type';
end if;
q := q || ' WHERE '|| w;
return q;
end;
When I apply changes I get this error message
Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-00972: identifier is too long
Any Idea where I maybe going wrong?thanks its compiling now but when I run the page I get this error message in the reports region
failed to parse SQL query:
ORA-00933: SQL command not properly ended
This is my code that I have at the momment.
declare
q VARCHAR2(32000); -- query
w VARCHAR2(4000) ; -- where clause
we VARCHAR2(1) := 'N'; -- identifies if where clause exists
begin
q := 'select min(identified_date) first_identified,' ||
' max(actual_resolution_date) last_closed,' ||
' count(HELPDESK_CALL_ID) total_issues,' ||
' sum(decode(status,''Open'',1,0)) open_issues, ' ||
' sum(decode(status,''On-Hold'',1,0)) onhold_issues,' ||
' sum(decode(status,''Closed'',1,0)) closed_issues,' ||
' sum(decode(status,''Open'',decode
(priority,''High'',1,0),0)) open_high_prior,' ||
' sum(decode(status,''Open'',decode
(priority,''Medium'',1,0),0)) open_medium_prior, '||
' sum(decode(status,''Open'',decode
(priority,''Low'',1,0),0)) open_low_prior '||
' from tbl_helpdesk_calls';
if :P9_call_type != '-1' then
w := 'where HELPDESK_CALL_TYPE_ID = :P9_call_type';
we := 'Y';
end if;
if we = 'Y' then
q := q ||w;
end if;
return q;
end;
I have a select list with a list of reports. what I am trying to do build an sql depending on what the :p9_call_type value is. -1 represents the display value of -All Reports- so if the user selects all reports it should display all results thus removing the where clause. However as my code stands when I user clicks on all reports he get the correct results for all reports. If the user selects anything else they get the error message above. -
Query for Report Asset By Location
Dear All,
I want to record asset using add on SAP. I want to make a query report that show asset per location. I'm using field U_User01 to record location of FA. The report will contain Code of FA, Name of FA, location, Acquisition value, Accum Depr and Net book value. This report will be made per period.
Is there any one can help me to make the query ?
Thanks a lot for your helpHai..is there anyone that can help me to solve this problem ? Thanks for the help
-
Hi all
I have one big table with column:
code,street,data_type,credit,debt,saldo,date
I was creating query like
select sum(saldo),code from tableA where data_types=1 and date <'201010' group by code
but cant expand this query to be as report like
COLUMN1 COLUMN2 COLUMN3 COLUMN4
sum(saldo) -where type=1 and date = '201201', sum(saldo) where type=2, sum(saldo) where date ='201205' , code
whats best solution to report sums for diferent data_types on one line with just one code per lines?
regards
Gordan
Edited by: useruseruser on May 14, 2013 10:52 AMHi,
something like this?
WITH mydata AS
SELECT 2 code, 1 data_type, TO_DATE('01/01/2012','DD/MM/YYYY') dt, 100 saldo FROM DUAL UNION ALL
SELECT 2 code, 2 data_type, TO_DATE('01/02/2012','DD/MM/YYYY') dt, 50 saldo FROM DUAL UNION ALL
SELECT 2 code, 2 data_type, TO_DATE('01/03/2012','DD/MM/YYYY') dt, 40 saldo FROM DUAL UNION ALL
SELECT 2 code, 2 data_type, TO_DATE('01/04/2012','DD/MM/YYYY') dt, 80 saldo FROM DUAL UNION ALL
SELECT 2 code, 2 data_type, TO_DATE('01/05/2012','DD/MM/YYYY') dt, 50 saldo FROM DUAL UNION ALL
SELECT 5 code, 1 data_type, TO_DATE('01/01/2012','DD/MM/YYYY') dt, 200 saldo FROM DUAL UNION ALL
SELECT 5 code, 2 data_type, TO_DATE('01/02/2012','DD/MM/YYYY') dt, 175 saldo FROM DUAL UNION ALL
SELECT 5 code, 1 data_type, TO_DATE('01/03/2012','DD/MM/YYYY') dt, 300 saldo FROM DUAL UNION ALL
SELECT 5 code, 2 data_type, TO_DATE('01/04/2012','DD/MM/YYYY') dt, 85 saldo FROM DUAL UNION ALL
SELECT 5 code, 2 data_type, TO_DATE('01/05/2012','DD/MM/YYYY') dt, 85 saldo FROM DUAL
SELECT SUM(CASE
WHEN data_type=1 AND TO_CHAR(dt,'YYYYMM')='201201'
THEN saldo
END) col1
, SUM(CASE
WHEN data_type=2
THEN saldo
END) col2
, SUM(CASE
WHEN TO_CHAR(dt,'YYYYMM')='201205'
THEN saldo
END) col2
, code
FROM mydata
GROUP BY code;
COL1 COL2 COL2_1 CODE
100 220 50 2
200 345 85 5It's considered a good practice to mark questions as answered when the answers are satisfying your question or provide additional details.
You seem to have a lot of questions unresolved:
Handle: useruseruser
Status Level: Newbie (5)
Registered: Jun 25, 2007
Total Posts: 468
Total Questions: 75 (49 unresolved) Are they really all without answer?
Regards.
Al
Edited by: Alberto Faenza on May 14, 2013 11:10 AM
Code changed as initial post changed -
I have a table with following data
Client Deal_No Order_No Deal_date
C1 D1 Ord1 01/03/2006
C1 D1 Ord2 01/03/2006
C2 D2 Ord3 01/03/2006
C3 D3 Ord4 01/03/2006
C4 D4 Ord5 01/03/2006
C4 D4 Ord6 01/03/2006
Here one client and deal_no can correspond to either 1 OR many Orders.
So only Order no differs in for rows with C1 as well as C4.
So,I want to generate a report which can show data either of the following format
(1)
Duplicate data should be displayed only once.
Client Deal_No Order_No Deal_date
C1 D1 Ord1 01/03/2006
Ord2
C2 D2 Ord3 01/03/2006
C3 D3 Ord4 01/03/2006
C4 D4 Ord5 01/03/2006
Ord6
Here Ord2 should be displayed below Ord1 and Ord6 below Ord5(could not maintain original formattting)
(2)
One row instead of many for
Client Deal_No Order_No Deal_date
C1 D1 Ord1,Ord2 01/03/2006
C2 D2 Ord3 01/03/2006
C3 D3 Ord4 01/03/2006
C4 D4 Ord5,Ord6 01/03/2006
Can anybody suggest a query?How to release this break . such that i want to see
all the records backuse the CLEAR BREAKS command
SQL> select * from sample_client;
CLIENT DEAL_NO ORDER_NO DEAL_DATE
C1 D1 ord1 01-MAR-03
C1 D1 ord2 01-MAR-03
C2 D2 ord3 01-MAR-03
C3 D3 ord4 01-MAR-03
C4 D4 ord5 01-MAR-03
C4 D4 ord6 01-MAR-03
6 rows selected.
SQL> break on client on deal_no on deal_date;
SQL> select * from sample_client;
CLIENT DEAL_NO ORDER_NO DEAL_DATE
C1 D1 ord1 01-MAR-03
ord2
C2 D2 ord3 01-MAR-03
C3 D3 ord4 01-MAR-03
C4 D4 ord5 01-MAR-03
ord6
6 rows selected.
SQL> CLEAR BREAKS;
breaks cleared
SQL> select * from sample_client;
CLIENT DEAL_NO ORDER_NO DEAL_DATE
C1 D1 ord1 01-MAR-03
C1 D1 ord2 01-MAR-03
C2 D2 ord3 01-MAR-03
C3 D3 ord4 01-MAR-03
C4 D4 ord5 01-MAR-03
C4 D4 ord6 01-MAR-03
6 rows selected.
SQL> -
Query for report generation and email alert
Hi,
I do have a requirement in my project like the following.
1. We do have multiple interfaces sending request to one of the target Webservices
2. Receiving response back from Webservices
3. Also logging the same using log4J
My requirement is to filter out response messages based on particular interface(Lets say Order status) using name/ timestamp for particular day, save/append all responses in to a file and should send an email report at a given point of time.
Report has to generate once in a day E.g Time: 00:00 AM every day.
Is that possible to achieve the same through ALSB(Aqua Logic Service Bus). Please help us in implementing this requirement.
Thanks in advance,
KrishnaYou probably concentrate too much on OSB. I see two issues:
1. Appending everything into a single file. I have never tried file transport, so I don't know if this is possible or not, but looking at documentation I don't think its possible:
http://download.oracle.com/docs/cd/E13159_01/osb/docs10gr3/httppollertransport/transports.html#wp1081043
2. As far as I know there is no support for scheduling in OSB.
I don't know your situation and requirements, but you should rather implement your reporting logic outside of OSB. For example you can filter response messages in OSB and "log" them through a logging web service (service callout in alsb). That service could accumulate your report in a file and send it with the first request each day. This approach could eliminate usage of any scheduling component.
Personally, if I were you I would thing about my infrastructure logging capabilities on proxy server, http server or whatever is in use. Combined with unix cron daemon, the solution could be very easy and straight-forward.
Maybe you are looking for
-
Report does not render image when using DoCmd.OutputTo to PDF
Hello All.... and Happy new year !!! I have a form that has an embedded report and a series of cmd buttons to print the report or export it to file and saves it. In the report I have an Image object (a logo) that is in the header. When I print the re
-
New Mini (HDMI) with CRT Big Screen TV (RP)
Is anyone using the new Mini with a CRT TV. I have a Mitsubishi WS-65813 rear projection TV that I'd like to connect to the New Mini using HDMI to DVI. I had one of the older Mini's and the problem was the screen on the TV was not full screen or it w
-
After trying to reinstall my dvd studio pro 2 on my G5 it will not let me install the disk and gives me the message,[ missing old bill of materials for this package was not found]
-
How do i get my camera roll on my iphone onto my ipad (using icloud backup)
Hi, i no longer have a iphone but i have a new ipad. Before i got rid of my iphone i did a number of successful back ups over icloud for my camera roll. I didn't do any apps and i had 3gbs left on my icloud. When i go to restore from icloud on my ipa
-
Robohelp 11 output not compatible with IE11 and IE10
I am new to RoboHelp 11 and we've a release looming over us. The web help output files are not loading on other computers but are working fine at my end or my colleague's system (we both have RoboHelp installed in our systems) We used Robohelp 8 for