Query to find revenue of a bank
We have loan datamart and account datamart. For joining the two fact tables of loan and account, we use customer table as conformed dimension.we need to calculate the revenue,assets and liability of the bank.can anyone help us with this??
loan datamart contains the folowing tables:
loan_fact customer time branch loan interest
loan_balance cust_id time_id branch_id loan_id interest_id
trans_amount cust_name year branch location loantype interest_rate
loan_amount month no_of_installments
EMI day no_of_installments paid
account datamart have the following tables:
account_fact customer time branch interest account
deposit_amount account_id
withdraw amount account-type
service_charge
insufficient fund fee
Edited by: 915235 on Mar 7, 2012 1:01 AM
915235 wrote:
We have loan datamart and account datamart. For joining the two fact tables of loan and account, we use customer table as conformed dimension.we need to calculate the revenue,assets and liability of the bank.can anyone help us with this??
loan datamart contains the folowing tables:
loan_fact customer time branch loan interest
loan_balance cust_id time_id branch_id loan_id interest_id
trans_amount cust_name year branch location loantype interest_rate
loan_amount month no_of_installments
EMI day no_of_installments paid
account datamart have the following tables:
account_fact customer time branch interest account
deposit_amount account_id
withdraw amount account-type
service_charge
insufficient fund fee
Edited by: 915235 on Mar 7, 2012 1:01 AMI see you edited your original post.
to answer your question about whether we can help you or not:
yes, but not with the information you've given us, you've answered one of my questions (table definitions) but:
what have you got so far?
why hasn't it worked for you? (what error messages are you getting?)
what is your oracle version?
where is the sample data?
where is the sample expected output?
Similar Messages
-
How would one build a query to give daily balance across bank accounts? (to then plot in a graph)
Assumptions:
* There is a table TRANSACTIONS which includes columns TRANS_DATE, AMOUNT and BANK_ID. It does NOT include a column for balance. So current balance for a bank account is the sum of the AMOUNTs for that BANK_ID for example. Balance on date XX will be the sum
of all AMOUNTS for that BANK_ID for all TRANS_DATE's prior and including the date XX.
* There is not necessarily transactions on every day for each bank
* Table BANKS which has BANK_ID and TITLE
Would like a query that gives: Supply StartDate and EndDate for the query:
Date Bank1Balance Bank2Balance Bank3Balance TotalBalance
1/1/15 $100 $200 $100 $400
1/2/15 $200 $200 $100 $500
etcYou'll find examples of queries for computing balances in various contexts in Balances.zip in my public databases folder at:
https://onedrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
If you have difficulty opening the link copy its text (NB, not the link location) and paste it into your browser's address bar.
The queries in this little demo file return balances per transaction, however, whereas you appear to wish to return balances at close of business per day. This can easily be done by means of a subquery which sums all transactions to date. To return
balances for all dates regardless of whether or not any transactions have been undertaken on the day, an auxiliary calendar table can be introduced into the database to plug the gaps, The Calendar.zip file in my same OneDrive folder has means of generating
such a table.
With the introduction of an auxiliary calendar table into the database a query can then be written to return the balance per customer at close of business per day over the period 2009 - 2012 covered by the data in the Transactions table:
SELECT CustomerID, Firstname, LastName, calDate,
(SELECT SUM(TransactionAmount)
FROM Transactions
WHERE Transactions.CustomerID = Customers.CustomerID
AND Transactions.TransactionDate <= Calendar.calDate) AS Balance
FROM Calendar,Customers
WHERE calDate BETWEEN #2009-01-01# AND #2012-12-31#
ORDER BY CustomerID, CalDate;
Rows for each customer/date are returned by means of the Cartesian product of the Calendar and Customers tables (the latter analogous to your Banks table), and the subquery returns the balance at close of each day by correlating the Transactions table with
the Customers and Calendar tables, returning the sum of all transactions per customer up to and including the date in question. In this example credit and debit transactions are expressed as positive and negative values in a single column of course,
but where separate credit and debit columns are used its merely a case of summing (Credit-Debit), as done in some of the examples in my demo.
To return the data in a horizontal format per date I'd suggest the use of a report which returns one row per date, and within it a multi-column subreport in across-then down column layout, linking the subreport to the parent report on the date columns.
Ken Sheridan, Stafford, England -
Query to find out the time used by an user for an application
Hello All,
I want to know the query to find out the whole time used by the user for an application. Please view the below data
Employee:
SNO EMP_ID EMP_NAME EMP_DATE LOGIN_TIME LOGOUT_TIME
1 10 Visu 21-Nov-2010 06:30:00 07:30:00
2 10 Visu 21-Nov-2010 06:40:00 07:20:00
3 10 Visu 21-Nov-2010 06:50:00 07:50:00
4 10 Visu 21-Nov-2010 07:30:00 08:30:00
5 10 Visu 21-Nov-2010 09:30:00 10:30:00
By checking the above data we can say that the total time Visu used the application is
8.30 - 6.30 (From 1,2,3,4 records) = 2hrs
10.30 - 9.30 (Based on 5th rec) = 1hr
So the total time Visu used the application would be 3 hrs = 180 mins.
Could you please help me in getting the result from that data using a query?odie_63 wrote:
I think it may be solved with analytics too.
with t1 as (
select 1 sno,10 emp_id,'Visu' emp_name,'21-Nov-2010' emp_date,'06:30:00' login_time,'07:30:00' logout_time from dual union all
select 2,10,'Visu','21-Nov-2010','06:40:00','07:20:00' from dual union all
select 3,10,'Visu','21-Nov-2010','06:50:00','07:50:00' from dual union all
select 4,10,'Visu','21-Nov-2010','07:30:00','08:30:00' from dual union all
select 5,10,'Visu','21-Nov-2010','09:30:00','10:30:00' from dual
t2 as (
select emp_id,
emp_name,
emp_date,
to_date(emp_date || login_time,'DD-MON-YYYYHH24:MI:SS') login_time,
to_date(emp_date || logout_time,'DD-MON-YYYYHH24:MI:SS') logout_time
from t1
t3 as (
select t2.*,
case
when login_time < max(logout_time) over(
partition by emp_id,emp_date
order by login_time
rows between unbounded preceding
and 1 preceding
then 0
else 1
end start_of_group
from t2
t4 as (
select t3.*,
sum(start_of_group) over(partition by emp_id,emp_date order by login_time) grp
from t3
t5 as (
select emp_id,
emp_date,
min(login_time) login_time,
max(logout_time) logout_time
from t4
group by emp_id,
emp_date,
grp
select emp_id,
numtodsinterval(sum(logout_time - login_time),'day') time_spent
from t5
group by emp_id
order by emp_id
EMP_ID TIME_SPENT
10 +000000000 03:00:00.000000000
SQL> SY. -
How to use ONE query to find out tree structure?
ID------------upperID----------Name------------------------isFolder
1------------ 0---------- Folder
1------------------------------------1
2------------ 1------------ Folder 1- Sub
Folder--------------------1
3------------ 2------------
Folder1-Item1-A--------------------------0
4------------ 1------------ Folder 1- Sub
Item-----------------------0
Hi all, if I have a table like above to demonstrate the
folders and item relationship. This structure allows the user to
create unlimited folders and items.
Now I would like to use one query to find out the tree
structure of this table, how could I do the query.
Any help on this will be highly appreciated!
Thanks,
ezAlso, see this thread:
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=12 55788&enterthread=y -
Looking for a query to find first/last dates in overlapping dates...
Hi,
I'm looking for a query to find the first dates and last dates in a table conaining overlapping dates.
I have a subscription table which has for each Customer start and end date for different subscriptions.
I want to know the different ranges of date where there is subscriptions active.
so if the table has this:
CustID, Start date, end date
1, 2008-01-01, 2012-06-06
1 ,2009-01-01, 2011-01-01
1, 2011-01-01, 2013-02-02
1, 2013-01-01, 2013-08-08
1, 2014-01-01, 2014-04-04
I want to produce this result:
custid, range start, range end
1, 2008-01-01, 2013-08-08
1, 2014-01-01, 2014-04-04
the first row is the range identified from the 4 rows in my subscription table.
thanks :)I think I found it...
http://stackoverflow.com/questions/5213484/eliminate-and-reduce-overlapping-date-ranges
let me try this method
Hi,
m writing to follow up with you on this post. Thanks for you posting a reply to share your workground. Was the problem resolved after performing the above link? If you are satisfied with the above solution, I’d like to mark this issue as "Answered".
Please also feel free to unmark the issue, with any new findings or concerns you may have.
Thanks,
Sofiya Li
If you have any feedback on our support, please click here.
Sofiya Li
TechNet Community Support -
Query to find the list of users having access to a particular scenario
Hi,
I am learning Hyperion Planning 9.2 x version. I wanted to know the query to find the list of users having access to Plan Iteration - 1 scenarion.
As I am new to Hyperion Essbase and Hyperion Planning, I am assuming these ideas work out to get the desired result.
1) As Hyperion Planning uses Relational DB to store the User Security information, we can query the list of users who is having access to Plan Iteration - 1 Scenario.
I am not sure if this solution works. Please correct me If I am wrong.
2) We can also query from the essbase editor to find out who all having access to this scenario.
If the above is correct, can you please provide me the query.
I am really need of this and I will be happy if any one provide the solution.
Thanks & Regards,
Upendra. BesthaHi,
If you are looking for some SQL to retrieve the access rights by member then you can use something like (SQL Server code though can easily be modified for Oracle)
SELECT usr.object_name as Username,mem.object_name as Member,
'Access Rights' = CASE acc.access_mode
WHEN -1 THEN 'None'
WHEN 1 THEN 'Read'
WHEN 2 THEN 'Write'
WHEN 3 THEN 'Write'
ELSE 'Unknown' END,
'Relation' = CASE acc.flags
WHEN 0 THEN 'Member'
WHEN 5 THEN 'Children'
WHEN 6 THEN 'Children (inclusive)'
WHEN 8 THEN 'Descendants'
WHEN 9 THEN 'Descendants (inclusive)'
ELSE 'Unknown' END
FROM
hsp_access_control acc, hsp_object mem, hsp_object usr
WHERE acc.object_id = mem.object_id
AND acc.user_id = usr.object_id
AND mem.object_name = 'Plan Iteration - 1'
Cheers
John
http://john-goodwin.blogspot.com/ -
Query to find out which workflow(s) use a particular message ? wf_messages
Hi guys
Hoping someone can help.
I've a list of particular notfication messages, which are stored in the WF_MESSAGES_TL and WF_MESSAGES table, and I need to find out which workflows use them.
Can anyone tell me what table I can query to find this out ?
There's no referential integrity which I can use to find this out, and google has turned up nothing so far.
Any ideas ?
Thanks a lot
ScottYou can use this and tweak it around:
select p.process_item_type, p.process_name, p.activity_name, a.message
from wf_process_activities p, wf_activities a
where p.process_item_type=a.item_type and
p.activity_name=a.name and
a.end_date is null;-- means the active/current activity
Regards,
Alejandro -
Query to find out the list of user who have delete access
Hi,
I need a query to find out the list of users who have delete access on perticular folder/universe/ reports in infoview.
Please advice.
Regards,
Neo.orton607 wrote:
thanks for replying guys. But the thing is i am using dynamic sql execute immediate in my package, so i want those tables also and the schema name.
thanks,
ortonThis is not possible. The best you could do is to have a good guess.
Or how would you parse some dynamic statement as this:
v_suffix := 'loyees';
v_sql := 'Select count(*) from (select ''nonsense'' col1 from emp'||v_suffix||') where col1 = ''Y'''';
execute_immediate(v_sql);
...What is the table name? How do you want to parse that?
Better rewrite all dynamic SQL statements into non dynamic ones. Or do the source control logic for those dynamic parts in an extra module. For example implement your own dependency table and force every developer to add there all dynamic parts. -
SQL Query to find Receipt No.s which are not matched to AP Invoices
Hi
Please help me to frame a query to find list of Receipt No.s which are not matched with AP Invoices.
Please refer to the below query .
SELECT
poh.segment1 "PO No.",
aps.vendor_name "Supplier Name",
pol.item_description "Item Description",
rcvh.receipt_num "GRV No.s",
rcvl.quantity_received "Quantity",
pol.unit_price "Rate/Unit",
rcvtl.tax_name||' - '||initcap(rcvtl.tax_type) "Tax",
(rcvl.quantity_received * pol.unit_price) + nvl(rcvtl.tax_amount,0) "Amount"
FROM
po_headers_all poh,
po_lines_all pol,
po_distributions_all pod,
ap_suppliers aps,
rcv_shipment_headers rcvh,
rcv_shipment_lines rcvl,
rcv_transactions rcvt,
jai_rcv_line_taxes rcvtl
WHERE
poh.po_header_id = pol.po_header_id
AND poh.po_header_id = pod.po_header_id
AND pol.po_line_id = pod.po_line_id
AND aps.vendor_id = poh.vendor_id
AND aps.vendor_id = rcvh.vendor_id
AND rcvh.shipment_header_id = rcvl.shipment_header_id
AND poh.po_header_id = rcvl.po_header_id
AND pol.po_line_id = rcvl.po_line_id
AND rcvh.shipment_header_id = rcvt.shipment_header_id
AND rcvl.shipment_line_id = rcvt.shipment_line_id
AND poh.po_header_id = rcvt.po_header_id
AND pol.po_line_id = rcvt.po_line_id
AND aps.vendor_id = rcvt.vendor_id
AND rcvh.shipment_header_id = rcvtl.shipment_header_id
AND rcvl.shipment_line_id = rcvtl.shipment_line_id
AND rcvt.transaction_id = rcvtl.transaction_id
AND aps.vendor_id = rcvtl.vendor_id
AND rcvt.transaction_type = 'RECEIVE'
AND poh.authorization_status = 'APPROVED'
AND poh.segment1 = '210001079'
I have'nt included the Invoice Tables in the above query.
Please help me in that area.
This is bit urgent.
Please help me.
Regards
Nakul VenkatramanI am using ORACLE 11gR2 If you're licensed for Diangnostics pack then you might want to look at the AWR tables, e.g. DBA_HIST_SQLSTAT and cross-reference with DBA_HIST_SNAPSHOT.
By this will i get the top 5 consumed queries of DEV user in the whole session or its just the top 5 queries at that particular time. The "executions" columns in this query, does it mean that the no. of. times the query has executed... This will get you a random 5 queries that were first parsed by DEV. Depending on your application code/structure, it may well be that all code (except for system-recursive sql) executed by DEV is parsed by DEV, and all code parsed by DEV is executed by DEV but this isn't true for all.
In terms of top N queries, you need to ORDER BY and then restrict by ROWNUM at an outer level to the ROWNUM otherwise the ROWNUM filter is applied before the ORDER BY.
i.e.
SELECT *
FROM
(SELECT ...
FROM ...
WHERE
ORDER BY...)
WHERE ROWNUM <= ....
The "executions" columns in this query, does it mean that the no. of. times the query has executedYes.
http://download.oracle.com/docs/cd/E11882_01/server.112/e25513/dynviews_3064.htm#REFRN30259
Edited by: Dom Brooks on Oct 24, 2011 9:45 AM -
Query to find the no of columns in a table
Is there a query to find the total number of columns in a table?
Dou you know read?
-- the number of rows in a table named yourtable:
select count(1) from yourtable;
-- the number of columns in a table
-- If is a user's table:
select count(1)
from user_tab_columns
where table_name='YOURTABLE'
--If it is´t
select count(1)
from DBA_tab_columns
where owner = 'USEROWNER'
and table_name='YOURTABLE' -
Query to find the memory of database in oracle,sql
Hi All,
Please let me know the query to find the memory of database in oracle,sql.
Thanks,
sajithHow do I find the overall database size?
The biggest portion of a database's size comes from the datafiles. To find out how many megabytes are allocated to ALL datafiles:
select sum(bytes)/1024/1024 "Meg" from dba_data_files;
To get the size of all TEMP files:
select nvl(sum(bytes),0)/1024/1024 "Meg" from dba_temp_files;
To get the size of the on-line redo-logs:
select sum(bytes)/1024/1024 "Meg" from sys.v_$log;
Putting it all together into a single query:
select a.data_size+b.temp_size+c.redo_size "total_size"
from ( select sum(bytes) data_size
from dba_data_files ) a,
( select nvl(sum(bytes),0) temp_size
from dba_temp_files ) b,
( select sum(bytes) redo_size
from sys.v_$log ) c;
Another query ("Free space" reports data files free space):
col "Database Size" format a20
col "Free space" format a20
select round(sum(used.bytes) / 1024 / 1024 ) || ' MB' "Database Size"
, round(free.p / 1024 / 1024) || ' MB' "Free space"
from (select bytes from v$datafile
union all
select bytes from v$tempfile
union all
select bytes from v$log) used
, (select sum(bytes) as p from dba_free_space) free
group by free.p
This is what I use :P From http://www.orafaq.com/wiki/Oracle_database_FAQ#How_do_I_find_the_overall_database_size.3F -
Query to find Employee Salary Details
Hi,
Could anyone help in writing the query to find employee salary details.
Thanks in advance.This should get you started:
SELECT papf.full_name
,papf.email_address
,ppp.proposed_salary_n salary
FROM per_pay_proposals ppp
,per_all_assignments_f paaf
,per_all_people_f papf
WHERE ppp.assignment_id = paaf.assignment_id
AND paaf.assignment_type = 'E'
AND paaf.primary_flag = 'Y'
AND paaf.person_id = papf.person_id
AND nvl(papf.current_employee_flag, 'N') = 'Y'
AND trunc(sysdate) BETWEEN
ppp.change_date AND ppp.date_to
AND trunc(sysdate) BETWEEN
paaf.effective_start_date AND paaf.effective_end_date
AND trunc(sysdate) BETWEEN
papf.effective_start_date AND papf.effective_end_date; -
Query to find out controls displayed as in UI for an applet,along with view
Hi,
I am looking for a query to find out list of all the controls as displayed in UI applet along with applet's view.
Please note that in the query only mapped controls (those displayed in UI ) should come up.
Regards,
KunalHi,
If the EUL is an apps mode (EBS) EUL then the eu_username column is the apps user id or apps resp id. If you want to show only the responsibilities and convert those ids to names then you need to use the EUL5_GET_APPS_USERRESP function like this:
select ba_name, ba_developer_key, EUL5_GET_APPS_USERRESP(eu.eu_username, 'R') responsibility_name
from eul5_bas ba
, eul5_access_privs ap
, eul5_eul_users eu
where ba.ba_id = ap.gba_ba_id
and ap.ap_type = 'GBA'
and ap.ap_eu_id = eu.eu_id
and eu.eu_role_flag=1
order by 1,2,3Rod West -
Query to find out which process consuming more cpu?
Hi All,
some one please tell me the query to find out which process is consuming more
cpu resources?
Thanks and Regards
SrikanthUse V$SESSTAT to determine which sessions are using most CPU, and investigate what SQL these users/sessions are executing:
SQL> select ss.sid, se.command, ss.value CPU, se.username, se.program
from v$sesstat ss, v$session se
where ss.statistic# in
(select statistic#
from v$statname
where name = 'CPU used by this session')
and se.sid=ss.sid
order by ss.value desc; -
Query to find out whether a table is sub-partitoned , composite type one
Could you please let me know the query to find out whether a paritioned table
is
1). composite paritioned one.
2). sub-paritioned one.
I find that there are 2 cols in all_tab_partitions view, which lets me know
1). COMPOSITE VARCHAR2(3)
To find composite paritioned one or not.
2). SUBPARTITION_COUNT NUMBER
To find whether a table is sub-paritioned one or not.
Any light on the above topic is highly appreciated.So it seems you've found the answer yourself?
with »user_tab_partitions« and »user_tab_subpartitons« you'll get all the neccessary information you are looking for.
Maybe you are looking for
-
Connecting a SPA2102 with a D-Link DIR-655
Hi, I'm currently having trouble with getting the internet and voip to work simultaneously. Internet and voip adaptor (SPA2102) work without a router connected, but when I add the router (DIR-655), internet no longer works. The voip telephone still w
-
Spinning wheel of death while surfing internet
I have owned my Macbook Pro for several years and have had no issues. Recently, however, I get the spinning wheel of death when I'm surfing the internet. I am able to get to a site fast enough (at least as fast as my "high speed" DSL allows) but on
-
X-Fi Xtrememusic w/ Heatsink Lower RMAA Resul
Hi, I just purchased the X-Fi Xtrememusic and am loving the quality of the Analog out with my headphones. I'm curious though, because accorfing to this http://audio.rightmark.org/downloads/Sound%20Blaster%20X-Fi%20Testing%20Methodology%20And%20Result
-
IBolt dock w/ music and navigation enabled - Line out speaker glitch
This has happened 4 times since the JB update when in the car dock mode while cradled in the iBolt. connection: - cradled in iBolt dock - connect line out to vehicle input jack - enables car dock mode steps: - play a music app - start navigation app
-
Possible to have different names on one account?
Is it possible to have my account name different from the name on the registered credit card? My mother is allowing me to use her credit card for my Apple ID but on things like the iCloud it shows her name, since that's the name on the credit card. S