Need Help on where clause condition

Hello All,
Thanks in advance::
I have below SQL query which is returning 1500 records when i dont use any condition in where clause(Please see the query below);
SELECT POS_TYPE,
POS_ID,
SUB_ACNT_ID,
CHRG,
DOC,
NULL,
ACNT_RLN,
ACCOUNT_FLODERS_VER,
DM_LSTUPDDT,
DM_BTNUMBER,
DM_USERID,
DM_WSID,
STAT_FLG,
SERVICES_FLG,
SERVICES,
INTRST_COND,
PST_INSTRN
FROM &&SRC.ACCOUNT_FOLDERS,
&&SRC.DB;
Output: 15 rows retured
And when i validate the data by putting some conditions in where clause , it is giving 1499 records ( Please see the query below with condition )
SELECT POS_TYPE,
POS_ID,
SUB_ACNT_ID,
CHRG,
DOC,
NULL,
ACNT_RLN,
ACCOUNT_FLODERS_VER,
DM_LSTUPDDT,
DM_BTNUMBER,
DM_USERID,
DM_WSID,
STAT_FLG,
SERVICES_FLG,
SERVICES,
INTRST_COND,
PST_INSTRN
FROM &&SRC.ACCOUNT_FOLDERS,
&&SRC.DB
WHERE (POS_TYPE,
POS_ID,
SUB_ACNT_ID) IN (SELECT POS_TYPE,
POS_ID,
SUB_ACNT_ID FROM ACCOUNT
WHERE DM_LSTUPDDT > 1_LAST_RUN_DATE OR 1_FIRST_RUN_FLAG=1);
Now, I wanted to know that missing record(1st SQL is giving 1500 rows without any condition & 1nd SQL is giving 1499 rows with condition in where clause)
I am worried and confused to find out the missing record. Tried with different conditions like Not In... nothing worked perfectly.
Could some one please have a look and provide me the correct SQL , Performance wise also it should be good, SQL should not cause any performance issues.
Please help me on it..
Thanks,
MKR

Do a minus
SELECT POS_TYPE,
       POS_ID,
       SUB_ACNT_ID,
       CHRG,
       DOC,
       NULL,
       ACNT_RLN,
       ACCOUNT_FLODERS_VER,
       DM_LSTUPDDT,
       DM_BTNUMBER,
       DM_USERID,
       DM_WSID,
       STAT_FLG,
       SERVICES_FLG,
       SERVICES,
       INTRST_COND,
       PST_INSTRN
  FROM &&SRC.ACCOUNT_FOLDERS, &&SRC.DB;
MINUS
SELECT POS_TYPE,
       POS_ID,
       SUB_ACNT_ID,
       CHRG,
       DOC,
       NULL,
       ACNT_RLN,
       ACCOUNT_FLODERS_VER,
       DM_LSTUPDDT,
       DM_BTNUMBER,
       DM_USERID,
       DM_WSID,
       STAT_FLG,
       SERVICES_FLG,
       SERVICES,
       INTRST_COND,
       PST_INSTRN
  FROM &&SRC.ACCOUNT_FOLDERS, &&SRC.DB
WHERE (POS_TYPE, POS_ID, SUB_ACNT_ID) IN (SELECT POS_TYPE, POS_ID, SUB_ACNT_ID
                                             FROM ACCOUNT
                                            WHERE DM_LSTUPDDT > 1_LAST_RUN_DATE
                                               OR  1_FIRST_RUN_FLAG = 1);  G.

