Can it be achieved
Hi Gurus.
CREATE TABLE LOAN_TXN
TXN_DATE DATE,
BALANCE NUMBER(10,2),
CODE VARCHAR2(1),
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '02/15/2010 11:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), 250000, 'D');
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '03/31/2010 11:59:59 AM', 'MM/DD/YYYY HH:MI:SS AM'), 250000, 'B');
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '05/14/2010 11:25:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), 500000, 'D');
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '06/30/2010 12:15:00 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '08/02/2010 10:45:26 AM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '09/08/2010 02:10:17 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '10/27/2010 04:25:20 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '11/09/2010 10:15:55 AM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '12/29/2010 03:10:20 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '01/12/2011 01:11:15 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '02/11/2011 12:11:48 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '03/03/2011 12:25:36 PM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '03/31/2011 11:00:00 AM', 'MM/DD/YYYY HH:MI:SS AM'), 4000, 'R');
INSERT INTO LOAN_TXN ( TXN_DATE, BALANCE, CODE) VALUES (TO_Date( '03/31/2011 11:59:59 AM', 'MM/DD/YYYY HH:MI:SS AM'), 460000, 'B');Using the above details, I have been asked to work out a single SQL Query which could generate the Details in the following format.
TXN_DATE ADVANCE RECOV BALANCE DAYS AMT CUMM_AMT
15/02/2010 250000 250000 45 3082
31/03/2010 250000 3082
01/04/2010 250000 43 2945 3082
14/05/2010 250000 500000 47 6438 6027
30/06/2010 4000 496000 33 4484 12465
02/08/2010 4000 492000 37 4987 16949
08/09/2010 4000 488000 49 6551 28487
27/10/2010 4000 484000 13 1724 30211
09/11/2010 4000 480000 50 6575 36786
29/12/2010 4000 476000 14 1826 38612
12/01/2011 4000 472000 30 3879 42491
11/02/2011 4000 468000 20 2564 45055
03/03/2011 4000 464000 28 3559 48614
31/03/2011 4000 460000 1 126 48740
31/03/2011 460000 45658
01/04/2011 460000 94 11847 Legend : Code 'R' is for Recovery
Code 'D' is for Disbursement
Code 'B' is for Balance
AMT is to be calculated as follows :
Difference of Current with the Next Leading Date multiplied with Balance on the date * Interest Rate (which is 10% here) / Days in the Year.
On the last day of the Financial Year i.e. 31/03/YYYY, Closing Balance is to computed summing
the date-wise Amt during the Financial Year i.e. 1st April to 31st Mar.
Can the above be achieved ?
Hi,
Thanks for posting the sample data in such a useful format; that's very helpful!
It would also be helpful if you explained how you get the output all the columns, not just amt.
Like Justin, I don't understand how you get days.
I also don't understand the extra rows you want to add for April 1 after each financial year:
user3308033 wrote:
TXN_DATE ADVANCE RECOV BALANCE DAYS AMT CUMM_AMT
01/04/2010 250000 43 2945 3082
01/04/2011 460000 94 11847
Why do you want cumm_amt for 2010, but not for 2011? Also, as Dan said, how do you get days=94 on the last row?
If there happend to be a transaction on April 1, what would the output look like? Would there be an extra row plus the row(s) that had the April 1 txn_date? Include an example in your sample data and desired results.
This is a step in the right direction:
WITH got_fiscal_year AS
SELECT txn_date, balance, code
, TRUNC ( ADD_MONTHS (txn_date, +9)
, 'YEAR'
) AS fiscal_year
FROM loan_txn
, got_balance AS
SELECT txn_date, fiscal_year
, CASE
WHEN code = 'D'
THEN balance
END AS advance
, CASE
WHEN code = 'R'
THEN balance
END AS recov
, SUM ( CASE code
WHEN 'D' THEN balance
WHEN 'R' THEN -balance
END
) OVER ( PARTITION BY fiscal_year
ORDER BY txn_date
) AS balance
, CEIL ( LEAD (txn_date) OVER ( PARTITION BY fiscal_year
ORDER BY txn_date
- txn_date
) AS days
, ADD_MONTHS (fiscal_year, 12) - fiscal_year AS days_in_year
FROM got_fiscal_year
, got_amt AS
SELECT got_balance.*
, ( .10 -- 10% interest rate
* balance
* days
/ days_in_year
) AS amt
FROM got_balance
SELECT txn_date
, advance
, recov
, balance
, days
, amt
, SUM (amt) OVER ( PARTITION BY fiscal_year
ORDER BY txn_date
) AS cumm_amt
FROM got_amt
ORDER BY txn_date
;Output:
` CUMM
_AMT
TXN_DATE ADVANCE RECOV BALANCE DAYS AMT
15-Feb-2010 250000 250000 45 3082 3082
31-Mar-2010 250000 3082
14-May-2010 500000 500000 48 6575 6575
30-Jun-2010 4000 496000 33 4484 11060
02-Aug-2010 4000 492000 38 5122 16182
08-Sep-2010 4000 488000 50 6685 22867
27-Oct-2010 4000 484000 13 1724 24591
09-Nov-2010 4000 480000 51 6707 31298
29-Dec-2010 4000 476000 14 1826 33123
12-Jan-2011 4000 472000 30 3879 37003
11-Feb-2011 4000 468000 21 2693 39695
03-Mar-2011 4000 464000 28 3559 43255
31-Mar-2011 4000 460000 1 126 43381
31-Mar-2011 460000 43381As you can see, I'm not getting days exactly like you want, so the amts are off accordingly. Also, the best way to add the extra rows for April 1 depend on exactly what those rows are supposed to show. Since I don't understand that, I didn't include the April 1 rows at all.
We might not need this many sub-queries. I'll wait until I understand the problem before trying to simplify it.
Similar Messages
-
Need to pass out parameter in middle of a process. How can this be achieved
Package test_pkg
procedure main_prc(x_stat out varchar2)
insert_prc(l_stat);
x_stat:=l_stat;
valid_prc
end main_prc;
procedure insert_prc(x_stat1 out varchar2)
insert into staging table
x_stat:='S';
end insert_prc;
procedure valid_prc
validate staging table data
end valid_prc;
end test_pkg;
Requirement: Need to pass out parameter in middle of a process. How can this be achieved?Use return at any time to get the out variable, but this will stop the process.
-
I am using geckofx in c#. I need to intercept response of a local file load request so that I can modify some data/response before it reaches Javascript.
In short, I need something like
1. JS requests browser to read a file.
2. Browser reads content of a file.
3. MAKE SOME MODIFICATIONS TO DATA (Additional Step)
4. Then pass this modified data to JS to perform required tasks.
Is this possible? If yes, how can this be achieved.You may need to rebuild permissions on your user account. To do this,boot to your Recovery partition (holding down the Command and R keys while booting) and open Terminal from the Utilities menu. In Terminal, type: ‘resetpassword’ (without the ’s), hit return, and select the admin user. You are not going to reset your password. Click on the icon for your Macs hard drive at the top. From the drop down below it select the user account which is having issues. At the bottom of the window, you'll see an area labeled Restore Home Directory Permissions and ACLs. Click the reset button there. The process takes a few minutes. When complete, restart.
Repair User Permissions -
I have a Mac OS X Lion machine (macbook) which is used in a network where most machines are running Linux. Hostname resolution for local machines is achieved on the Linux boxes using a LDAP host. How can a similar behavior can be obtained on Lion (I found no /etc/nsswitch.conf).
I started the Directory Utility, chose the LDAPv3 line, add a line with the IP address of the LDAP server and a "base" but this does not seem to work.
The opendirectory log file is not very informative. It just says (XX.XX.XX.XX is the LDAP server IP address):
2011-10-27 16:42:33.040 CEST - Registered subnode with name '/LDAPv3/XX.XX.XX.XX'
Thanks for any help.
ThomasMy advice is to advise everyone of a scheduled down time when it's convinient for you and implement plan B.
Plan A will simply cause you more grief in the long run. -
HR Authorization Issue (How can it be achieved)
Hi Gurus,
Our SAP HR PA data authorization is by Org Key using P_ORIGIN security object. As a result, HR Users who have the access for the Org Key can view records of employees belonging to that particular Org Key.
The problem comes when an employee is transferred from old Org Key to new Org Key. As a result, HR user can still view those records in PA infotypes for the prior periods when IT0001 org key was the old one.
Requirements: Our HR Head wants to completely block these kind of employees whose org key has been changed to the new one. Since HR Users dont have the authorization for the new Org Key; they should not be able to view PA IT0001 records for period which still have the value for old org key.
Any way to implement this kind of check ? Or any way to control security access by Pernr (so that we could block some pernrs from being viewed by HR user).
Please provide your insight..
Note: We have not activated P_ORGXX in our system.Hello Amit,
Try to use organizational key (VDSK1) to restrict access to HR personnel information. When we change the value in the VDSK1 field from users not able to view PA data only for those employees for which they have responsibility. Use P_ORGIN and organization key (VDSK1) to do this.
Cheers and Regards.
Jaime -
I have to send UDP multicast and Unicast messages to a remote port from a single source/local port. I tried by opening UDP unicast and multicast in the same port and got the expected error. I tried by opening a unicast connection and sending unicast messages.After that when multicast messages has to send I closed unicast and opened multicast in the same port.This is not throwing any error. But my requirenment is to comminicate with another application in C ++ which recieves this data, throwing an error of lost connectivity and both the applications are not abled to communicate properly.
In the other application with C++ this is implemented using port sharing. So how port sharing can be implemented in labview so that I can send both multicast and unicast messages from the same port?
Thanks in advanceUDP is a sessionless protocol, meaning that anyone listening on the specified port CAN receive the data. CAN because as you noted there is no guarantee in the protocol that it will be received. And if you send the data not to a specific address but a multicast address not only one computer can receive it but in fact every computer on the same subnet listening to that multicast address and depending on the TTL of the packet also computers in neighbouring subnets, although that last one is not a very reliable operation since routers can be configured to drop multicast packages anyhow despite of a different TTL saying otherwise.
Accordingly there is no real way to make sure that a receiving UDP port is not already in use, since you don't build up a connection. UDP is more or less analogous to shouting your messages through a megaphone, and anyone listening on the right frequency (port) can hear it. You do bind the sender socket to a specific port number but that makes little difference.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
How can Pagination be achieved in portlets ???
HI,
I wanna implement pagination in portlets.
Ex: I display 20 pages .. 1, 2 , 3, 4, 5, 6, 7, 8..
So i will have following clickable texts...
prev>> 1 2 3 4 5 6 7 8 9 10 next<<
when i select 3 , it should route me to page no 3.
when i click on next it should display me the following
prev>> 11 12 13 14 15 16 17 18 19 20
Any ideas ?Hi,
Here You go......
http://forum.java.sun.com/thread.jspa?threadID=5194183
My friend i'm afraid to say this but the one Suggested by you will not work on Portlet Environment under a Portlet Container.
It wud be gr8 if you can revisit Basic Concepts of Portal,Portlet Container,Portlets & a Servlet,Servlet Container.
REGARDS,
RaHuL -
How can this be achieved in SQL???????
Hi Guys,
This is my query:
SELECT distinct iy.trial_no,
iypa.amendment_no,
iy.country_code,
iy.country_desc,
iypa.amend_reg_submission_date,
iypa.amend_reg_approval_date,
iypa.amend_reg_comments,
iyea.ea_amendment_submission_date,
IYEA.ea_amendment_approval_date,
iyea.ea_amendment_expiry_date,
iyea.ea_approval_comments,
iyea.master_approval_flag
FROM irt_trc_protocol_amendment iypa,
irt_trc_ethical_approvl_amend iyea,
irt_trial_country iy
WHERE iypa.trial_no = iyea.trial_no
AND iypa.amendment_no = iyea.amendment_no
AND iypa.country_code = iyea.country_code
AND iypa.trial_no=101416
AND iy.trial_no= iypa.trial_no
AND iypa.country_code = 'GBR'
AND iypa.country_code = iy.country_code
AND iyea.amendment_no = 4
AND IYEA.master_approval_flag = 1 The above query will only ever return one row because only one record can have it's master_approval_flag set to 1. However multiple records can have a master_approval_flag set to 0.
This is what I want my query to acheive:
Select the one row where master_approval_flag = 1. If there is no record where master_approval_flag = 1, then still only display one row but ommit the details from the IYEA table and only include
the data from the IYPA table - Such that the output will only ever return one row....
How can I do this?
Thanks!This should work:
select t.*
SELECT distinct
iy.trial_no,
iypa.amendment_no,
iy.country_code,
iy.country_desc,
iypa.amend_reg_submission_date,
iypa.amend_reg_approval_date,
iypa.amend_reg_comments,
iyea.ea_amendment_submission_date,
IYEA.ea_amendment_approval_date,
iyea.ea_amendment_expiry_date,
iyea.ea_approval_comments,
iyea.master_approval_flag
,row_number() over (order by iyea.Master_Approval_Flag desc) rn
FROM irt_trc_protocol_amendment iypa,
irt_trc_ethical_approvl_amend iyea,
irt_trial_country iy
WHERE iypa.trial_no = iyea.trial_no
AND iypa.amendment_no = iyea.amendment_no
AND iypa.country_code = iyea.country_code
AND iypa.trial_no = 101416
AND iy.trial_no = iypa.trial_no
AND iypa.country_code = 'GBR'
AND iypa.country_code = iy.country_code
AND iyea.amendment_no = 4
) t
where rn = 1You could possibly remove the DISTINCT and specify
,row_number() over (order by iyea.Master_Approval_Flag desc, iy.Tria_No, iy.Amendment_No) rn
-- instead of
,row_number() over (order by iyea.Master_Approval_Flag desc) rnSince you are guranteed to always return a single row there may be no reason to use DISTINCT, which would probably slow the query down somewhat. -
Robohelp 10 - Inserting a Last modified date in a topic - how can it be achieved?
Hi there,
this is my first post, so apologies if I am in the wrong place...
I would like to insert a "last modified" date in my topics, but can't figure out how to do this! The Date field inserts today's date whenever the topic is opened, and so doesn't reflect the timeframes of changes accurately.
I'd appreciate any help on this.
Thank you
CarolineHi there
When you insert the field, look at the options.
See that option for auto updating? Try clearing it and the field shouldn't auto-populate.
But note that now the onus is on the help author to ensure they perform the update if they want the date to finally match the current date.
Cheers... Rick -
What is this effect called/how can it be achieved?
http://www.youtube.com/watch?v=AqS5SeJOrwU
at 6:31 in this video it does it.It also does it a lot up until the 8 minute mark. I know that the video was put together with after effects. I need to know how i can do it in cs5 or at least what it is called so i can look up tutorials. ThanksEffects --> Time --> Echo and a million similar "accumulation" effects from third-party vendors, fancied up of course with some crazy coloring effects.
Mylenium -
Can this be achieved in Flash rather than Flex
Hi
I found something that's similar to some functionality I need:
http://blog.flexexamples.com/2007/09/19/dragging-rows-between-two-different-flex-datagrid- controls/
I was wondering if this is possible in As3 using Flash CS5?
Thanks
Shaunwell, you'd make one movieclip that contains dynamic textfields so you can add the dragged rows data to the textfields' text properties.
and i don't know of any tutorials for this. using google is the best way i've found to find tutorials. but this is such a narrow task i doubt you'll be successful finding a tutorial.
on the other hand, this is pretty easy if you break it up into a few steps:
1. create a movieclip (with a linkage id (as2) or class (as3) that contains as many dynamic textfields as columns in your dragged datagrid. and now that i'm typing this, i can see that this step could be supplanted by dynamically creating a movieclip and adding textfields to it. that way if you had several datagrids with varying number of columns you wouldn't be restricted or stuck making several movieclips,
2. retrieve the data from the clicked row of the datagrid.
3. apply the data to the text property of your textfields.
4. drag this movieclip until a mouseup is detected.
5. on mouseup drop the movieclip. if it's over a drop-enabled datagrid, add the data to this datagrid and possibly remove the data from the drag-enabled datagrid and remove the movieclip. -
HT1222 How will I restore my iPhone when the update software update can not be achieved?
While updating my iphone 4s, I had a message on Itunes saying can not update. However, I could not restore my phone to a previous software too. now I have only the cable sign and itunes icon on my iphone. I have connected to itunes and tried to restore but it says can not update... I re install the itunes with no success... there is only iTunes sign and the cable... I need help !
THANK YOUdukester14 wrote:
After operating system upgrade, my iPhone demands a passcode be entered. I have never used a passcode. How can I restore my iPhone to how it was before?
It's asking you to create a passcode. You can turn it off later if you wish. -
Gurus of Labview,
I have a Project to complete and i am new to labview, I have student version 2009. and want to build an initial vi of a Municipal water trteatment plant TO FILL AND EMPTY TANKS. I am using the DSC module to help and I can get my tanks to complete a sequence, however it uses local variables. They cannot be shared on the network when I create my libraries. Need help urgently..
Casey74
Solved!
Go to Solution.Casey74 wrote:
Here is the block diagram for your enjoyment.......
Sorry, I cannot "enjoy" an image. It would help much more to see the actual VI.
LabVIEW Champion . Do more with less code and in less time . -
F110 Program RFFOGB_T - Can we achieve both Printed and Email Outputs??
HI Experts,
SAP Provides standard Program RFFOGB_T for processing automatic bank direct debits and bank collections in domestic payment transactions for Great Britain and Ireland. This program is run as part of F110 Payment run. The standard program prints the Payment advice notes. We have used the Business Transaction Event 00002040 as per the documentation of the Program, to generate EMAILS instead of Printed Advice notes.
With the changes made, we have met our requirements. However, now the Client desires to have both Email and Printed Advice Notes, If any of you have worked on this BTE, could you please suggest whether this is possible.
My Understanding is, it could be either print or email as the input parameter to this BTE, finaa-nacha carries a value '1' which is for Printed output, the custom code in the BTE changes the value to 'I' for Email Output. How can we possibly achieve both.
I am a developer, so pardon me if the description of the problem sounded too technical.
Any suggestion would be highly appreciated.
Thanks and Regards,
SubhrangsuHi,
We found the same requirement but for F.27, which doesn't have any posting action. As pointed out by you, I think there can only be one output, either going to spool or mail and can't both. So in our case, we make two correspondence with each for spool and another one for mail. I think you might want to ask for SAP notes on your requirement.
Regards,
Teddy Kurniawan -
How can we remove the scroll bars from the table?
Hi,
I have a dynamic table. Currently the table appears with the scroll bars. But there is a requirement that the scroll bar should not appear and the table should stretch in the entire page. How can this be achieved.
Thanks in advance
NitaThanks Mohammad for the reply.
Was able to remove the scroll bars by using only the styleClass as AFStretchWidth. But there is a default partition in middle of the page still? Can i remove that too by any way.
Maybe you are looking for
-
How to make a webpage fill in the entire browser?
Hello everyone im tring to make my website fill in the entire page and havent had much luck. If you click here http://elitelandscapingct.com/Home.html you can see what I mean. Is the only way to make it fill in the page to make the page width wider??
-
How can I get a .cgi file that keeps downloading to work in the browser?
When I click on the .gif "Mod 3" on the URL below, Firefox (and Safari) just download a .cgi file to my desktop. I don't know if I CAN get this link to work, but I'd like to. http://osr.rice.edu/consent/mod2soc/mod2sec7.html#q2_5 Tried monkeying arou
-
Separate Distribution Monitor Export and Import Processes on Multiple Machines
Hi, Would you kindly let me know whether it is possible (means officially supported way) to run Distribution Monitor Export and Import processes on different machines? As per SAP note 0001595840 "Using DISTMON and MIGMON on source and target systems"
-
IPad Safari - Can't pinch to zoom on only one website
I've always logged into Facebook on my iPad in Safari, but as of last night, I cannot use the pinch to zoom function on www.Facebook.com. I can go to any other website, even the mobile version of facebook at m.facebook.com and the pinch works. I have
-
Change Password via telnet session
Hi, I would like to know how to change the tacacs enable password via telnet session. When a new user login the first time via telnet, tacacs prompts the user with changing login password. However, it never prompts to change the enable password. Plea