Can anyone explain the following PLSQL code?
-
create or replace FUNCTION CLAIM_DASHBOARD_1_FUNC(dt date) RETURN talicpack.claim_dashboard_1_table PIPELINED AS mytype talicpack.claim_dashboard_1_type; i number := 12; BEGIN mytype.year1 := to_char(dt,'yyyy'); select to_char(to_date(to_char(i),'mm'),'mon'), (select count(*) from lf$app_claim,lf$app_seec_claim where lf$app_claim.canonicalid = lf$app_seec_claim.parentcanonicalid and to_char(registrationdate,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… as a1, (select count(*) from lf$app_claim,lf$app_seec_claim where lf$app_claim.canonicalid = lf$app_seec_claim.parentcanonicalid and to_char(registrationdate,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… as a2, (select count(*) from lf$app_claim,lf$app_seec_claim where lf$app_claim.canonicalid = lf$app_seec_claim.parentcanonicalid and to_char(registrationdate,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… as a3, (select count(*) from lf$app_claim,lf$app_seec_claim where lf$app_claim.canonicalid = lf$app_seec_claim.parentcanonicalid and to_char(registrationdate,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… as a4, (select count(*) from lf$app_claim where to_char(CLAIMFINALIZEDDATE,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… as a5, (select count(*) from lf$app_claim where to_char(CLAIMFINALIZEDDATE,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… as a6, (select count(*) from lf$app_claim where to_char(CLAIMFINALIZEDDATE,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… as a8, (select count(*) from lf$app_claim where months_between(to_date(to_char(to_char(t… and (claimfinaldecision = 'Pending' or claimfinaldecision is null) as a9, (select count(*) from lf$app_claim where months_between(to_date(to_char(to_char(t… and (claimfinaldecision = 'Pending' or claimfinaldecision is null) as a10, into mytype.month,mytype.c1,mytype.c2,mytype.… from dual; pipe row(mytype); i := 1; while (i < 12) loop select to_char(to_date(i,'mm'),'mon'), (select count(*) from lf$app_claim,lf$app_seec_claim where lf$app_claim.canonicalid = lf$app_seec_claim.parentcanonicalid and to_char(registrationdate,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… (select count(*) from lf$app_claim,lf$app_seec_claim where lf$app_claim.canonicalid = lf$app_seec_claim.parentcanonicalid and to_char(registrationdate,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… (select count(*) from lf$app_claim,lf$app_seec_claim where lf$app_claim.canonicalid = lf$app_seec_claim.parentcanonicalid and to_char(registrationdate,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… (select count(*) from lf$app_claim,lf$app_seec_claim where lf$app_claim.canonicalid = lf$app_seec_claim.parentcanonicalid and to_char(registrationdate,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… (select count(*) from lf$app_claim where to_char(claimfinalizeddate,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… (select count(*) from lf$app_claim where to_char(claimfinalizeddate,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… (select count(*) from lf$app_claim where to_char(claimfinalizeddate,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… (select count(*) from lf$app_claim where to_char(claimfinalizeddate,'monyyyy') = to_char(to_char(to_date(i,'mm'),'mon')||… (select count
-
Answer:
I have no idea. Why don't you ask the author. Also your post is incomplete: it only shows the topmost lines of the code and most lines are truncated. The first statement is a select from dual that includes a batch of subselects that look like they repeat, but I assume do not (your text is truncated). That seems to return a bunch of counts of claims in various conditions that relate to the month/year passed as parameter. Then there is a loop that looks like it repeats that same query for each month in a year, but there is no way to know which one (maybe the one passed as argument ?). Again your code is incomplete. The function is a pipelined function, hence the use of the PIPE ROW function. This enables the function to return a table of results. To use the result, you would do something like that: select ... from table (CLAIM_DASHBOARD_1_FUNC(current_date));
arjun raju at Yahoo! Answers Visit the source
Related Q & A:
- Can anyone give me the code for toshiba tv with the URC22B?Best solution by Yahoo! Answers
- Can anyone explain this dream to me?Best solution by Yahoo! Answers
- Can anyone help me get the code for my stereo?Best solution by Yahoo! Answers
- Can anyone put the following paragraphs into different words still making sense?Best solution by Yahoo! Answers
- Does anyone have a Coke Zone Code that I can have?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.