Similar Messages

  • Need help decifering where clause

    What do these excerpts from where statements do?
    1) and a_id = b_id + 0
    also
    2) and a_position = b.position || ''
    More importantly where does this kind of stuff show up in the Oracle documentation (joins?)
    Thanks
    Holly

    Functionally, those clauses are identical to
    and a_id = b_idand
    and a_position = b.positionThe difference is that adding 0 or concatenating a NULL prevents Oracle from using an index on b_id of b.position. That may have been intentional on the part of a previous developer, particularly if the application was originally written using the rule-based optimizer.
    Justin
    Frank beat me to it.
    Message was edited by:
    Justin Cave

  • Including additional where clause conditions to view criteria dynamically

    Hi,
    We have a set of view objects that serves as LOV for various other view objects. All such LOV view objects have three specific attributes, two date attributes namely EffectiveStartDate, EffectiveEndDate and a String attribute namely UserSwitch based on which the LOV list needs to be filtered.
    All the view objects are having one or more view criterias with specific where clause conditions.
    Apart from those view criteria conditions, invariantly, we need the following conditions also
    :bindEffDate between EffectiveStartDate and EffectiveEndDate and UserSwitch = :bindUserSwitch.
    We wish not to include the above condition in each and every view criteria of each and every view object (Since we have around 800 view objects and a minimum of 2 view criterias per view object). Instead, we created a dummy view object (BaseViewObject) with two bind variables :bindEffDate and :bindUserSwitch and all the LOV view objects were made to extend this BaseViewObject.
    Therefore, whenever a view object atribute is attached with LOV using the above said LOV View Objects, the bind variables of the baseViewObject as well as the view object specific bind variables are available in the view accessors tab of the view object wizard where we can supply values to those bind variables.
    Now, we need to construct the view criteria filter clause. To achieve this, we created a class, CustomCriteriaAdapter.java extending oracle.jbo.server.CriteriaAdapterImpl. In the getCriteriaClause() method, we included the follwoing code:
    public String getCriteriaClause(ViewCriteria pViewCriteria)
    ViewObject vo = pViewCriteria.getViewObject();
    String userSelectSwitch = (String) vo.ensureVariableManager().getVariableValue("bindUserSwitch");
    String effBgnDt = vo.getAttributeDef(vo.getAttributeIndexOf("EffectiveStartDate")).getName();
    String effEndDt = vo.getAttributeDef(vo.getAttributeIndexOf("EffectiveEndDate")).getName();
    String customCriteria = " ( :bindEffDate >= " + effBgnDt + " ) AND ( :bindEffDate <= " + effEndDt + " OR " + effEndDt + " IS NULL ) ";
    StringBuffer completeCriteria = new StringBuffer();
    String criteriaClause = super.getCriteriaClause(pViewCriteria);
    if (criteriaClause != null && !criteriaClause.isEmpty())
    completeCriteria.append(criteriaClause + " AND ");
    completeCriteria.append(customCriteria);
    if (userSelectSwitch != null && "Y".equals(userSelectSwitch))
    String userSelectSw = vo.getAttributeDef(vo.getAttributeIndexOf("UserSwitch")).getName();
    completeCriteria.append(" AND (" + userSelectSw + "='Y' ) ");
    return completeCriteria.toString();
    Issues:
    The LOV list is not filtering the records based on the constructed conditions. Instead it is listing either all of the records considering only the view criteria conditions applied at design time irrespective of the userswitch and effectivedate conditions or the list is empty.
    Here, my questions are,
    1. Am I in the correct approach? If not, guide me in a more proper approach to achieve the same requirement.
    2. If the way I am trying is correct, where things are going wrong and why the dynamic condition is not getting effected?
    Kindly help in sorting out the issue.
    Thanks in advance.

    Hi Jobinesh,
    Thanks for your response and yes, we have done exactly as what you have mentioned. As explained earlier, a baseViewObject along with its Impl class has been created and it will be extended by all the viewobjects meant for serving LOV. Therefore, the superClass for any such LOV viewObject is the baseViewObjectImpl class. In that baseViewObjectImpl(), we have over-rided the criteriaAdapter() method and returned an instance of our customCriteriaAdapter() class.
    Below is the code we are using in the baseViewObjectImpl():
    package model.base.vo;
    import oracle.jbo.CriteriaAdapter;
    import oracle.jbo.server.ViewObjectImpl;
    public class BaseViewObjectImpl
    extends ViewObjectImpl
    * This is the default constructor (do not remove).
    public BaseViewObjectImpl()
    * Over-rided method of ViewObjectImpl class of the framework.
    * Calls the customized criteria adapter so that the default where clauses are added to the view criteria.
    * @return CriteriaAdapter.
    @Override
    public CriteriaAdapter getCriteriaAdapter()
    return new CustomCriteriaAdapter();
    I'll create a sample in HR schema and share with you shortly.
    Thanks and regards.

  • Sequence of tables in from clause and sequence of "where clause" conditions

    Is Sequence of tables in "From Clause" and sequence of "where clause" conditions matters in 10g for performance?
    Edited by: user6763079 on Jun 1, 2011 3:33 AM

    user6763079 wrote:
    Is Sequence of tables in "From Clause" and sequence of "where clause" conditions matters in 10g for performance?In general it does not matter.
    It could matter if the Rule Based Optimizer (RBO) is used. However this RBO is only used if enforced by a hint or if no table statistics are collected. Starting from 10g the table statistics are automatically selected by a regular database job. So in general the CBO would be used.
    The CBO will consider different access paths. If the number of tables is low enough, then all possible combinations are considered and the order does not make any difference.
    Edited by: Sven W. on Jun 1, 2011 4:00 PM

  • HT1338 Need help locating where and how to update Mac OS-X 10.6.5 to the latest Mountain Lion Software...thanx John

    I need help locating where and how to update Mac OS-X to Mountain Lion.....Thanx....Jay

    First update your 10.6 version to 10.6.8 from the software update under the Apple Menu.
    This will add direct access to the Mac App store via a new application.
    Now launch the App Store from your Applications folder - Its the new icon a letter A formed from a ruler pencil and pen on a blue circle !
    Once launched you need to add your iTunes account details or create an account add payment details etc...
    Sign in purchase download and follow install processes to upgrade to 10.8 Mountain Lion.
    OH and to be safe BEFORE you install backup your current system to an external drive !

  • In which order does the query's where clause condition is checked

    Hi All,
    can anyone tell me in which order does oracle evaluate the where clause condition?
    for ex: select * from users where user_type='Admin' and stauts='Enabled'

    user9981103 wrote:
    The conditions in the WHERE clause are checked in the reverse order of the given order.
    i.e; first it will check stauts='Enabled'* and then user_type='Admin'* for your given queryWhy do you believe that?
    If there is a sufficiently selective b-tree index on USER_TYPE, the optimizer would undoubtedly use that index to process the USER_TYPE = 'Admin' condition and then check the STATUS column.
    If there is a sufficiently selective b-tree index on STATUS, the optimizer would undoubtedly use that index to process the STATUS='Enabled' condition and then check the USER_TYPE column.
    If there is a composite b-tree index on (STATUS, USER_TYPE), the optimizer would use that index to process the two conditions nearly simultaneously, though technically the leading column of the index is evaluated first. Of course, if you reverse the order of columns in the index, you get a different evaluation order
    If there are bitmap indexes on STATUS and USER_TYPE, Oracle can combine the two indexes and evaluate the two conditions simultaneously.
    And that is leaving out tons of query plan options and other optimizer wrinkles.
    Justin

  • Help on Where clause

    Hi,
    I am a newbie on Oracle and I need help on this problem:
    I have a data block in a form and I need to insert in the Property 'WHERE CLAUSE' a where clause based on the conditions:
    1) ANA_TYPE := TXT_ANA_TYPE AND ANA_CODE := TXT_ANA_CODE. The two variable are initialized in Header Block. No problem for this.
    2) The other Where clause depend from an other variable of the Header Block . For example:
    If :SITUATION = 1 then the clause must be AND DOC_PAID <> 0
    if :SITUATION = 2 then the clause must be AND DOC_PAID = 0
    if :SITUATION = 3 then the clause must be AND DOC_INS <> 0
    Is possible to create a unique Where clause with this conditions ? If Yes How?
    I hope...
    Best Regards
    Gaetano

    and abs(sign(doc_paid)) = abs(sign(:situation-2))Also beware when you are using the where clause property in Forms. Make sure you refer to the Forms-fields and not to its contents.
    So use 'field1 = :block.item1' and not 'field1 = ' || :block.item1
    The first one used bind variables and will therefore share the plan of the query stored in the library cache, the latter one doesn't and will leave you with lots of unique statements that will thrash your shared_pool and will ultimately kill the performance.
    Regards,
    Rob.

  • How to reverse where clause condition? please

    Hello Good Morning,
    i have below query which is working fine,
    update t
    set skipjet='Yes'
    from  mytable t join mychildtable C on t.ssn=c.ssn
    where
    t.ChannelCd ='OB Calls' AND t.PlanBlance BETWEEN c.MinSalary  AND  c.MaxSalary
    but my problem here is, i have to set skipjet='Y' when the above where clause not met (like opposite way)
    Please advise?
    Thank you in Advance
    Asita

    Dear Milano, 
    I did an example and i got the result that you needed.
    declare @mytable table (ssn int,ChannelCd varchar(50),PlanBlance money,skipjet varchar(3))
    declare @mychildtable table (ssn int,MinSalary money,MaxSalary money)
    insert into @mytable(ssn,ChannelCd,PlanBlance,skipjet) values (1,'OB Calls',800.00,'NO')
    insert into @mytable(ssn,ChannelCd,PlanBlance,skipjet) values (1,'OB Calls2',800.00,'NO')
    insert into @mychildtable(ssn,MinSalary,MaxSalary)values(1,600.00,800.00)
    update t set skipjet='Yes'
    from
    @mytable t
    where
    not exists (
    Select * from
    @mychildtable C
    where
    t.ssn=c.ssn and
    t.ChannelCd ='OB Calls' AND
    t.PlanBlance BETWEEN c.MinSalary AND c.MaxSalary
    Select * from @mytable
    Result:
    ssn         ChannelCd                                      PlanBlance           skipjet
    1           OB Calls                                           800,00                NO
    1           OB Calls2                                         800,00                Yes
    (2 row(s) affected)
    Ricardo Lacerda
    Don't forget to mark helpful posts, and answers. It helps others to find relevant posts to the same question.

  • Need comment on WHERE clause

    i want to know in what order conditions in where clause evaluates.
    select * from table
    where emp_id
    and tran_year
    and tran_mon
    select * from table
    where tran_mon
    and tran_year
    and emp_id
    consider tran_year, tran_mon , emp_id are primary key and table having record month wise , and consider employees are 50,000, so for one month 50000 record will be there .
    so i believe 2nd query will faster than 1st one , becse oracle read from bottom so it will first filter acording emp_id .Please tell me if i m wrong

    user12108669 wrote:
    thanx for reply
    but in very simple case like this one , in which we have only primary key ,, and only one table ,, in that case also order will be ignored .?Yes especially for the simple cases the order is of no relevance.
    If you join more then 10 tables the number of permutations for those tables (all combinations) will be quite big. There is a (undocumented) parameter that influences the CBO on how many tables/permutations it will try. This influences the parsing time of the query. But for simple queries such a thing has absolutly no consequence.
    Sorry I was talking about having multiple tables in the FROM clause. Not about multiple condition in the where clause. The main thing still is identical. The order has no real relevance. CBO will choose an order mostly depending on index usage. There could be more complexe example where the order might get some importance again, but those are extremly special cases (I think jonathan lewis once showed such an example) Difficult to dig it up now.
    Edited by: Sven W. on Dec 2, 2010 3:19 PM
    Edited by: Sven W. on Dec 2, 2010 3:20 PM

  • Where clause condition

    How many conditions can will be applied in where clause and what is the maximum length for where condition?

    eda58bb6-6d5c-460a-9684-4302e17fa5c7 wrote:
    Thanks someoneElse for swift response. In this link it is not their.. WHERE CLAUSE Maximum length and maximum conditions.
    unwilling or incapable to use GOOGLE yourself?
    Ask Tom &amp;quot;maximum length of sql statement&amp;quot;
    BTW - there is no separate & distinct limit for the WHERE clause
    unless you what to consider below
    Subqueries
    Maximum levels of subqueries in a SQL statement
    Unlimited in the FROM clause of the top-level query255 subqueries in the WHERE clause"

  • Need logic for WHERE-clause

    Hi,
    I have a selet statement where i need to write below logic .
    SELECT bldat xblnr kunnr rstgr xref1 xref2
               bukrs belnr blart wrbtr waers shkzg
               buzei zfbdt dmbe2 sgtxt augbl augdt
               zbd1t zbd2t
          FROM  bsid
          INTO CORRESPONDING FIELDS OF TABLE int_output
          WHERE bldat IN so_bldat AND
                   shkzg IN so_shkzg AND
                    wrbtr IN so_wrbtr.      
    Range needs to be  entered where from value (for wrbtr field) is -ve negative and to value is +ve positive e.g., -1000 to +200 -:in this case go to BSID with value from 0 to 1000 with debit/credit indicator H and again 0 to 200 with debit/credit indicator S..
    can somebody tell me how to set range for the above requirement.
    Really need help.
    Edited by: Thomas Zloch on May 25, 2011 3:27 PM

    change:
    AND
    shkzg IN so_shkzg AND
    wrbtr IN so_wrbtr.
    to
    and  ( (SHKZG eq 'H' and wrbtr le 1000 ) or
              (SHKZG eq 'S' and wrbtr le 200 ) ).  ??

  • Need help using WITH clause

    I have an update statement that is using the same suquery twice.
    I am not usre if WITh clause be used in update statements?
    Is there a way the below statement can be modified to use WITH clause?
    UPDATE EMP_TRACKING_LIST L
    SET ACTIVE_FLAG = DECODE((SELECT COUNT(*)
    FROM EMP_TRACKING_LIST L2
    WHERE L.NAME = L2.NAME AND
    L.EMP_CODE = L2.EMP_CODE AND
    L2.EMP_FLAG = 'Y'), 0, 'N', 'Y')
    WHERE ACTIVE_FLAG != DECODE((SELECT COUNT(*)
    FROM EMP_TRACKING_LIST L2
    WHERE L.NAME = L2.NAME AND
    L.EMP_CODE = L2.EMP_CODE AND
    L2.EMP_ACTIVE_FLAG = 'Y'), 0, 'N', 'Y')
    OR EMP_ACTIVE_FLAG IS NULL;
    I would really appreciate your input
    Edited by: user10937534 on Sep 2, 2009 4:47 PM

    Hi,
    WITH comes immediately before SELECT, not before UPDATE.
    To use WITH in an UPDATE statement, you would say something like:
    UPDATE  EMP_TRACKING_LIST  L
    SET     ACTIVE_FLAG =
            WITH  sub_q  AS
                SELECT  ...
            SELECT  ...
            FROM    sub_q  ...
    ;I don't think there's any way to use values from the sub-query in the WHERE clause of the UPDATE statement itself; MERGE is a much better bet for eliminating redundancy there.
    Sorry, I'm not at a database now, so I can test anything.

  • Need help to check multiple conditions and set AD user properties

    hello All,
    I have a data csv sheet where information as follows, using below information I need to update AD account attributes based on below conditions . I have full right and I can set any user properties. So this is not access right issue.   
    samaccountname,Othertelephone,language,employeeId
    abcd                      XXXXXXXXX     EN         SMS
    Now I need to check following conditions:
    Othertelephone =  if this should not be blank ,if so display message " filed is blank " and no changes should allowed in further attributes and  it should abort
    language= this field should only contain  EN or FR value if No display msg " error in language field " and no further changes to  the user attributes and it should abort
    employeeID= this field should only contain OTP or SMS value if Not filled display msg " error in Employee ID field " No further changes to the user attributes and it should abort
    changes to user will permit  when all attributes is filled. I do the testing taking samaccountname , othertelephone and employeeId into consideration but it did not helped. Getting error
    THIS is complete Code Of my Task where you need my focus on conditions
    group=Get-QAdGroup -SearchRoot  "domain/vpn group"
    Import-Csv D:\VPN.csv |
    ForEach-Object{
    if ($_.samaccountname -eq "")
       Write-Host "SAMACCOUNTNAME is blank"   -fore red
    else
     $user=Get-QAduser $_.samaccountname
    if ($user.memberof -contains  $group.DN)
     Write-Host "$($_.Samaccountname) user is allready a member" -fore red
    else
     Add-QADGroupMember $group $_.Samaccountname
    If ($_.othertelephone -eq "")
    Write-Output "$($_.samaccountname) telephone Number is blank"
    else
    if ($_.EmployeeID -notmatch 'OTP' -and 'SMS')
    Write-Output "$($_.samaccountname) EmployeeID field is not correctly field")
    Else
    Set-QADUser $_.SamAccountName -ObjectAttributes @{telephonenumber=$_.othertelephone;EmployeeID=$_.EmployeeID}
    error
    Set-QADUser : Access is denied.
    At C:\Users\g512263\AppData\Local\Temp\5f8facb6-f942-4c3d-b924-8953d9a706da.ps1:37 char:8
    +                    Set-QADUser $_.SamAccountName -ObjectAttributes @{telephonenumber=$_.othe ...
    +    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [Set-QADUser], UnauthorizedAccessException
        + FullyQualifiedErrorId : System.UnauthorizedAccessException,Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.SetUserCm
       dlet

    <title>Untitled - PowerGUI Script Editor</title>
    Hello JRV,Thank you for your time, There is no comma in my csv file , I double check. below I wrote a simple code.I removed all the conditions and just try to set the EmployeeID and it is working fine with same file.But as soon as I add conditions it gives access denied. as well as if I remove employee Id from your previous code and only try to set telephone No. still it gives access denied.I am just trying to figure out what is causing this.
    $group=Get-QAdGroup -SearchRoot "com/Group"
    Import-Csv D:\VPN.csv |
    ForEach-Object{
    if ($_.samaccountname -eq ""){
    Write-Host "SAMACCOUNTNAME is blank" -fore red
    }else{
    $user=Get-QAduser $_.samaccountname
    if ($user.memberof -contains $group.DN){
    Write-Host "$($_.Samaccountname) user is allready a member" -fore red
    }else
    Add-QADGroupMember $group $_.Samaccountname
    If ($_.othertelephone -ne "")
    Set-QADUser $user.SamAccountName -ObjectAtt Aributes @{telephonenumber=$_.othertelephone}
    } else
    Write-Output "$($_.samaccountname) phonenumber is blank"
    If ($_.EmployeeID -ne "")
    Set-QADUser $_.SamAccountName -ObjectAttributes @{EmployeeID=$_.EmployeeID}
    }else
    Write-Output "$($_.samaccountname) EmployeeID field is blank"
    If ($_.Preferredlanguage -ne "")
    Set-QADUser $_.SamAccountName -ObjectAttributes @{Preferredlanguage=$_.preferredlanguage}
    } else
    Write-Output "$($_.samaccountname) PreferredLanguage field is blank"

  • Need help in 'WITH CLAUSE' Query

    Hello Gurus,
    I am trying to calculate the count of distinct members for each provid.
    I am using the with clause to get information regarding the provid.
       WITH T AS
      (SELECT a.UD_ID MRR_ID,
                            A.UD_LASTNAME LAST_NAME,
                            A.UD_FIRSTNAME FIRST_NAME,
                            COUNT(DISTINCT DP.PA_PROVIDERID) PROVIDERS_ASSIGNED
                       FROM (SELECT UD.UD_ID,
                                    UD_LASTNAME,
                                    UD_FIRSTNAME
                               FROM USER_DETAILS       UD,
                                    MAP_USERS_TO_ROLES MR
                              WHERE MR.MUR_UR_ID_REF = 1000
                                AND MR.MUR_UD_ID_REF = UD.UD_ID) A,
                            D4C_PROVIDER_ASSIGNMENT DP
                      WHERE A.UD_ID = DP.PA_ASSIGNEDTO
                      AND dp.pa_status ='A'
                      GROUP BY A.UD_ID,
                               A.UD_LASTNAME,
                               A.UD_FIRSTNAME
                      ORDER BY 3 DESC)    OUTPUT of just above query without WITH clause.
    MRR_ID     LAST_NAME     FIRST_NAME     PROVIDERS_ASSIGNED
    1229    mrrTest         mrrTest         4
    1228    mrr2Last        mrr2First       5
    1230    mrr1Last        mrr1First       7
    1226    Panwar          SIngh           1
    1181    MRRLast         MRRTest         4
    1221    One             MRR             1
    1322    Thakuria        Bibhuthi        2I am creating this and get all the information to show on front end. Now I want to calculate the no of members as per the providers assigned for each MRR_ID
    Below query show the no of members for all the providers assigned to a provider.
    ex:
    SELECT * FROM (   
    SELECT COUNT(DISTINCT dmpc_hicn) countmember
    FROM D4C_HICN_PROVIDER_claims  a WHERE trim(DPMC_PROVIDER_NO) IN 
    (SELECT trim(pa_providerid)
       FROM d4c_provider_assignment
       WHERE pa_assignedto = 1181  (mrr_id)    --here i have use the mrrid from with clause and get the member count with all the columns coming from WITH CLAUSE.
       AND pa_roleid = 1000
       AND PA_STATUS ='A'
    GROUP BY a.dmpc_ss_id_ref)Right now I am using materialized view i dont wanna use the same..
    I am sending the materialized view code as well what i am doing ..
    ( SELECT SUM(member_count)member_count_bynpi ,mrr_id  FROM (
    (SELECT count(DISTINCT hp.dmpc_hicn) member_count,hp.DMPC_SS_ID_REF ,a1.ud_id mrr_id FROM  D4C_HICN_PROVIDER_claims hp ,
    (SELECT   a.UD_ID ,DP.PA_PROVIDERID
         FROM (SELECT UD.UD_ID, UD_LASTNAME, UD_FIRSTNAME
                 FROM USER_DETAILS UD, MAP_USERS_TO_ROLES MR
                WHERE MR.MUR_UR_ID_REF = 1000
                  AND MR.MUR_UD_ID_REF = UD.UD_ID) A,
              D4C_PROVIDER_ASSIGNMENT DP
        WHERE A.UD_ID = DP.PA_ASSIGNEDTO
        AND dp.pa_status ='A'
        /*AND dp.PA_ASSIGNEDTO = 1221*/) a1
        WHERE trim(a1.PA_PROVIDERID) = trim(hp.dpmc_provider_no)
        GROUP BY a1.ud_id,hp.DMPC_SS_ID_REF))
        GROUP BY mrr_id)Please help me to write the code with the materialized view. Thanks in Advance.
    Kind regards,
    UP
    Edited by: BluShadow on 22-Aug-2011 07:58
    fixed {noformat}{noformat} tags.  Please use lowercase "code" rather than uppercase "CODE" in the tags.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Probably, this may help
    WITH T1 as(
               SELECT UD.UD_ID,
                      UD_LASTNAME,
                      UD_FIRSTNAME
                FROM USER_DETAILS UD, MAP_USERS_TO_ROLES MR
                WHERE MR.MUR_UR_ID_REF = 1000
                AND MR.MUR_UD_ID_REF = UD.UD_ID)
          T2 as (SELECT a.UD_ID ,DP.PA_PROVIDERID
                 FROM T1 A, D4C_PROVIDER_ASSIGNMENT DP
                 WHERE A.UD_ID = DP.PA_ASSIGNEDTO
                 AND dp.pa_status ='A')
           T3 as(SELECT count(DISTINCT hp.dmpc_hicn) member_count,
                              hp.DMPC_SS_ID_REF ,
                               a1.ud_id mrr_id
                  FROM T2 A1 ,D4C_HICN_PROVIDER_claims hp
                  WHERE trim(a1.PA_PROVIDERID) = trim(hp.dpmc_provider_no)
                  GROUP BY a1.ud_id,hp.DMPC_SS_ID_REF)
    SELECT SUM(member_count)member_count_bynpi ,mrr_id from T3
    GROUP BY mrr_id

  • Need help to solve if condition

    Hi All,
    I need to resize the images to thumbnail veiw the condition is width should not exceed 75 pixels and height should not exceed 50 pixels
    app.preferences.rulerUnits = Units.PIXELS     
         var Wid = docRef.width;
         var Hig = docRef.height;
                    if (Number(Wid) > 75)
                             docRef.resizeImage(75,null,);                 
                    else if(Number(Hig) >= 50)
                            docRef.resizeImage(null,50,);
    This works fine, but if the images are width 85 and hieght 200 px
    The result is (75,176).  which is wrong.
    Please help me to solve
    regards,
    Vinoth

    What you were doing is also what Fit image plug-in script does and scripts like the Image processor does to resize images to fit within some pixels area while maintaining the images aspect ratio. Fit an image into some pixel width and into some pixel height. In fact the images processor uses the Fit Image plugin script to do the work. Here is that code from the Image processor script
    // use the fit image automation plug-in to do this work for me
    function FitImage( inWidth, inHeight ) {
              if ( inWidth == undefined || inHeight == undefined ) {
                        alert( strWidthAndHeight );
                        return;
              var desc = new ActionDescriptor();
              var unitPixels = charIDToTypeID( '#Pxl' );
              desc.putUnitDouble( charIDToTypeID( 'Wdth' ), unitPixels, inWidth );
              desc.putUnitDouble( charIDToTypeID( 'Hght' ), unitPixels, inHeight );
              var runtimeEventID = stringIDToTypeID( "3caa3434-cb67-11d1-bc43-0060b0a13dc4" );
              executeAction( runtimeEventID, desc, DialogModes.NO );

Maybe you are looking for