Return summary for the masters of query classes
Hi all
I use oracle database 11g r2.
I have 2 tables,
create tabel expenses_heads (exp_head_id number primary key, Main_exp_name varchar2(100) not null, refer_exp_head_id number); alter table expenses_heads add constraint fk_refer_head_id foreign key(refer_exp_id) references expenses_heads(exp_head_id); create table expenses (exp_id number primary key, exp_head_id number references expenses_heads(exp_head_id) not null, exp_name varchar2(100) not null, exp_date date not null, exp_amount number not null, receipt varchar2(20), remarks varchar2(4000)); i have the following data, insert into expenses_heads values(1,'School',null); insert into expenses_heads values(2,'College',null); insert into expenses_heads values(3,'Bills',1); insert into expenses_heads values(4,'Hardware',1); insert into expenses_heads values(5,'Food',1); insert into expenses_heads values(6,'Dress',1); insert into expenses_heads values(7,'Hardware',1); insert into expenses_heads values(8,'Admission',2); insert into expenses_heads values(9,'Office',2); insert into expenses values(1,3,'Electricity Bill',sysdate,1000,null,null); insert into expenses values(2,3,'Water Bill',sysdate,100,null,null); insert into expenses values(3,4,'Chair',sysdate,1000,null,null); insert into expenses values(4,4,'Tables',sysdate,200,null,null); insert into expenses values(5,8,'Admin Ceremony',sysdate,3000,null,null); insert into expenses values(6,9,'Stationary',sysdate,2000,null,null); commit;
now, I want to write a query relating analytical columns, Main_exp_name(from expenses_heads) and Total_amount (from expenses)
result should look as below
Main_exp_name Total_Amount College 2300 university 5000
I think it could be written using the Group of and rollup, cube or grouping sets, but confused.
kindly help.
Hierarchical query using:
select h.main_exp_name, sum (exp_amount) exp_amount from expenses e join ( select refer_exp_id, exp_head_id, prior main_exp_name main_exp_name from expenses_heads connect by refer_exp_id = prior exp_head_id ) h on ( e.exp_head_id = h.exp_head_id ) where main_exp_name is not null group by h.main_exp_name; MAIN_EXP_NAME EXP_AMOUNT ---------------------------------------------------------------------------------------------------- ---------------------- School 2300 College 5000
Tags: Database
Similar Questions
-
FRM - 40603:Records is no longer reserved for the update. Query for changes
Hi I have a form that has been developing 6i and upgraded to 11g form work well in 6i, but when I try to do the same function in 11g get this error
FRM - 40603:Records is no longer reserved for the update. Query for changes
When I commit this execute_query (for_update); It is the form to clear values when it loads, the error comes when I try to deleteHow can I do this
Action: If you want to change the block, you will need to re - interview.
I use When-Timer-Expired (WTE) trigger
You have a 'relationship' defined between the blocks of your master and detail? If so, simply update your master block and the block of details will automatically be re-interviewed. If you cannot use a relationship, then you can use can create a timer in the trigger that updates the database, then in the trigger When-Timer-Expired (WTE) you can go to the retail block and run a query. For example: / * the sample on change trigger * /.
DECLARE timer_id TIMER; BEGIN ....your code here that performs the update.... /* Now create an instance of a timer */ timer_id := Create_Timer ('upd_detail',1,NO_REPEAT); END;/* Sample Form Level When-Timer-Expired trigger */ DECLARE timer_id TIMER; BEGIN -- Find the timer first timer_id := FIND_TIMER('upd_detail'); IF NOT ID_NULL(timer_id) THEN GO_BLOCK('DETAIL_BLOCK'); Execute_Query; END IF; END;
-
For the purchase of query tables
Helloo
What are the names of table for the fields of purchase please
Responsibility-purchase-purchase orders
1. the amount
2. ship - to
3 status
Responsibility-purchase-purchase orders
4 category
Divided into category group and class
5 closure status
Navigation - Summary of purchase PURCHASING order-
What table to find the following for purchase orders?
6 Cancellation Date
7 cancellation reason
In the PO_LINE_LOCATIONS_ALL where I can find the next field?
8. remaining quantity
Thank you
See query below that can help you. I use query on rcv_transactions to see what was received in a first time, but has not yet received in the second stage. You can also consult the lines of distribution to see how much has been ordered and delivered, but know that you can have several distributions for each line...
SELECT P.Segment1 PO_Number , P.Closed_Code , P.Cancel_Flag , LOC. Location_Code , L.Line_Num , L.Quantity * L.Unit_Price amount , Category Cat.Concatenated_Segments , CAT. Category_Group Segment1 , CAT. Category_Class Segment2 , L.Cancel_Flag , L.Cancel_Date , L.Cancel_Reason , (
SELECT Sum (DECODE (T.Transaction_Type, 'RECEIVE', T.Quantity * T.Primary_Quantity, 'RETURN to RECEIVING', T.Quantity * T.Primary_Quantity,-T.Quantity * T.Primary_Quantity))
OF rcv_transactions T
WHERE T.PO_Line_Location_Id = PL. Line_Location_Id
) Qty_To_Be_Delivered
SAY. Quantity_Ordered
SAY. Quantity_Delivered
OF PO_HEADERS_ALL P
, PO_LINES_ALL L , LOC HR_LOCATIONS , mtl_categories_kfv cat , PO_LINE_LOCATIONS_ALL PL , PO_DISTRIBUTIONS_ALL SAID WHERE P.Segment1 '2564686' = AND P.PO_Header_Id = L.PO_header_Id AND L.Category_Id = the cat. Stuff AND P.Ship_To_Location_id = LOC. location_id AND L.PO_Line_Id = PL. PO_Line_Id AND L.PO_Line_Id = TELL. PO_Line_Id ;
-
Setting for the SkillBuilders Calendar plugin class
Hello, I use the SkillBuilders calendar plugin and I need to define a CSS class for an event. I use this definition:
< style >
{.newClass}
background-color: #000000;
border-color: #000000;
border-style: solid;
color: #FFFFFF;
}
< / style >
and I put the class properly in the query for the region. In my view, the class is defined for the event but does not show the color and the background color I need, is to show the default colors. Has anyone set a class using this plugin? Any thoughts? Thanks in advance.
I found the answer to the search in the css class.
. MyClass,
. CF-agenda .myclass .fc-event-time,
. MyClass {a}
background-color: black;
border-color: black;
color: Red;
}
-
Return policy for the laptop. 2 questions please.
Hello world!
I bought some computers laptops and desktops from HP over the years but never had back none of them until my recent order. I recently placed an order on the laptop but I found a better computer hp laptop at bestbuy, so I called and cancelled the order (only after 15 hours of the order) but HP CS rep would not let me Cancel. She told me to just leave it delivered and return it once I received the laptop. HP will pay for return shipping charges and give me a FULL REFUND; which means that they don't give me the refund less shipping fees. I asked to confirm what she has told me that I will receive my full refund for my order and HP will send me a return shipping label at their cost. If this is true what she told me, then HP has the best customer service out there.
My question to anyone who has purchased and returned HP stuff is it is true about what the CS rep tells me? Moreover, I get free shipping on my order if it makes a difference. I pray for your opinion on this please.
Thank you all for your time and happy thanksgiving to all!
Micca1234
See the following page HP Shopping "Returns and exchanges" on their return policy / exchange:
Return exchange
Exchange & return policy
Return period
We encourage you to try your products immediately so that if there is a problem, you can return them before the return deadline. We accept returns and exchanges up to 21 days after childbirth, except on open software box, printers Designjet Z2100 series, HP Color LaserJet CP6015dn printer, and gift cards (except where required by law). After the period of 21 days, you can get support for questions of HP customer service product.
CreditsCredit for Returns or exchanges is given when confirm us the receipt of the goods. Please be aware that your financial institution may take 5 to 7 business days to process your credit and let the account in your account.
RefundsTax (if any) is refunded with returns.
Original shipping and handling are not refundable.
When you return the items in a group of items purchased, the remaining amount spent maybe is more eligible for a discount, you may have received (for example, for gifts with purchase, free gift, purchase in quantity). If this is the case, the discount is subtracted the price paid for the returned item. To receive a full refund, all items in the original purchase must be returned.
-
Return "n" for the box unchecked
OK, I'm sure I must be missing something simple. Embarrassed even to ask the question. But I want to have a page element simple checkbox in a form that will return a 'Y' if it is enabled and a "n" if unchecked. I tried to set the default value for the element to "n", but when I check my table, I always get a NULL value in the table for the box unchecked.
Thanks in advance!
JohnHello
This article provides a method of conversion null for "none".
http://StackOverflow.com/questions/8329700/how-to-create-a-value-responsive-checkbox-in-Oracle-apex
It will be useful.
Best wishes
Howard -
How to change the return service for the configuration of pair of Eve Active
I created the pair of Eve Active (no Clusterware) with service return TWOSAFE RETURNS the value.
How can I change of RETURN TWOSAFE changed to RETURN RECEIPT?create active standby pair dbactive on "server1", dbstandby on "server2" return twosafe ;
Thanks in advance for the help.
Kind regards
GaryYou must configure the return Service to manage failures of network/timeouts. See 'Establishment' will return failure political failure/recovery service here (http://docs.oracle.com/cd/E21901_01/doc/timesten.1122/e21635/design.htm#TTREP342)
The Return Service clause allows you to set up when the transaction must be validated locally where the replication agent does not receive any acknowledgment of the intelligence officer.
-DISABLE the RETURN sets the number of timeouts before it stops waiting for the Subscriber to answer.
-You can set attribute SUSTAINABLE COMMIT to commit the transaction with Commit sustainable is set on the current database, after RETURN of SERVICE is disabled.At the application level, you can also control what you want to do if there is a timeout, you can set the LOCAL ACTION of COMMETTRE to VALIDATE or NO ACTION. If you want the agent of rep to commit the transaction locally, it is transparent to the application code. If you set NO ACTION, the application
may decide whether to re - issue the call validation or roll back the transaction.The link to the above documentation has more details.
Susan
-
Dynamic recovery for the dynamic sql query
Hi all
I want to create a query dynamically and to fetch it in a dynamic cursor record... The structure of the record should be the same as that of the query...
Can you suggest any method to do this.
for example
OPEN < dynamic news > TO < dynamic stmt >;
LOOP
FETCH < dynamic news > < DYNAMIC rec >;
---
END LOOP;
CLOSE < dynamic news >;
How to declare the rec here dynamic? I wouldn't have the columns in the query in advance either.
Thank you
Merz
Published by: merz Sep 12, 2011 17:02
Published by: merz Sep 12, 2011 17:03Merz says:
How to declare the rec here dynamic? I wouldn't have the columns in the query in advance either.
Is not possible. What you describe is called four dynamic sql type. For this type of synamic SQL, you use the DBMS_SQL package.
SY.
-
Memory card for the coming Pro 8, class 4 or class 10 recommended?
Hi just brought the Tablet coming 8 Pro and the need to add a micro SD card. Wondering if you can recommend if she need a regular class 4 card or if it is recommended to use the class 10? Thank you.
A class 4 card will do, but you would be better served with a faster card class 10.
-
Lord I'm back
You have done a few separate posts on this problem. You have been deceived into downloading something by malicious actors.
There is a good possibility that:
- You have provided your credit card number to criminals. You must contact your bank to cancel the charges and issue you a new card.
- You have probably installed malicious software on your computer. You'll probably want to work with an expert to resolve this, and/or format the machine completely and start again.
- Once you got the computer back to a State that you can trust, it's probably a good time to change all your passwords, especially for something important...
Please, always download software directly from the manufacturer's website.
You can download a copy of legitimate, free Flash Player here:
-
air.swf getStatus() returns 'available' for the installation of side car
I hope someone from Adobe can help with this one. We have received the license from Adobe to redistribute the Adobe AIR runtime and we use the method of side car. Installation of AIR and our application works correctly, you can launch our app as well and rolls.
The problem is that, sometimes, we are launching our AIR application using a Web site and the air.swf (for lack of a better word) component to determine if AIR is installed and proper version of our application.
Under Windows, it seems that our silent installation does not have files that are accessible by the air.swf in the right place - so he reports 'available' instead of 'installed', even if AIR and our app are actually installed and works perfectly.
During our silent installation of AIR, it appears the Adobe AIR installer puts a file (airappinstaller) that contains 2 files (the airappinstaller.exe and a digest.s) - the folder is installed here:
\Adobe\Flash Player\AddIns\airappinstaller {program Files}
However, the utility of the air.swf is looking for them to be installed here:
{UserFolder} \AppData\Roaming\Macromedia\Flash Player\ \bin\airappinstaller www.macromedia.com
It seems the first time everything is installed, two folders will be created correctly. But if the user has subsequently uninstalls AIR, when they use our Installer to re - install AIR (and our application) "Macromedia" folder is not created. If manually copy us the files in the folder in the box "ProgramFiles\Adobe" in the Macromedia air.swf file then starts the correct status of statement again.
How we overcome this problem to avoid calls to technical support on this? Is there a flag that we can move the installer?
We get the same result using Windows 2008, XP and 7
It is a little unhappy quirk of the installer of the AIR. When you perform a silent installation as an administrator like you do, it is generally not possible to write to the location of each user that the badge again. To counter that almost any when you do anything as a user in the AIR we will copy the files airappinstaller and other things by user to their correct if necessary locations. There is also a specific flag, you can switch to the Installer application for this
/ Applications/utilities/Adobe\ AIR\ Application\ Installer.app/Contents/MacOS/Adobe\ AIR\ Application\ Installer - updateUserState
If you run that, as a user, it should fix everything up
-
Update for the advanced table query.
Hello
I am a newbie at OAF so need help with a simple task.
I have an advanced table that was created using the query in the expert mode of the VO. (because it contains data from more than one table).
Now, I want to update the data of any line which is amended in the table,
I followed the example in table advanced in the tutorial and reached until the update method of the AM. Now, I'm not able to update the table. When I searched the forum said that I have a simple EO on the table to be updated, but I want to update multiple tables (foreign key relationship), if can do using the same VO? I have both the VO (based on one select query custom Expert mode and other normal VO EO-based).
Can someone give me it please update the table in the query?
Thank you
VKHi Vishal,
It is good to know that your problem is almost solved.
Yes, you will need to create separate poplist VO and one more thing, if you use poplist, you do not use custom query (expert mode).
Kind regards
Out Sharma -
Return of records only for the current month
Hello
I have a query that returns records for the current week and I want to extend it for return records for the current month.
When TRUNC (start_date) < NEXT_DAY (TRUNC (CURRENT_TIMESTAMP) - 1, "Sat") + 1
AND TRUNC (end_date) > NEXT_DAY (TRUNC (CURRENT_TIMESTAMP) - 1, 'Sam')-7
I have two date fields, the first is called 'Start_Date', the second is called 'End_Date '. I want the query to return all the records for the current month including those who may start before or end post the month as events can start in a month and end with another. Does anyone know how this is done in a "Clause where?
Kind regards
Steve WelchYou probably want to
where TRUNC (START_DATE) <= LAST_DAY(TRUNC(sysdate, 'MONTH')) AND TRUNC (END_DATE) >= TRUNC(sysdate, 'MONTH')
-
Query for the part_usg_id.
Query:
Select part_usg_id, avbom_part_usg_sakey, avbom_part_usg_pub_dts gmcmt09_avbom_part_usg_dtl t09
where t09.part_usg_id IN (5336139,5586165,5336149,5586548,5336145,5586547,5478885,5478857,5600201)
order of avbom_part_usg_sakey
Result:
5336145 980051 18 - SEP - 11 18.20.30.030000000
5586547 980051 13 NOVEMBER 11 18.11.51.051000000
5336149 980051-2 18.20.30.030000000 18-SEP-11
5586548 980051-2 NOVEMBER 13, 11 18.11.51.051000000
5336139 980051-3 18.20.30.030000000 18-SEP-11
5586165 980051-3, NOVEMBER 13, 11 18.11.51.051000000
5600201 998905 13 NOVEMBER 11 18.13.25.025000000
5478857 998905-2, 16 OCTOBER 11 18.21.27.027000000
5478885 998905-3 16 OCTOBER 11 18.21.27.027000000
-------------------------------------------------------------
Required for the scenario below query:
The above data is an example of data. Do not hard code hard data. November 13, 2011 can also be 11-dec-2011.
And part_usg_id, avbom_part_usg_sakey will also change. so, don't hard-code not in sql.
I need all the part_usg_id for a max avbom_part_usg_pub_dts in the avbom_part_usg_sakey group.
Sense Group (980051,980051,980051-2,980051-2,980051-3,980051-3). Another group (998905, 998905-2, 998905-3)
So I need a query that returns the results as below
5586547 980051 13 NOVEMBER 11 18.11.51.051000000
5586548 980051-2 NOVEMBER 13, 11 18.11.51.051000000
5586165 980051-3, NOVEMBER 13, 11 18.11.51.051000000
5600201 998905 13 NOVEMBER 11 18.13.25.025000000
Use the table as:
with t as (select part_usg_id, avbom_part_usg_sakey, avbom_part_usg_pub_dts gmcmt09_avbom_part_usg_dtl t09
where t09.part_usg_id IN (5336139,5586165,5336149,5586548,5336145,5586547,5478885,5478857,5600201)
order of avbom_part_usg_sakey)
Select * from t; -ask here
Thank you
Vinodh
Published by: Vinodh2 on November 23, 2011 01:29Ok.
Try thisWITH t AS ( SELECT part_usg_id, avbom_part_usg_sakey, avbom_part_usg_pub_dts FROM gmcmt09_avbom_part_usg_dtl t09 WHERE t09.part_usg_id IN (5336139,5586165,5336149,5586548,5336145,5586547,5478885,5478857,5600201) ORDER BY avbom_part_usg_sakey ) SELECT part_usg_id, avbom_part_usg_sakey, avbom_part_usg_pub_dts FROM ( SELECT t.*, rank() over(partition BY regexp_substr(avbom_part_usg_sakey,'[^-]*') order by avbom_part_usg_pub_dts DESC ) rn FROM t ) WHERE rn = 1;
-
Return of the records for the current month, previous and next
Hello.
Robert Charlton contributed to my last question on this topic and thank him once more for this.
When you filter the results of the report by using the following database returns records for the current week:
WHERE 'SS_LEAVE '. "" LEAVE_TYPE "="SS_LEAVE_TYPE. " "" IDENTITY CARD ".
AND)
InStr (superior ("EMPLOYEE"), upper (nvl (: P2001_SEARCH, 'EMPLOYEE'))) > 0 or
InStr (upper ("SUPERVISOR"), upper (nvl (: P2001_SEARCH, 'SUPERVISOR'))) > 0
)
AND TRUNC (end_date) < NEXT_DAY (TRUNC (CURRENT_TIMESTAMP) - 1, 'Sam') + 1
AND TRUNC (end_date) > NEXT_DAY (TRUNC (CURRENT_TIMESTAMP) - 1, "Sat")-7
My question is this time is:
How to make a filter for the current month, the 'previous month', and 'next month '?
Kind regards
Steve WelchSteve,
Current month:
and trunc(end_date) >= trunc(current_timestamp,'MM') and trunc(end_date) < add_months(trunc(current_timestamp,'MM'),1)
Previous month:
and trunc(end_date) >= add_months(trunc(current_timestamp,'MM'),-1) and trunc(end_date) < trunc(current_timestamp,'MM')
Next month:
and trunc(end_date) >= add_months(trunc(current_timestamp,'MM'),1) and trunc(end_date) < add_months(trunc(current_timestamp,'MM'),2)
-David
Maybe you are looking for
-
Hey everybody! So today when I opened my messaged I saw these messages (attached) in my phone. And one of these messages have been sent to a person and the rest, I received, but I never had any notification. All these messages show that they were rec
-
After the upgrade to iOS 9.3.4 my iPad air2 is suspended
I recently updated my iPad air2 and it crashes when I try to switch between applications. Also when I drag the screen there is lag
-
Layout of new anime if I try to scroll down
I have flashing and sensory processing issues, animation, etc can hurt, can trigger my migraines, and flashing lights of security triggered my seizures. I do not understand why so many sites, including this site adopt the same as painful, where they
-
Slim Canvio for Mac now not recognized by my Macbook
HelloI use a Slim CAnvio for Mac 1 TB drive hard outside for a few months to save my Macbook Pro.I did not support for 2 weeks and plugged the HD into the USB slot to save in Time Machine and is not to be recognied by my laptop! The blue light on the
-
I own a Macbook pro mid 2012. Now I want to increase the RAM of 4 GB to 8 GB, please suggest if this update will help me to improve my performance to macbook.