Native SQL Performance Difference Between Hard-Coded Value and Parameter

Hi,
I have a native SQL (Oracle) query (fairly long & complex with a few sub-queries) that returns in under a second in both ODSI and using an external SQL tool. This query has a hard-coded value for a particular column, namely, a date column.
When I modify the ODSI function signature so that I pass in a parameter and then replace the hard-coded value in the native SQL with the appropriate parameter binding notation (i.e. '?'), the query takes much longer (2-30 seconds). The duration of the query depends on how many records are actually returned, so it must be running a separate query for each of the results (i.e. the more results returned, the longer the query takes to return).
What can I do to keep the duration of my ODSI query low while allowing for the parameter?

OSDI plan with date parameter:
<?xml version="1.0"?>
<source ns="fn-bea" name="jdbc.wcb.fineos" kind="relational" tip="jdbc.wcb.fineos">
<![CDATA[select codeid, description, FEE_CODE_DOC_TYPE, ismax, isovr
from
select distinct
sd.codeid, sd.description,
select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
sss.i_from = sd.i and
sss.c_from = sd.c and
sss.i_to = ss.i and
sss.c_to = ss.c and
sd1.codeid = sd.codeid and
ss.name = 'FEEGROUP-MAX (MAXIMUM AMOUNT)'
) ISMAX,
select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
sss.i_from = sd.i and
sss.c_from = sd.c and
sss.i_to = ss.i and
sss.c_to = ss.c and
sd1.codeid = sd.codeid and
ss.name = 'FEEGROUP-OVR (Overrideable)'
ISOVR,
select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
sss.i_from = sd.i and
sss.c_from = sd.c and
sss.i_to = ss.i and
sss.c_to = ss.c and
sd1.codeid = sd.codeid and
ss.name = 'FEEGROUP-INT (Internet Enterable)'
ISINT
,trow.answerstr FEE_CODE_DOC_TYPE
from wcbapp.tocorganisation o, wcbapp.tolpartydetails pd, wcbapp.tolserviceagrmtforprovider safp,
wcbapp.tolserviceagreement sa, wcbapp.tolserviceagreementversion sav, wcbapp.rsrvchrgrsrvagrvrserviceagreem scg_sav,
wcbapp.tolservicechargegroup scg, wcbapp.tolservicechargegroupversion scgv, wcbapp.tolserviceprovisionagreement spa,
wcbapp.tolservicedefinition sd
,wcbapp.trow trow, wcbapp.tlookupversion tlookupversion, wcbapp.tlookup tlookup
where
trow.i_lkpver_rows = tlookupversion.i
and trow.c_lkpver_rows = tlookupversion.c
and tlookupversion.i_lookup_versions = tlookup.i
and tlookupversion.c_lookup_versions = tlookup.c
and sd.codeid = trow.minstr_1
and sd.codeid = trow.maxstr_1
and tlookup.name = 'FeeCodeToDocumentLookup' and
spa.i_service_serviceratede = sd.i and
spa.c_service_serviceratede = sd.c and
spa.i_srchrgrv_serviceratede = scgv.i and
spa.c_srchrgrv_serviceratede = scgv.c and
scgv.i_srvchrgr_servicecharge = scg.i and
scgv.c_srvchrgr_servicecharge = scg.c and
scg.i = scg_sav.i_from and
scg.c = scg_sav.c_from and
scg_sav.i_to = sav.i and
scg_sav.c_to = sav.c and
sav.i_srvcagrm_serviceagreem = sa.i and
sav.c_srvcagrm_serviceagreem = sa.c and
sa.i = safp.i_srvcagrm_provider and
sa.c = safp.c_srvcagrm_provider and
safp.i_prtdtls_serviceagreem = pd.i and
safp.c_prtdtls_serviceagreem = pd.c and
pd.i_ocprty_party = o.i and
pd.c_ocprty_party = o.c and
? between safp.effectivedate and safp.enddate and
o.customerno = ? || ?
order by sd.codeid
where ISINT = 1]]>
<variable name="__fparam0" kind="EXTERNAL">
</variable>
<variable name="__fparam1" kind="EXTERNAL">
</variable>
<variable name="__fparam2" kind="EXTERNAL">
</variable>
</source>
OSDI plan with date constant:
<?xml version="1.0"?>
<source ns="fn-bea" name="jdbc.wcb.fineos" kind="relational" tip="jdbc.wcb.fineos">
<![CDATA[select codeid, description, FEE_CODE_DOC_TYPE, ismax, isovr
from
select distinct
sd.codeid, sd.description,
select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
sss.i_from = sd.i and
sss.c_from = sd.c and
sss.i_to = ss.i and
sss.c_to = ss.c and
sd1.codeid = sd.codeid and
ss.name = 'FEEGROUP-MAX (MAXIMUM AMOUNT)'
) ISMAX,
select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
sss.i_from = sd.i and
sss.c_from = sd.c and
sss.i_to = ss.i and
sss.c_to = ss.c and
sd1.codeid = sd.codeid and
ss.name = 'FEEGROUP-OVR (Overrideable)'
ISOVR,
select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
sss.i_from = sd.i and
sss.c_from = sd.c and
sss.i_to = ss.i and
sss.c_to = ss.c and
sd1.codeid = sd.codeid and
ss.name = 'FEEGROUP-INT (Internet Enterable)'
ISINT
,trow.answerstr FEE_CODE_DOC_TYPE
from wcbapp.tocorganisation o, wcbapp.tolpartydetails pd, wcbapp.tolserviceagrmtforprovider safp,
wcbapp.tolserviceagreement sa, wcbapp.tolserviceagreementversion sav, wcbapp.rsrvchrgrsrvagrvrserviceagreem scg_sav,
wcbapp.tolservicechargegroup scg, wcbapp.tolservicechargegroupversion scgv, wcbapp.tolserviceprovisionagreement spa,
wcbapp.tolservicedefinition sd
,wcbapp.trow trow, wcbapp.tlookupversion tlookupversion, wcbapp.tlookup tlookup
where
trow.i_lkpver_rows = tlookupversion.i
and trow.c_lkpver_rows = tlookupversion.c
and tlookupversion.i_lookup_versions = tlookup.i
and tlookupversion.c_lookup_versions = tlookup.c
and sd.codeid = trow.minstr_1
and sd.codeid = trow.maxstr_1
and tlookup.name = 'FeeCodeToDocumentLookup' and
spa.i_service_serviceratede = sd.i and
spa.c_service_serviceratede = sd.c and
spa.i_srchrgrv_serviceratede = scgv.i and
spa.c_srchrgrv_serviceratede = scgv.c and
scgv.i_srvchrgr_servicecharge = scg.i and
scgv.c_srvchrgr_servicecharge = scg.c and
scg.i = scg_sav.i_from and
scg.c = scg_sav.c_from and
scg_sav.i_to = sav.i and
scg_sav.c_to = sav.c and
sav.i_srvcagrm_serviceagreem = sa.i and
sav.c_srvcagrm_serviceagreem = sa.c and
sa.i = safp.i_srvcagrm_provider and
sa.c = safp.c_srvcagrm_provider and
safp.i_prtdtls_serviceagreem = pd.i and
safp.c_prtdtls_serviceagreem = pd.c and
pd.i_ocprty_party = o.i and
pd.c_ocprty_party = o.c and
'01-MAY-11' between safp.effectivedate and safp.enddate and
o.customerno = ? || ?
order by sd.codeid
where ISINT = 1]]>
<variable name="__fparam0" kind="EXTERNAL">
</variable>
<variable name="__fparam1" kind="EXTERNAL">
</variable>
</source>
ODSI Audit with date parameter:
[Thu May 12 13:02:23 GMT-06:00 2011] Starting...
Query compilation time: 0 ms
Query evaluation time: 16142 ms
Operation duration: 16189 ms
Audit Event:
common/application
user: weblogic
name: ClaimsDataspace
server: AdminServer
eventkind: evaluation
query/cache/queryplan
found: false
type: XQUERY_PLAN_CACHE
query/cache/queryplan
type: XQUERY_PLAN_CACHE
inserted: true
query/performance
compiletime: 0
common/session/query/invocation
time: Thu May 12 13:02:07 GMT-06:00 2011
blocksize: 65536
duration: 16001
common/session/query/invocation
time: Thu May 12 13:02:23 GMT-06:00 2011
blocksize: 65536
duration: 47
common/session/query/invocation
time: Thu May 12 13:02:23 GMT-06:00 2011
blocksize: 65536
duration: 46
common/session/query/invocation
time: Thu May 12 13:02:23 GMT-06:00 2011
blocksize: 35779
duration: 16
query/wrappers/relational
source: jdbc.wcb.fineos
sql:
select codeid, description, FEE_CODE_DOC_TYPE, ismax, isovr
from
select distinct
sd.codeid, sd.description,
select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
sss.i_from = sd.i and
sss.c_from = sd.c and
sss.i_to = ss.i and
sss.c_to = ss.c and
sd1.codeid = sd.codeid and
ss.name = 'FEEGROUP-MAX (MAXIMUM AMOUNT)'
) ISMAX,
select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
sss.i_from = sd.i and
sss.c_from = sd.c and
sss.i_to = ss.i and
sss.c_to = ss.c and
sd1.codeid = sd.codeid and
ss.name = 'FEEGROUP-OVR (Overrideable)'
ISOVR,
select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
sss.i_from = sd.i and
sss.c_from = sd.c and
sss.i_to = ss.i and
sss.c_to = ss.c and
sd1.codeid = sd.codeid and
ss.name = 'FEEGROUP-INT (Internet Enterable)'
ISINT
,trow.answerstr FEE_CODE_DOC_TYPE
from wcbapp.tocorganisation o, wcbapp.tolpartydetails pd, wcbapp.tolserviceagrmtforprovider safp,
wcbapp.tolserviceagreement sa, wcbapp.tolserviceagreementversion sav, wcbapp.rsrvchrgrsrvagrvrserviceagreem scg_sav,
wcbapp.tolservicechargegroup scg, wcbapp.tolservicechargegroupversion scgv, wcbapp.tolserviceprovisionagreement spa,
wcbapp.tolservicedefinition sd
,wcbapp.trow trow, wcbapp.tlookupversion tlookupversion, wcbapp.tlookup tlookup
where
trow.i_lkpver_rows = tlookupversion.i
and trow.c_lkpver_rows = tlookupversion.c
and tlookupversion.i_lookup_versions = tlookup.i
and tlookupversion.c_lookup_versions = tlookup.c
and sd.codeid = trow.minstr_1
and sd.codeid = trow.maxstr_1
and tlookup.name = 'FeeCodeToDocumentLookup' and
spa.i_service_serviceratede = sd.i and
spa.c_service_serviceratede = sd.c and
spa.i_srchrgrv_serviceratede = scgv.i and
spa.c_srchrgrv_serviceratede = scgv.c and
scgv.i_srvchrgr_servicecharge = scg.i and
scgv.c_srvchrgr_servicecharge = scg.c and
scg.i = scg_sav.i_from and
scg.c = scg_sav.c_from and
scg_sav.i_to = sav.i and
scg_sav.c_to = sav.c and
sav.i_srvcagrm_serviceagreem = sa.i and
sav.c_srvcagrm_serviceagreem = sa.c and
sa.i = safp.i_srvcagrm_provider and
sa.c = safp.c_srvcagrm_provider and
safp.i_prtdtls_serviceagreem = pd.i and
safp.c_prtdtls_serviceagreem = pd.c and
pd.i_ocprty_party = o.i and
pd.c_ocprty_party = o.c and
? between safp.effectivedate and safp.enddate and
o.customerno = ? || ?
order by sd.codeid
where ISINT = 1
parameters:
2011-05-01T00:00:00
DOC
007492
time: 16048
rows: 1967
query/performance
evaltime: 16142
query/service
result:
*** removed due to length ***
query/service
function: getFeeCodeByCaregiverEffectiveDate1
arity: 3
dataservice: ld:org/wcb/claims/payment/FINEOS/physical/SQL.ds
query:
import schema namespace t1 = "http://www.test.com/claims/payment" at "ld:org/wcb/claims/payment/FINEOS/physical/schemas/SQL.xsd";
declare namespace ns0="ld:org/wcb/claims/payment/FINEOS/physical/SQL";
declare namespace ns1="http://www.w3.org/2001/XMLSchema";
declare variable $__fparam0 as ns1:dateTime external;
declare variable $__fparam1 as ns1:string external;
declare variable $__fparam2 as ns1:string external;
fn:subsequence(
for $FeeCode3 in ns0:getFeeCodeByCaregiverEffectiveDate1($__fparam0,$__fparam1,$__fparam2)
     return
               $FeeCode3
,1,5000)
parameters:
2011-05-01T00:00:00
DOC
007492
common/time
duration: 16189
timestamp: Thu May 12 13:02:07 GMT-06:00 2011
[Thu May 12 13:02:23 GMT-06:00 2011] End
ODSI Audit with date constant:
[Thu May 12 13:10:00 GMT-06:00 2011] Starting...
Query compilation time: 0 ms
Query evaluation time: 359 ms
Operation duration: 375 ms
Audit Event:
common/application
user: weblogic
name: ClaimsDataspace
server: AdminServer
eventkind: evaluation
query/cache/queryplan
found: true
type: XQUERY_PLAN_CACHE
query/performance
compiletime: 0
common/session/query/invocation
time: Thu May 12 13:10:00 GMT-06:00 2011
blocksize: 59256
duration: 359
query/wrappers/relational
source: jdbc.wcb.fineos
sql:
select codeid, description, FEE_CODE_DOC_TYPE, ismax, isovr
from
select distinct
sd.codeid, sd.description,
select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
sss.i_from = sd.i and
sss.c_from = sd.c and
sss.i_to = ss.i and
sss.c_to = ss.c and
sd1.codeid = sd.codeid and
ss.name = 'FEEGROUP-MAX (MAXIMUM AMOUNT)'
) ISMAX,
select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
sss.i_from = sd.i and
sss.c_from = sd.c and
sss.i_to = ss.i and
sss.c_to = ss.c and
sd1.codeid = sd.codeid and
ss.name = 'FEEGROUP-OVR (Overrideable)'
ISOVR,
select count(*) from wcbapp.tolserviceset ss, wcbapp.RSERVICESRVCSETSERVICESETS sss, wcbapp.tolservicedefinition sd1 where
sss.i_from = sd.i and
sss.c_from = sd.c and
sss.i_to = ss.i and
sss.c_to = ss.c and
sd1.codeid = sd.codeid and
ss.name = 'FEEGROUP-INT (Internet Enterable)'
ISINT
,trow.answerstr FEE_CODE_DOC_TYPE
from wcbapp.tocorganisation o, wcbapp.tolpartydetails pd, wcbapp.tolserviceagrmtforprovider safp,
wcbapp.tolserviceagreement sa, wcbapp.tolserviceagreementversion sav, wcbapp.rsrvchrgrsrvagrvrserviceagreem scg_sav,
wcbapp.tolservicechargegroup scg, wcbapp.tolservicechargegroupversion scgv, wcbapp.tolserviceprovisionagreement spa,
wcbapp.tolservicedefinition sd
,wcbapp.trow trow, wcbapp.tlookupversion tlookupversion, wcbapp.tlookup tlookup
where
trow.i_lkpver_rows = tlookupversion.i
and trow.c_lkpver_rows = tlookupversion.c
and tlookupversion.i_lookup_versions = tlookup.i
and tlookupversion.c_lookup_versions = tlookup.c
and sd.codeid = trow.minstr_1
and sd.codeid = trow.maxstr_1
and tlookup.name = 'FeeCodeToDocumentLookup' and
spa.i_service_serviceratede = sd.i and
spa.c_service_serviceratede = sd.c and
spa.i_srchrgrv_serviceratede = scgv.i and
spa.c_srchrgrv_serviceratede = scgv.c and
scgv.i_srvchrgr_servicecharge = scg.i and
scgv.c_srvchrgr_servicecharge = scg.c and
scg.i = scg_sav.i_from and
scg.c = scg_sav.c_from and
scg_sav.i_to = sav.i and
scg_sav.c_to = sav.c and
sav.i_srvcagrm_serviceagreem = sa.i and
sav.c_srvcagrm_serviceagreem = sa.c and
sa.i = safp.i_srvcagrm_provider and
sa.c = safp.c_srvcagrm_provider and
safp.i_prtdtls_serviceagreem = pd.i and
safp.c_prtdtls_serviceagreem = pd.c and
pd.i_ocprty_party = o.i and
pd.c_ocprty_party = o.c and
'01-MAY-11' between safp.effectivedate and safp.enddate and
o.customerno = ? || ?
order by sd.codeid
where ISINT = 1
parameters:
DOC
007492
time: 344
rows: 500
query/performance
evaltime: 359
query/service
result:
*** removed due to length ***
query/service
function: getFeeCodeByCaregiverEffectiveDate1
arity: 2
dataservice: ld:org/wcb/claims/payment/FINEOS/physical/SQL.ds
query:
import schema namespace t1 = "http://www.test.com/claims/payment" at "ld:org/wcb/claims/payment/FINEOS/physical/schemas/SQL.xsd";
declare namespace ns0="ld:org/wcb/claims/payment/FINEOS/physical/SQL";
declare namespace ns1="http://www.w3.org/2001/XMLSchema";
declare variable $__fparam0 as ns1:string external;
declare variable $__fparam1 as ns1:string external;
fn:subsequence(
for $FeeCode3 in ns0:getFeeCodeByCaregiverEffectiveDate1($__fparam0,$__fparam1)
     return
               $FeeCode3
,1,500)
parameters:
DOC
007492
common/time
duration: 375
timestamp: Thu May 12 13:10:00 GMT-06:00 2011
[Thu May 12 13:10:00 GMT-06:00 2011] End
------------------------------------------------------------------------

