0% found this document useful (0 votes)
7 views9 pages

Nithin Task

Uploaded by

mnsrnithin999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views9 pages

Nithin Task

Uploaded by

mnsrnithin999
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Name:M.N.S.R.

Nithin
Emp ID:2491

Task – 1

Sample table and data

Number Number Number String


String String String Number Date
(25,8) (25,8) (25,8)
Trxn
Folio_no Scheme_Cod Trxn type Trxn No Transaction date Units Price Amount
Sign
e
1234567 EFG Purchase 501 10-Jan-22 8032.128 12.45 100000 +
5
1234567 EFG Purchase 502 13-Feb-23 7326.007 13.65 100000 +
3
1234567 TAX Purchase 503 16-Feb-19 3929.273 25.45 100000 +
1
1234567 TAX Purchase 504 20-Mar-19 1947.799 25.67 50000 +
6789012 FMP Purchase 505 25-Sep-23 388.6513 514.6 200000 +
8
6789012 FMP Purchase 506 26-Oct-23 189.2326 528.45 100000 +
6
6789012 EFG Purchase 507 10-Nov-23 2424.569 18.56 45000 +
6789012 FMP Redemption 508 14-Jul-24 189.2326 575.35 108875 -
6
1234567 EFG Redemption 509 14-Jul-24 8032.128 30.45 244578. -
5 3
1234567 TAX Redemption 510 14-Jul-24 3929.273 40.56 159371. -
1 3
6789012 TAX Purchase 511 04-Aug-20 4889.178 30.68 150000 +
6
6789012 TAX Redemption 512 05-Aug-23 4889.178 39.48 193024. -
6 8

Write SQL to create the table structure as listed above and write Insert statements
to insert values as per the above table. (No score for this task)

1. Write an Oracle function to find out the total units available (Closing
balance) for a folio, scheme combination for any given date. Function name
and arguments are given below:

Closing balance = A – B

A = sum of all inflow transactions (trxn_sign = ‘+’) in the given scheme till the given date

B = sum of all outflow transactions (trxn_sign = ‘-’) in the given scheme till the given date
Select plf_get_closing_balance(arg_folio_no => '1234567', arg_scheme_code => ‘EFG’
arg_closing_balance_date => ’31-Jan-2022’) from dual;

Select plf_get_closing_balance(arg_folio_no => '1234567', arg_scheme_code => ‘EFG’


arg_closing_balance_date => ’31-Mar-2024’ ) from dual;
Select plf_get_closing_balance(arg_folio_no => '1234567', arg_scheme_code => ‘EFG’
arg_closing_balance_date => sysdate) from dual;

Select plf_get_closing_balance(arg_folio_no => '1234567', arg_scheme_code => ‘TAX’


arg_closing_balance_date => sysdate) from dual;

Select plf_get_closing_balance(arg_folio_no => ‘6789012’, arg_scheme_code => ‘FMP’


arg_closing_balance_date => ’31-Dec-2023’) from dual;
Select plf_get_closing_balance(arg_folio_no => ‘6789012’, arg_scheme_code => ‘FMP’
arg_closing_balance_date => sysdate ) from dual;

2. Write an Oracle function to find out the total valuation available for a
folio-scheme combination for any given date function name and
arguments are given below :

AUM = A * B

A = Closing balance in for the given folio-scheme for the given date

B = Nave of the scheme for the given date


Select plf_get_folio_scheme_aum (arg_folio_no => '1234567', arg_scheme_code => ‘EFG’
arg_closing_balance_date => ’31-Jan-2022’) from dual;

Select plf_get_folio_scheme_aum (arg_folio_no => '1234567',


arg_scheme_code => ‘EFG’ arg_closing_balance_date => ’31-Mar-2024’ )
from dual;
Select plf_get_folio_scheme_aum (arg_folio_no => '1234567',
arg_scheme_code => ‘EFG’ arg_closing_balance_date => sysdate) from
dual;

Select plf_get_folio_scheme_aum (arg_folio_no => '1234567', arg_scheme_code => ‘TAX’


arg_closing_balance_date => sysdate) from dual;
Select plf_get_folio_scheme_aum (arg_folio_no => ‘6789012’, arg_scheme_code => ‘FMP’
arg_closing_balance_date => ’31-Dec-2023’) from dual;

*******Output is 324177.0426744

Select plf_get_folio_scheme_aum (arg_folio_no => ‘6789012’, arg_scheme_code => ‘FMP’


arg_closing_balance_date => sysdate ) from dual;

Nav_master is given below:

Scheme_Cod Nav Date Nav Value


e
TAX 16-Feb-19 25.45
TAX 20-Mar-19 25.67
TAX 04-Aug-20 30.68
EFG 10-Jan-22 12.45
EFG 31-Jan-22 12.9
EFG 13-Feb-23 13.65
TAX 05-Aug-23 39.48
FMP 25-Sep-23 514.6
FMP 26-Oct-23 528.45
EFG 10-Nov-23 18.56
FMP 31-Dec-23 560.86
EFG 31-Mar-24 29.2
EFG 14-Jul-24 30.45
FMP 14-Jul-24 575.35
TAX 14-Jul-24 40.56
EFG 19-Jul-24 30.47
FMP 19-Jul-24 575.53
TAX 19-Jul-24 42.7
3. Write SQL to find out the closing balance as on 31-Mar-2023 for all folio-scheme
combination. Do not use function/procedure. Do it using SQL.

Expected output.

Closing
Folio_no Scheme_co balance
de

To get all combinations of folio_no and scheme_code that in the table

You might also like