Similar Messages

  • Is there a performance difference between Automation Plug-ins and the scripting system?

    We currently have a tool that, through the scripting system, merges and hides layers by layer groups, exports them, and then moves to the next layer group.  There is some custom logic and channel merging that occasionally occurs in the merging of an individual layer group.  These operations are occuring through the scripting system (actually, through C# making direct function calls through Photoshop), and there are some images where these operations take ~30-40 minutes to complete on very large images.
    Is there a performance difference between doing the actions in this way as opposed to having these actions occur in an automation plug-in?
    Thanks,

    Thanks for the reply.    I ended up just benchmarking the current implementation that we are using (which goes through DOM from all indications, I wasn't the original author of the code) and found that accessing each layer was taking upwards of 300 ms.  I benchmarked iterating through the layers with PIUGetInfoByIndexIndex (in the Getter automation plug-in) and found that the first layer took ~300 ms, but the rest took ~1 ms.  With that information, I decided that it was worthwhile rewriting the functionality in an Automation plug-in.

  • Performance difference between java.beans.Expression and Java Reflection

    What is the Performance difference between using java.beans.Expression class and Java Reflection classes like Class,Method ??

    negligible

  • Performance Difference Between Dual 2.7 and Quad, and Logic Pro

    I used to have a G5 DP 2.7 before it went bad and Apple offered me a Quad in exchange. I'd like to understand some details of the specs between these two computers and how they might translate with respect to running Logic Pro (which I'll get to in a minute)...
    Listed below are the specs which I believe illustrate the significant differences between these two machines (this info is based on info gleaned from Macworld, since the specific specs of the DP 2.7 no longer appear on Apple's website):
    Dual 2.7
    (2x) 2.7 GHz, cache = 512K per processor, frontside bus speed = 1.35 GHz per processor
    Quad
    (4x) 2.5 GHz, cache = 2MB on-chip L2 per chip, frontside bus speed = 1.25 GHz per processor
    So here's the link with Logic: it's become apparent of late that Logic Pro is not able to fully utilize the processing power of all 4 cores in the Quad. Reports are that performance tops out at 50% per processor, resulting in approx. 200% possible processing usage from the 4 cores in the Quad.
    However, such a limitation in processor usage wasn't present in the DP 2.7.
    So based on the information I've learned so far, it seems that the Quad and the DP 2.7 are almost equivalent in terms of processing power when running Logic Pro. Now, this is what I'm surmising, but, is this actually the case? At the end of the day, I'd like to know if the Quad indeed a more powerful computer than the DP 2.7 when running Logic Pro, or, did my exchange of DP 2.7 for the Quad constitute a "downgrade" of any proportion?

    The only logical answer to Why Intels do and PPC don't is:
    Apple want everybody to transition to their Intel boxes. The only way to do this is offer better performance in software tweaks for one system over the another, which begs the question what else will Apple do to software for PPC owners?
    Having bought a Mac Pro, primerily for testing out certain software apz under Rosetta, I did a real time test between my 8GB RAM G5 Quad and my stock Mac Pro upgraded to 2GB RAM, batch processing 204 Canon 1DsMKII RAW files into 16-Bitt TIFFs. I put a thread on the Mac Pro forum here:
    http://discussions.apple.com/thread.jspa?threadID=627916&tstart=15
    I so wanted my Quad to squash the Intel invaded Mac, but results speak for themselves. The Mac Pro flattened the G5 Quad by over 23 minutes (it worked out as 1.7 times faster than the G5Quad).
    If that's how it performs with 2GB RAM it's gonna really fly when I max it out. So, for musicians, I would imagine with the Quad core support for Intel Macs in Logic 7.2.2 makes a fairly straight forward decision. . .buy a Mac Pro and sell your PowerMac. More time composing less time waiting for renders (never used music software so if it doesn't render your composition place whatever it does do into the 'renders' slot )
    P.S I hated, really hated having to say the Mac Pro toasted my G5 Quad, I so wanted the Intel to fall flat on it's aluminium as$, but it didn't. It's a quick machine. A very quick machine which toasted my Quad in real time tests using a universal Pro app from a 3rd Party (who would have no incentive to dumb down the PPC version as they sell their product to Windows, PPC OS X and Intel OS X)

  • Difference between Multiple single values and Selection option variables

    Hi !
    Can any one tell me the difference between variable types:
    Multiple single values and Selection option?
    I used each one of them for selecting values for a characteristic but could not notice a difference in choosing values.
    Is there some difference in functionality or can they be used interchageably?
    Regards,
    Sri Harsha

    Harsha,
    When you go for slection option, in the variable input screen you will be having a button in the last where you can give your slections. There you can maintain either multiple single values and Multiple intervals or else not equal to also..
    Just check out there... you will be having tabs for each..
    Assign Points if it helps
    Gattu

  • How could I replace hard coded value in my sql query with constant value?

    Hi all,
    Could anyone help me how to replace hardcoded value in my sql query with constant value that might be pre defined .
    PROCEDURE class_by_day_get_bin_data
         in_report_parameter_id   IN   NUMBER,
         in_site_id               IN   NUMBER,
         in_start_date_time       IN   TIMESTAMP,
         in_end_date_time         IN   TIMESTAMP,
         in_report_level_min      IN   NUMBER,
         in_report_level_max      IN   NUMBER
    IS
      bin_period_length   NUMBER(6,0); 
    BEGIN
      SELECT MAX(period_length)
         INTO bin_period_length
        FROM bin_data
         JOIN site_to_data_source_lane_v
           ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
         JOIN bin_types
           ON bin_types.bin_type = bin_data.bin_type 
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time     >= in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time     <  in_end_date_time   + numtodsinterval(1, 'DAY')
         AND bin_data.bin_type            =  2
         AND bin_data.period_length       <= 60;
      --Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
      --report.
      DELETE FROM edr_class_by_day_bin_data;
       SELECT site_to_data_source_lane_v.site_id,
             site_to_data_source_lane_v.site_lane_id,
             site_to_data_source_lane_v.site_direction_id,
             site_to_data_source_lane_v.site_direction_name,
             bin_data_set.start_date_time,
             bin_data_set.end_date_time,
             bin_data_value.bin_id,
             bin_data_value.bin_value
        FROM bin_data
        JOIN bin_data_set
          ON bin_data.bin_serial = bin_data_set.bin_serial
        JOIN bin_data_value
          ON bin_data_set.bin_data_set_serial = bin_data_value.bin_data_set_serial
        JOIN site_to_data_source_lane_v
             ON bin_data.data_source_id = site_to_data_source_lane_v.data_source_id
            AND bin_data_set.lane = site_to_data_source_lane_v.data_source_lane_id
        JOIN (
               SELECT CAST(report_parameter_value AS NUMBER) lane_id
                 FROM report_parameters
                WHERE report_parameters.report_parameter_id    = in_report_parameter_id
                  AND report_parameters.report_parameter_group = 'LANE'
                  AND report_parameters.report_parameter_name  = 'LANE'
             ) report_lanes
          ON site_to_data_source_lane_v.site_lane_id = report_lanes.lane_id
        JOIN (
               SELECT CAST(report_parameter_value AS NUMBER) class_id
                 FROM report_parameters
                WHERE report_parameters.report_parameter_id    = in_report_parameter_id
                  AND report_parameters.report_parameter_group = 'CLASS'
                  AND report_parameters.report_parameter_name  = 'CLASS'
             ) report_classes
          ON bin_data_value.bin_id = report_classes.class_id
        JOIN edr_rpt_tmp_inclusion_table
          ON TRUNC(bin_data_set.start_date_time) = TRUNC(edr_rpt_tmp_inclusion_table.date_time)
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time     >= in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time     <  in_end_date_time   + numtodsinterval(1, 'DAY')
         AND bin_data_set.start_date_time >= in_start_date_time
         AND bin_data_set.start_date_time <  in_end_date_time
         AND bin_data.bin_type            =  2
         AND bin_data.period_length       =  bin_period_length;
    END class_by_day_get_bin_data;In the above code I'm using the hard coded value 2 for bin type
    bin_data.bin_type            =  2But I dont want any hard coded number or string in the query.
    How could I replace it?
    I defined conatant value like below inside my package body where the actual procedure comes.But I'm not sure whether I have to declare it inside package body or inside the procedure.
    bin_type     CONSTANT NUMBER := 2;But it does't look for this value. So I'm not able to get desired value for the report .
    Thanks.
    Edited by: user10641405 on May 29, 2009 1:38 PM

    Declare the constant inside the procedure.
    PROCEDURE class_by_day_get_bin_data(in_report_parameter_id IN NUMBER,
                                        in_site_id             IN NUMBER,
                                        in_start_date_time     IN TIMESTAMP,
                                        in_end_date_time       IN TIMESTAMP,
                                        in_report_level_min    IN NUMBER,
                                        in_report_level_max    IN NUMBER) IS
      bin_period_length NUMBER(6, 0);
      v_bin_type     CONSTANT NUMBER := 2;
    BEGIN
      SELECT MAX(period_length)
        INTO bin_period_length
        FROM bin_data
        JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
                                           site_to_data_source_lane_v.data_source_id
        JOIN bin_types ON bin_types.bin_type = bin_data.bin_type
       WHERE site_to_data_source_lane_v.site_id = in_site_id
         AND bin_data.start_date_time >=
             in_start_date_time - numtodsinterval(1, 'DAY')
         AND bin_data.start_date_time <
             in_end_date_time + numtodsinterval(1, 'DAY')
         AND bin_data.bin_type = v_bin_type
         AND bin_data.period_length <= 60;
      --Clear the edr_class_by_day_bin_data temporary table and populate it with the data for the requested
      --report.
      DELETE FROM edr_class_by_day_bin_data;
      INSERT INTO edr_class_by_day_bin_data
        (site_id,
         site_lane_id,
         site_direction_id,
         site_direction_name,
         bin_start_date_time,
         bin_end_date_time,
         bin_id,
         bin_value)
        SELECT site_to_data_source_lane_v.site_id,
               site_to_data_source_lane_v.site_lane_id,
               site_to_data_source_lane_v.site_direction_id,
               site_to_data_source_lane_v.site_direction_name,
               bin_data_set.start_date_time,
               bin_data_set.end_date_time,
               bin_data_value.bin_id,
               bin_data_value.bin_value
          FROM bin_data
          JOIN bin_data_set ON bin_data.bin_serial = bin_data_set.bin_serial
          JOIN bin_data_value ON bin_data_set.bin_data_set_serial =
                                 bin_data_value.bin_data_set_serial
          JOIN site_to_data_source_lane_v ON bin_data.data_source_id =
                                             site_to_data_source_lane_v.data_source_id
                                         AND bin_data_set.lane =
                                             site_to_data_source_lane_v.data_source_lane_id
          JOIN (SELECT CAST(report_parameter_value AS NUMBER) lane_id
                  FROM report_parameters
                 WHERE report_parameters.report_parameter_id =
                       in_report_parameter_id
                   AND report_parameters.report_parameter_group = 'LANE'
                   AND report_parameters.report_parameter_name = 'LANE') report_lanes ON site_to_data_source_lane_v.site_lane_id =
                                                                                         report_lanes.lane_id
          JOIN (SELECT CAST(report_parameter_value AS NUMBER) class_id
                  FROM report_parameters
                 WHERE report_parameters.report_parameter_id =
                       in_report_parameter_id
                   AND report_parameters.report_parameter_group = 'CLASS'
                   AND report_parameters.report_parameter_name = 'CLASS') report_classes ON bin_data_value.bin_id =
                                                                                            report_classes.class_id
          JOIN edr_rpt_tmp_inclusion_table ON TRUNC(bin_data_set.start_date_time) =
                                              TRUNC(edr_rpt_tmp_inclusion_table.date_time)
         WHERE site_to_data_source_lane_v.site_id = in_site_id
           AND bin_data.start_date_time >=
               in_start_date_time - numtodsinterval(1, 'DAY')
           AND bin_data.start_date_time <
               in_end_date_time + numtodsinterval(1, 'DAY')
           AND bin_data_set.start_date_time >= in_start_date_time
           AND bin_data_set.start_date_time < in_end_date_time
           AND bin_data.bin_type = v_bin_type
           AND bin_data.period_length = bin_period_length;
    END class_by_day_get_bin_data;

  • Agent based release templates, hard coded values configurable?

    My Release templates consists of couple of hard coded values like Installation Path, documents folder paths etc. To create a new template, i need to change those values in so many places and it's very time consuming for bigger templates.
    I have implemented agent based release and my questions are:
    1. Is it possible to configure such values with variables in the scope of each stages of releases like QA, Staging, Production etc.
    2. What is the difference between agent based release templates and vNext templates.
    Sreekanth Mohan

    Hi Sreekanth,  
    Thanks for your reply.
    If there’s may Stages in your release template, I think you can create/edit the correct action steps in one Stage, then copy them to other Stages in your release template.
    Or you can try to use the Tag feature in your release template if you will do the same deploy in multiple servers, please refer to the helpful information in this article:
    http://www.incyclesoftware.com/2014/02/new-feature-release-management-visual-studio-update-2-server-tags/.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Huge performance differences between a map listener for a key and filter

    Hi all,
    I wanted to test different kind of map listener available in Coherence 3.3.1 as I would like to use it as an event bus. The result was that I found huge performance differences between them. In my use case, I have data which are time stamped so the full key of the data is the key which identifies its type and the time stamp. Unfortunately, when I had my map listener to the cache, I only know the type id but not the time stamp, thus I cannot add a listener for a key but for a filter which will test the value of the type id. When I launch my test, I got terrible performance results then I tried a listener for a key which gave me much better results but in my case I cannot use it.
    Here are my results with a Dual Core of 2.13 GHz
    1) Map Listener for a Filter
    a) No Index
    Create (data always added, the key is composed by the type id and the time stamp)
    Cache.put
    Test 1: Total 42094 millis, Avg 1052, Total Tries 40, Cache Size 80000
    Cache.putAll
    Test 2: Total 43860 millis, Avg 1096, Total Tries 40, Cache Size 80000
    Update (data added then updated, the key is only composed by the type id)
    Cache.put
    Test 3: Total 56390 millis, Avg 1409, Total Tries 40, Cache Size 2000
    Cache.putAll
    Test 4: Total 51734 millis, Avg 1293, Total Tries 40, Cache Size 2000
    b) With Index
    Cache.put
    Test 5: Total 39594 millis, Avg 989, Total Tries 40, Cache Size 80000
    Cache.putAll
    Test 6: Total 43313 millis, Avg 1082, Total Tries 40, Cache Size 80000
    Update
    Cache.put
    Test 7: Total 55390 millis, Avg 1384, Total Tries 40, Cache Size 2000
    Cache.putAll
    Test 8: Total 51328 millis, Avg 1283, Total Tries 40, Cache Size 2000
    2) Map Listener for a Key
    Update
    Cache.put
    Test 9: Total 3937 millis, Avg 98, Total Tries 40, Cache Size 2000
    Cache.putAll
    Test 10: Total 1078 millis, Avg 26, Total Tries 40, Cache Size 2000
    Please help me to find what is wrong with my code because for now it is unusable.
    Best Regards,
    Nicolas
    Here is my code
    import java.io.DataInput;
    import java.io.DataOutput;
    import java.io.IOException;
    import java.util.HashMap;
    import java.util.Map;
    import com.tangosol.io.ExternalizableLite;
    import com.tangosol.net.CacheFactory;
    import com.tangosol.net.NamedCache;
    import com.tangosol.util.Filter;
    import com.tangosol.util.MapEvent;
    import com.tangosol.util.MapListener;
    import com.tangosol.util.extractor.ReflectionExtractor;
    import com.tangosol.util.filter.EqualsFilter;
    import com.tangosol.util.filter.MapEventFilter;
    public class TestFilter {
          * To run a specific test, just launch the program with one parameter which
          * is the test index
         public static void main(String[] args) {
              if (args.length != 1) {
                   System.out.println("Usage : java TestFilter 1-10|all");
                   System.exit(1);
              final String arg = args[0];
              if (arg.endsWith("all")) {
                   for (int i = 1; i <= 10; i++) {
                        test(i);
              } else {
                   final int testIndex = Integer.parseInt(args[0]);
                   if (testIndex < 1 || testIndex > 10) {
                        System.out.println("Usage : java TestFilter 1-10|all");
                        System.exit(1);               
                   test(testIndex);               
         @SuppressWarnings("unchecked")
         private static void test(int testIndex) {
              final NamedCache cache = CacheFactory.getCache("test-cache");
              final int totalObjects = 2000;
              final int totalTries = 40;
              if (testIndex >= 5 && testIndex <= 8) {
                   // Add index
                   cache.addIndex(new ReflectionExtractor("getKey"), false, null);               
              // Add listeners
              for (int i = 0; i < totalObjects; i++) {
                   final MapListener listener = new SimpleMapListener();
                   if (testIndex < 9) {
                        // Listen to data with a given filter
                        final Filter filter = new EqualsFilter("getKey", i);
                        cache.addMapListener(listener, new MapEventFilter(filter), false);                    
                   } else {
                        // Listen to data with a given key
                        cache.addMapListener(listener, new TestObjectSimple(i), false);                    
              // Load data
              long time = System.currentTimeMillis();
              for (int iTry = 0; iTry < totalTries; iTry++) {
                   final long currentTime = System.currentTimeMillis();
                   final Map<Object, Object> buffer = new HashMap<Object, Object>(totalObjects);
                   for (int i = 0; i < totalObjects; i++) {               
                        final Object obj;
                        if (testIndex == 1 || testIndex == 2 || testIndex == 5 || testIndex == 6) {
                             // Create data with key with time stamp
                             obj = new TestObjectComplete(i, currentTime);
                        } else {
                             // Create data with key without time stamp
                             obj = new TestObjectSimple(i);
                        if ((testIndex & 1) == 1) {
                             // Load data directly into the cache
                             cache.put(obj, obj);                         
                        } else {
                             // Load data into a buffer first
                             buffer.put(obj, obj);                         
                   if (!buffer.isEmpty()) {
                        cache.putAll(buffer);                    
              time = System.currentTimeMillis() - time;
              System.out.println("Test " + testIndex + ": Total " + time + " millis, Avg " + (time / totalTries) + ", Total Tries " + totalTries + ", Cache Size " + cache.size());
              cache.destroy();
         public static class SimpleMapListener implements MapListener {
              public void entryDeleted(MapEvent evt) {}
              public void entryInserted(MapEvent evt) {}
              public void entryUpdated(MapEvent evt) {}
         public static class TestObjectComplete implements ExternalizableLite {
              private static final long serialVersionUID = -400722070328560360L;
              private int key;
              private long time;
              public TestObjectComplete() {}          
              public TestObjectComplete(int key, long time) {
                   this.key = key;
                   this.time = time;
              public int getKey() {
                   return key;
              public void readExternal(DataInput in) throws IOException {
                   this.key = in.readInt();
                   this.time = in.readLong();
              public void writeExternal(DataOutput out) throws IOException {
                   out.writeInt(key);
                   out.writeLong(time);
         public static class TestObjectSimple implements ExternalizableLite {
              private static final long serialVersionUID = 6154040491849669837L;
              private int key;
              public TestObjectSimple() {}          
              public TestObjectSimple(int key) {
                   this.key = key;
              public int getKey() {
                   return key;
              public void readExternal(DataInput in) throws IOException {
                   this.key = in.readInt();
              public void writeExternal(DataOutput out) throws IOException {
                   out.writeInt(key);
              public int hashCode() {
                   return key;
              public boolean equals(Object o) {
                   return o instanceof TestObjectSimple && key == ((TestObjectSimple) o).key;
    }Here is my coherence config file
    <?xml version="1.0"?>
    <!DOCTYPE cache-config SYSTEM "cache-config.dtd">
    <cache-config>
         <caching-scheme-mapping>
              <cache-mapping>
                   <cache-name>test-cache</cache-name>
                   <scheme-name>default-distributed</scheme-name>
              </cache-mapping>
         </caching-scheme-mapping>
         <caching-schemes>          
              <distributed-scheme>
                   <scheme-name>default-distributed</scheme-name>
                   <backing-map-scheme>
                        <class-scheme>
                             <scheme-ref>default-backing-map</scheme-ref>
                        </class-scheme>
                   </backing-map-scheme>
              </distributed-scheme>
              <class-scheme>
                   <scheme-name>default-backing-map</scheme-name>
                   <class-name>com.tangosol.util.SafeHashMap</class-name>
              </class-scheme>
         </caching-schemes>
    </cache-config>Message was edited by:
    user620763

    Hi Robert,
    Indeed, only the Filter.evaluate(Object obj)
    method is invoked, but the object passed to it is a
    MapEvent.<< In fact, I do not need to implement EntryFilter to
    get a MapEvent, I could get the same result (in my
    last message) by writting
    cache.addMapListener(listener, filter,
    true)instead of
    cache.addMapListener(listener, new
    MapEventFilter(filter) filter, true)
    I believe, when the MapEventFilter delegates to your filter it always passes a value object to your filter (old or new), meaning a value will be deserialized.
    If you instead used your own filter, you could avoid deserializing the value which usually is much larger, and go to only the key object. This would of course only be noticeable if you indeed used a much heavier cached value class.
    The hashCode() and equals() does not matter on
    the filter class<< I'm not so sure since I noticed that these methods
    were implemented in the EqualsFilter class, that they
    are called at runtime and that the performance
    results are better when you add them
    That interests me... In what circumstances did you see them invoked? On the storage node before sending an event, or upon registering a filtered listener?
    If the second, then I guess the listeners are stored in a hash-based map of collections keyed by a filter, and indeed that might be relevant as in that case it will cause less passes on the filter for multiple listeners with an equalling filter.
    DataOutput.writeInt(int) writes 4 bytes.
    ExternalizableHelper.writeInt(DataOutput, int) writes
    1-5 bytes (or 1-6?), with numbers with small absolute
    values consuming less bytes.Similar differences exist
    for the long type as well, but your stamp attribute
    probably will be a large number...<< I tried it but in my use case, I got the same
    results. I guess that it must be interesting, if I
    serialiaze/deserialiaze many more objects.
    Also, if Coherence serializes an
    ExternalizableLite object, it writes out its
    class-name (except if it is a Coherence XmlBean). If
    you define your key as an XmlBean, and add your class
    into the classname cache configuration in
    ExternalizableHelper.xml, then instead of the
    classname, only an int will be written. This way you
    can spare a large percentage of bandwidth consumed by
    transferring your key instance as it has only a small
    number of attributes. For the value object, it might
    or might not be so relevant, considering that it will
    probably contain many more attributes. However, in
    case of a lite event, the value is not transferred at
    all.<< I tried it too and in my use case, I noticed that
    we get objects nearly twice lighter than an
    ExternalizableLite object but it's slower to get
    them. But it is very intersting to keep in mind, if
    we would like to reduce the network traffic.
    Yes, these are minor differences at the moment.
    As for the performance of XMLBean, it is a hack, but you might try overriding the readExternal/writeExternal method with your own usual ExternalizableLite implementation stuff. That way you get the advantages of the xmlbean classname cache, and avoid its reflection-based operation, at the cost of having to extend XMLBean.
    Also, sooner or later the TCMP protocol and the distributed cache storages will also support using PortableObject as a transmission format, which enables using your own classname resolution and allow you to omit the classname from your objects. Unfortunately, I don't know when it will be implemented.
    >
    But finally, I guess that I found the best solution
    for my specific use case which is to use a map
    listener for a key which has no time stamp, but since
    the time stamp is never null, I had just to check
    properly the time stamp in the equals method.
    I would still recommend to use a separate key class, use a custom filter which accesses only the key and not the value, and if possible register a lite listener instead of a heavy one. Try it with a much heavier cached value class where the differences are more pronounced.
    Best regards,
    Robert

  • SSRS expression for difference between two currency values

    Hi All;
    I need to get the difference between two currency values
    Below is my report
    I need to get differene between Actual Income and Profile Income and this value should be in "£" In this example it should be £0.00
    Any help much appreciated
    Thanks
    Pradnya07

    =sum(Fields!ProfileIncome.Value - Fields!ActualIncome.Value)
    This could have either field first, but depends on which field is expected to be larger. You would then format the textbox to show in pounds.
    HTH

  • Hard coded values in ADF 11g

    i want to insert hard coded values through ADF form..
    kindly help me in this
    Thanks in Advance
    VL Naidu

    Thanks john and Grant..
    i have another issue now..
    i have created the Edit form and a table
    giving partial trigger for form to table..
    so wen i select the row the corresponding row values will be displayed in the Edit form.
    but i want to show a Empty form on page load and after data insertion.
    i tried in refresh condition .but nothing worked.
    can u help me in this issue.
    Thanks in Advance
    VL Naidu

  • How to mention User specific fileshare as Hard coded value in DB table

    I have a scenario like whenever the user clicks on Print, the application will generate a temp file Temp.txt and place it in fileshare location that is given in Database hard coded value as C:\Test, The problem here is when more than one user clicks on print button, the second user is getting error, as the same file is being used by first user.
    To save the temp file, I want to mention a locaton something like "C:\Documents and Settings\<User Id>" where <user Id> will be '0001' for user one and '0002' for user two. (0001 and 0002 are suppose to be the user login name within the organisation). Is there anyway to specify the user id of the active user as a hard coded value?

    take the output of select user from dual; in a variable and then append that either with file name or with directory location..

  • Get Date Difference between 2 date values as days

    Hi,
    How to get the difference between 2 dates in number of days format. Say if i need the difference between 2012-08-23 and 2012-08-20 as 3
    Please help..

    Hi,
    You can do it in XSLT since the dates are in ISO 8601 format...
    http://www.w3.org/TR/NOTE-datetime
    Here is a sample XSLT...
    <xsl:stylesheet  version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:fn="http://www.w3.org/2005/xpath-functions">
    <xsl:template match="/">
    <xsl:variable name="date1" select="xs:dateTime(/root/date1)"/>
    <xsl:variable name="date2" select="xs:dateTime(/root/date2)"/>
    <xsl:value-of select="fn:days-from-duration($date2 - $date1)"/>
    </xsl:template>
    </xsl:stylesheet>The above XSLT will result *4* for the following input...
    <root>
    <date1>2012-01-11T00:00:00.000-05:00</date1>
    <date2>2012-01-15T00:00:00.000-05:00</date2>
    </root>You can test this example here...
    http://xslttest.appspot.com/
    Hope this helps...
    Cheers,
    Vlad
    It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts)
    https://forums.oracle.com/forums/ann.jspa?annID=893

  • Graph axes assignment: performance difference between ATTR_ACTIVE_XAXIS and ATTR_PLOT_XAXIS

    Hi,
    I am using a xy graph with both x axes and both y axes. There are two possibilities when adding a new plot:
    1) PlotXY and SetPlotAttribute ( , , , ATTR_PLOT_XAXIS, );
    2) SetCtrlAttribute ( , , ATTR_ACTIVE_XAXIS, ) and PlotXY
    I tend to prefer the second method because I would assume it to be slightly faster, but what do the experts say?
    Thanks!  
    Solved!
    Go to Solution.

    Hi Wolfgang,
    thank you for your interesting question.
    First of all I want to say, that generally spoken, using the command "SetCtrlAttribute"is the best way to handle with your elements. I would suggest using this command when ever it is possible.
    Now, to your question regarding the performance difference between "SetCtrlAttribute" and "SetPlotAttribute".
    I think the performance difference occures, because in the background of the "SetPlotAttribute" command, another function called "ProcessDrawEvents" is executed. This event refreshes your plot again and again in the function whereas in the "SetCtrlAttribute" the refreshing is done once after the function has been finished. This might be a possible reason.
    For example you have a progress bar which shows you the progress of installing a driver:
    "SetPlotAttribute" would show you the progress bar moving step by step until installing the driver is done.
    "SetCtrlAttribute" would just show you an empty bar at the start and a full progress bar when the installing process is done.
    I think it is like that but I can't tell you 100%, therefore I would need to ask our developers.
    If you want, i can forward the question to them, this might need some times. Also, then I would need to know which version of CVI you are using.
    Please let me now if you want me to forward your question.
    Have a nice day,
    Abduelkerim
    Sales
    NI Germany

  • Query runs slower when using variables & faster when using hard coded value

    Hi,
    My query runs slower when i use variables but it runs faster when i use hard coded values. Why it is behaving like this ?
    My query is in cursor definition in a procedure. Procedure runs faster when using hard coded valus and slower when using variables.
    Can anybody help me out there?
    Thanks in advance.

    Hi,
    Thanks for ur reply.
    here is my code with Variables:
    Procedure populateCountryTrafficDetails(pWeekStartDate IN Date , pCountry IN d_geography.country_code%TYPE) is
    startdate date;
    AR_OrgId number(10);
    Cursor cTraffic is
    Select
              l.actual_date, nvl(o.city||o.zipcode,'Undefined') Site,
              g.country_code,d.customer_name, d.customer_number,t.contrno bcn,
              nvl(r.dest_level3,'Undefined'),
              Decode(p.Product_code,'820','821','821','821','801') Product_Code ,
              Decode(p.Product_code,'820','Colt Voice Connect','821','Colt Voice Connect','Colt Voice Line') DProduct,
              sum(f.duration),
              sum(f.debamount_eur)
              from d_calendar_date l,
              d_geography g,
              d_customer d, d_contract t, d_subscriber s,
              d_retail_dest r, d_product p,
              CPS_ORDER_DETAILS o,
              f_retail_revenue f
              where
              l.date_key = f.call_date_key and
              g.geography_key = f.geography_key and
              r.dest_key = f.dest_key and
              p.product_key = f.product_key and
              --c.customer_key = f.customer_key and
              d.customer_key = f.customer_key and
              t.contract_key = f.contract_key and
              s.SUBSCRIBER_KEY = f.SUBSCRIBER_KEY and
              o.org_id(+) = AR_OrgId and
              g.country_code = pCountry and
              l.actual_date >= startdate and
              l.actual_date <= (startdate + 90) and
              o.cli(+) = s.area_subno and
              p.product_code in ('800','801','802','804','820','821')
              group by
              l.actual_date,
              o.city||o.zipcode, g.country_code,d.customer_name, d.customer_number,t.contrno,r.dest_level3, p.product_code;
    Type CountryTabType is Table of country_traffic_details.Country%Type index by BINARY_INTEGER;
    Type CallDateTabType is Table of country_traffic_details.CALL_DATE%Type index by BINARY_INTEGER;
    Type CustomerNameTabType is Table of Country_traffic_details.Customer_name%Type index by BINARY_INTEGER;
    Type CustomerNumberTabType is Table of Country_traffic_details.Customer_number%Type index by BINARY_INTEGER;
    Type BcnTabType is Table of Country_traffic_details.Bcn%Type index by BINARY_INTEGER;
    Type DestinationTypeTabType is Table of Country_traffic_details.DESTINATION_TYPE%Type index by BINARY_INTEGER;
    Type ProductCodeTabType is Table of Country_traffic_details.Product_Code%Type index by BINARY_INTEGER;
    Type ProductTabType is Table of Country_traffic_details.Product%Type index by BINARY_INTEGER;
    Type DurationTabType is Table of Country_traffic_details.Duration%Type index by BINARY_INTEGER;
    Type DebamounteurTabType is Table of Country_traffic_details.DEBAMOUNTEUR%Type index by BINARY_INTEGER;
    Type SiteTabType is Table of Country_traffic_details.Site%Type index by BINARY_INTEGER;
    CountryArr CountryTabType;
    CallDateArr CallDateTabType;
    Customer_NameArr CustomerNameTabType;
    CustomerNumberArr CustomerNumberTabType;
    BCNArr BCNTabType;
    DESTINATION_TYPEArr DESTINATIONTYPETabType;
    PRODUCT_CODEArr PRODUCTCODETabType;
    PRODUCTArr PRODUCTTabType;
    DurationArr DurationTabType;
    DebamounteurArr DebamounteurTabType;
    SiteArr SiteTabType;
    Begin
         startdate := (trunc(pWeekStartDate) + 6) - 90;
         Exe_Pos := 1;
         Execute Immediate 'Truncate table country_traffic_details';
         dropIndexes('country_traffic_details');
         Exe_Pos := 2;
         /* Set org ID's as per AR */
         case (pCountry)
         when 'FR' then AR_OrgId := 81;
         when 'AT' then AR_OrgId := 125;
         when 'CH' then AR_OrgId := 126;
         when 'DE' then AR_OrgId := 127;
         when 'ES' then AR_OrgId := 123;
         when 'IT' then AR_OrgId := 122;
         when 'PT' then AR_OrgId := 124;
         when 'BE' then AR_OrgId := 132;
         when 'IE' then AR_OrgId := 128;
         when 'DK' then AR_OrgId := 133;
         when 'NL' then AR_OrgId := 129;
         when 'SE' then AR_OrgId := 130;
         when 'UK' then AR_OrgId := 131;
         else raise_application_error (-20003, 'No such Country Code Exists.');
         end case;
         Exe_Pos := 3;
    dbms_output.put_line('3: '||to_char(sysdate, 'HH24:MI:SS'));
         populateOrderDetails(AR_OrgId);
    dbms_output.put_line('4: '||to_char(sysdate, 'HH24:MI:SS'));
         Exe_Pos := 4;
         Open cTraffic;
         Loop
         Exe_Pos := 5;
         CallDateArr.delete;
    FETCH cTraffic BULK COLLECT
              INTO CallDateArr, SiteArr, CountryArr, Customer_NameArr,CustomerNumberArr,
              BCNArr,DESTINATION_TYPEArr,PRODUCT_CODEArr, PRODUCTArr, DurationArr, DebamounteurArr LIMIT arraySize;
              EXIT WHEN CallDateArr.first IS NULL;
                   Exe_pos := 6;
                        FORALL i IN 1..callDateArr.last
                        insert into country_traffic_details
                        values(CallDateArr(i), CountryArr(i), Customer_NameArr(i),CustomerNumberArr(i),
                        BCNArr(i),DESTINATION_TYPEArr(i),PRODUCT_CODEArr(i), PRODUCTArr(i), DurationArr(i),
                        DebamounteurArr(i), SiteArr(i));
                        Exe_pos := 7;
    dbms_output.put_line('7: '||to_char(sysdate, 'HH24:MI:SS'));
         EXIT WHEN ctraffic%NOTFOUND;
    END LOOP;
         commit;
    Exe_Pos := 8;
              commit;
    dbms_output.put_line('8: '||to_char(sysdate, 'HH24:MI:SS'));
              lSql := 'CREATE INDEX COUNTRY_TRAFFIC_DETAILS_CUSTNO ON country_traffic_details (CUSTOMER_NUMBER)';
              execDDl(lSql);
              lSql := 'CREATE INDEX COUNTRY_TRAFFIC_DETAILS_BCN ON country_traffic_details (BCN)';
              execDDl(lSql);
              lSql := 'CREATE INDEX COUNTRY_TRAFFIC_DETAILS_PRODCD ON country_traffic_details (PRODUCT_CODE)';
              execDDl(lSql);
              lSql := 'CREATE INDEX COUNTRY_TRAFFIC_DETAILS_SITE ON country_traffic_details (SITE)';
              execDDl(lSql);
              lSql := 'CREATE INDEX COUNTRY_TRAFFIC_DETAILS_DESTYP ON country_traffic_details (DESTINATION_TYPE)';
              execDDl(lSql);
              Exe_Pos:= 9;
    dbms_output.put_line('9: '||to_char(sysdate, 'HH24:MI:SS'));
    Exception
         When Others then
         raise_application_error(-20003, 'Error in populateCountryTrafficDetails at Position: '||Exe_Pos||' The Error is '||SQLERRM);
    End populateCountryTrafficDetails;
    In the above procedure if i substitute the values with hard coded values i.e. AR_orgid = 123 & pcountry = 'Austria' then it runs faster.
    Please let me know why it is so ?
    Thanks in advance.

  • Master Data with Hard coded value

    Hi,
    I have a Report with 3 columns
    2nd & 3rd columns are the Master Data(<b>0COMP_CODE</b>)
    1st column is Hard coded value, This value is not stored any where (For example: <b>010</b>)
    If I want to create a Report with these 3 columns, how should I proceed.
    any good Idea.
    Thanks
    Priya

    Hi Roberto,
    Thanks for the Quick Response.
    I don't forgot to Reward the points.
    I am Extracting Data From R/3 .
    and I want a Report Like
    For Example
    <b> col1   col2    col3</b>
        0100    xyzz    abcd
        0100    xyxx    dfcd
        0100    yxzz    bcds
    col2 & col3 has 0comp_code_attr & 0comp_code_text
    column 1 is hard coded value
    let us assum for all records we can display <b>0100</b>
    how it is possible
    Thnks
    Priya

Maybe you are looking for