Grouping Inner Query based on a column.Please help

I have a strange query.
I am using Subquery to display the count of rows from the inner query
depending upon the value of 'Y' or 'N'
Trade
id_entity       id_inst_code_type   id_inst_code   dt_trade
AGL            SE                  5660249        10-Feb-06
AGL            SE                  5660249        13-Feb-06
AGL            SE                  5660249        13-Feb'06
Instrument_xref
ID_inst      id_inst_xref_type     id_inst_xref  flg_active
0029010             SE          5660249          Y
0070789          SE          5660249          Y
0071190          SE          5660249          Y
0072385          SE          5660249          Y
0073215          SE          5660249          Y
0084797          SE          5660249          Y
0091375          SE          5660249          Y
0094690          SE          5660249          Y
0104438          SE          5660249          Y
My output:
id_inst_code_type          id_inst_code   Earliest    Latest       Total    Active
SE                         5660249       10 Feb 06   13 Feb 06    3        9
2) If all the 'flg_active' column in Table Instrument_xref is set to 'N'
   the Active should be 0.
3) Assume that the flg_active could be 3 Y's and 6 N's then what?
id_inst_code_type          id_inst_code   Earliest    Latest       Total    Active
SE                         5660249       10 Feb 06   13 Feb 06    3        0
How do I check for the 'Y' or 'N' value in my code below ?
Help appreciated as the the functionality changes by the hour...
select    tie.id_entity             'Entity',
          tie.id_inst_code          'Inst Code',
          min(tie.dt_trade)         'Earliest',
          max(tie.dt_trade)         'Latest',
          count(*)                  'Total',
          dt.InnerTotal             'Active'   
from     trade_input_event tie,
(Select  insx.id_inst_xref_type,
               insx.id_inst_xref,
               insx.flg_active,
               count(*) InnerTotal
  from instrument_xref insx
  where insx.id_inst_xref = '5660249'
  ---** Do I need to Check the flg_active here..
  ---** Do I need to use the Having clause here? ie having count(insx.id_inst_xref) = 'N'
   group by insx.id_inst_xref_type,insx.id_inst_xref,insx.flg_active) dt
  where tie.id_inst_code = dt.id_inst_xref
  and tie.id_entity = 'AGL'
  group by tie.id_entity, tie.id_inst_code_type,tie.id_inst_code

As the flg_active is set to 'Y', I am trying to set it to 'N' in the query
so that count of 0 is returned, but this displays nothing.
Please help as to how to display a count(*) of 0 when the flg_active is 'N'??
Select  insx.id_inst_xref_type,
               insx.id_inst_xref,
               insx.flg_active,
               count(*) InnerTotal
  from instrument_xref insx
  where insx.id_inst_xref = '5660249'
  and insx.flg_active = 'N'
  group by insx.id_inst_xref_type,insx.id_inst_xref,insx.flg_active) dt

Similar Messages

  • Help - Tuning query based on status column

    Hi,
    I have a query wherein I need to fetch records based on the values in the status column. It can hold values 'A' and 'P'. A record can have an 'A' record and a 'P' record. My conditions are,
    1) When only 'A' record is there, then return 'A' record,
    2) When 'A' and 'P' record is there, then return 'A' record,
    3) When 'P' record only is there, then return 'P' record.
    There are approx. 3 lac 'A' records and 3K 'P' records. I tried using "with" clause queries but the performance is too bad and I am not able to use it. When executing as standalone queries 'A' records retrieval is faster as compared to 'P' records. When executing in "with" clause the query hangs. Can someone please help how this can be handled?
    Due to restrictions, I will not be able to post the actual code. I am posting a sample here.
    Sample code:
    WITH q1 AS
         (SELECT *
            FROM tab
           WHERE status = 'A'),
         q2 AS
         (SELECT *
            FROM tab
           WHERE status = 'P'),
         q3 AS
         (SELECT *
            FROM q1
          UNION ALL
          (SELECT *
             FROM q2
            WHERE NOT EXISTS (SELECT 1
                                FROM q1)))
    SELECT *
      FROM q3
    WHERE ROWNUM < 501;Thanks,
    Vijay K

    Vijay K wrote:
    Hi,
    I have a query wherein I need to fetch records based on the values in the status column. It can hold values 'A' and 'P'. A record can have an 'A' record and a 'P' record. My conditions are,
    1) When only 'A' record is there, then return 'A' record,
    2) When 'A' and 'P' record is there, then return 'A' record,
    3) When 'P' record only is there, then return 'P' record.
    There are approx. 3 lac 'A' records and 3K 'P' records. I tried using "with" clause queries but the performance is too bad and I am not able to use it. When executing as standalone queries 'A' records retrieval is faster as compared to 'P' records. When executing in "with" clause the query hangs. Can someone please help how this can be handled?Complicated problem!
    Here are some ideas:
    1. Use subqueries to avoid 'P' rows when corresponding 'A' rows exist. The EXISTS operator should be efficient if the lookup columns in the subquery are indexed.
    2. Get lists of 'A' and 'P' records and use set operators UNION and/or MINUS to include/exclude the rows you want - if you don't have to include the 'A' /'P' values themselves

  • Search criteria is not working in Responsible Group field in sap crm could you please help me this how to achieve.

    search criteria is not working in Responsible Group field in sap crm could you please help me this how to achieve.I have writen code on EH_ONSEARCH .as per below...what changess i need to do..and through partner function and adding the selection params please send the sample .
    code. partner funtction - ZRG DATA :
    DATA : lv_partner_fct type .
    types: begin of ty_resp,
           partner    type but000-partner,
           name_last  type but000-name_last,
           name_first type but000-name_first,
           mc_name1   type but000-mc_name1,
           mc_name2   type but000-mc_name2,
           end of ty_resp.
    DATA: lv_resp_bp type STANDARD TABLE OF ty_resp INITIAL SIZE 0,
           lw_resp_bp type ty_resp.
    IF lv_attr_name = 'Rgroup'.
    lr_entity->get_property_as_value( EXPORTING iv_attr_name = if_crm_srqm_uiu_const=>gc_attr_low
                                       IMPORTING ev_result = lv_low ).
    IF lv_low IS INITIAL.
    SELECT partner
           name_last
           name_first
           mc_name1
          mc_name2
    FROM but000 INTO table lv_resp_bp
    WHERE mc_name2 = lv_low and bu_group = '0010'.
    loop at lv_resp_bp into lw_resp_bp.
        lv_low = lw_resp_bp-mc_name2.
      lr_query_service2->add_selection_param( iv_attr_name = 'Rgroup'
                                                iv_sign = lv_sign
                                                iv_option = lv_option
                                                iv_low = lv_low
                                                iv_high = lv_high ).
      ENDLOOP.
    if lv_partner_fct = 'ZRG'.
      lr_entity = lr_iterator->get_next( ).
    CONTINUE.
    ENDIF.
    lv_attr_name = 'BU_PARTNER'.
    ENDIF.

    <b>You can acheive   this .... first by creating the search help exit    ... by  creating the maintaince  view   then   using it in the   Creation of the search help </b> ...
    see the link for attaching the view   to the serach help .
    <a href="http://">http://www.sapdevelopment.co.uk/dictionary/shelp/shelp_elementary.htm</a>
    reward  points if it is usefull...
    Girish

  • Sql query for quarter data..Please help

    Dear Experts,
    Please help with this query...
    i have data like below:
    Year
    Quarter
    MRR
    MRR%
    2012
    Q1
    10
    Q2
    30
    Q3
    50
    Q4
    60
    2013
    Q1
    20
    Q2
    30
    Now i need to caluclate MRR % column values as below
    for 2012 Q2 MRR % = (Q2MRR-Q1MRR)/Q1*100 that is (30-10)/10*100
    for 2012 Q3 MRR % = (Q4MRR-Q3MRR)/Q2*100
    for 2012 Q4 MRR %=  (Q1MRR-Q4MRR)/Q1*100  here q1 of 2013 and q4 of 2012...
    like this it wll go on..
    Please help with me query compute values in MRR % column.
    Best regards
    asp

    Maybe NOT TESTED! No Database at hand
    select year,quarter,mrr,
           ratio_to_report(q_mrr) over (partition by year order by quarter) pct_mrr
      from (select year,quarter,mrr,
                   mrr - lag(mrr,1,0) over (partition by year order by quarter) q_mrr
              from t
    Regards
    Etbin

  • Error when splitting a Table into two columns - Please help!

    Hi!
    I have created a table in which I have created a header which has been split into 3 parts conisting of 2 columns. These all work fine. However, when I try to split the row below the header row into 2 columns, it does so but, in a way, connects the line inbetween the two columns with the line inbetween the two columns above and will not allow me to move it left or right by manually changing specs or dragging the line. Please help! (I'm using CS5 by the way!) Thank you!

    I suggest you begin with a pre-built CSS Layout.  DW has several to help jump start your projects.  Go to File > New Blank Page > HTML.  Select a layout from the 3rd panel and hit CREATE.  See screenshot.
    Save this layout as test.html and begin building your prototype page saving and validating code often during your work sessions.
    Code Validation Tools
    CSS - http://jigsaw.w3.org/css-validator/
    HTML - http://validator.w3.org/
    Good luck with your project!
    Nancy O.

  • A query on Flexfield and valuesets.Please help me in sorting out

    We have created a structure in descriptive flexfield with 4 to 5 segments. Among those one segment has a value set with independent validation type. And all the other segments have value set with dependent validation type on the first segment.
    Now the requirement as per client is as follows:
    If first segment is taken as YES, all the other segments are to be displayed and enabled. If it is NO, then all the segments have to disabled.
    We are able to get it in case of YES but if it is NO, all the segments are being displayed.But we even want them to disable or display off.
    Please help me out in sorting out this issue.

    Hi,
    I don't think thats possible, when you have a valueset in which you are referencing a previous parameter using the $FLEX.<Parameter_name> property, apps automatically sets the dependency. The dependent item is automatically enabled as soon as you enter a value in the dependable field. There is no way to set this dependency conditionally.
    What you can do instead is change the query of your valuesets so that it does not have any records
    i.e $FLEX.<Parameter> = 'YES'
    Regards,
    Vikash
    oraclehrmsways.blogspot.com
    Message was edited by:
    vsethi

  • Need query to find repeating values, please help

    I need help with SQL or whatever you guys think is the best way to do this, maybe PL/SQL.
    Basically it like this, in the database 10G, there are two field for address:
    ADDESS_DELVRY - street address for example would be stored here
    ADDESS_DELVRY2 - apartment building, suite number or PBM would be stored here
    but sometimes I see the Apartment B-123 in both fields, so I need to find those duplicates, if there is a way.
    So for example:
    ADDESS_DELVRY - 123 Elm Street Apartment 2B
    ADDESS_DELVRY2 - Apartment 2B
    This is a problem, because then the Apartment gets printed twice on the mail piece. I think there is a small percentage that have this problem and am trying to find out the best way to ID them, maybe use REG_EXP ??
    Not sure, please help, thanks!

    Soundex works how it's designed to work, which unfortunately is a very poor approximation at words sounding the same.
    Using the UTL_MATCH package is a far better way to check for similarity between strings.
    Ok. Given the OPs challenge here; a simple, or messy (we don't know), data cleaning task, I think soundex was worth mentioning.
    Also, the reply that "soundex don't [doesn't] work" , given a working example , I think we can safely conclude
    that UTL_MATCH is way above his league.
    I don't understand how the OP has better use of
    SELECT UTL_MATCH.EDIT_DISTANCE('Second Avenue 12 second floor', 'second fl.') dist FROM DUAL;
          DIST
            20
    1 row selected.than
    SELECT *
      FROM dual
    WHERE SOUNDEX ('Second Avenue 12 second floor') = SOUNDEX ('second fl.')
    X
    1 row selected.given the task at hand, but all right I'm not going to argue either.

  • Urgent! group by query based on a logical OR (bitwise)

    Let's say I have the following table:
    field: f1 f2 f3 f4 f5
    record 1: a a 1 0 4
    record 2: a b 2 3 7
    record 3: a b 0 8 1
    I want to make a group by on f1 so that I get just one record which is:
    field: f1 f3 f4 f5
    record 1: a 3 11 7
    where the result of each field is actually a group by based on a logical OR (bitwise)
    ie:
    3 = 1 or 2 or 0
    11 = 0 or 3 or 8
    7 = 4 or 7 or 1
    any suggestion ?
    Thank you

    You can try using DECODE
    e.g.
    Select F1,
                Sum( Decode( F3, 1,1,  2,2,  0) ) F3,
                Sum( Decode( F4, 3,3,  8,8,  0) ) F4,
                Sum( Decode( F5, 7,7,   0) ) F5
      from your_table
    group by F1
    I want to make a group by on f1 so that I get just one record which is:
    field: f1 f3 f4 f5
    record 1: a 3 11 7
    where the result of each field is actually a group by based on a logical OR (bitwise)
    ie:
    3 = 1 or 2 or 0
    11 = 0 or 3 or 8
    7 = 4 or 7 or 1
    any suggestion ?
    Thank you

  • Dynamic group membership Query based on alert description - IS package failed

    Hi there all good people,
    Ive got the following case:
    i need to filter out some of the alerts raised bij the is package failed Alert rule.
    All allerts raised need a override accept two alerts with a specific description. example:
    Alert description: Package "Full Back-Up" failed.  should still raise an alert also the
    Alert description: Package "Full Db Back-Up" failed.
    I.m playing arround with dynamic groups. Can somebody give me some pointers?
    Or do i need to create an new alert rule? en override this one for all objects?
    I hope the question is clear, im no native english speaking

    Hi,
    I would like to suggest you override this one for all objects and then create a new alert rule based on your requirement.
    Regards,
    Yan Li
    Regards, Yan Li

  • How to achieve grouping of data based on one column

    Hello PL/SQL Gurus/experts,
    I am using Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production version
    I have following table -
    DROP TABLE T2;
    create table T2(Manager,Employee) as select
    'Nikki','Ram' from dual union all select
    'Nina', 'Rita' from DUAL union all select
    'Mike', 'Radha' from dual union all select
    'Michael', 'Ratnam' from DUAL union all select
    'Hendi', 'Ratna' from dual union all select
    'Robert', 'Raman' from dual union all select
    'Maria', 'Rolly' from dual union all select
    'Kistrien', 'Rachna' from dual union all select
    'Andrew', 'Ritvik' from dual union all select
    'Emma', 'Ramesh' from dual union all select
    'Andy', 'Ranpal' from dual union all select
    'Brandy', 'Raunak' from dual union all select
    'Nikki','Shyam' from dual union all select
    'Nina', 'Sita' from DUAL union all select
    'Mike', 'Sadhna' from dual union all select
    'Michael', 'Satnam' from DUAL union all select
    'Hendi', 'Satna' from dual union all select
    'Robert', 'Samar' from dual union all select
    'Maria', 'Sameer' from dual union all select
    'Kistrien', 'Samrachna' from dual union all select
    'Andrew', 'Satvik' from dual union all select
    'Emma', 'Somesh' from dual union all select
    'Andy', 'Sonpal' from dual union all select
    'Brandy', 'Samar' from dual union all select
    'Emma', 'Piyush' from dual union all select
    'Andy', 'Pavan' from dual union all select
    'Brandy', 'Paramjeet' from dual;Expected output -
    Manager          Employee
    Nikki
              Ram
              Shyam
    Nina           Rita
              Sita
    Mike           Radha
              Sadhna
    Michael      Ratnam
              Satnam
    Hendi           Ratna
              Satna
    Robert          Raman
              Samar
    Maria          Rolly
              Sameer
    Kistrien     Rachna
              Samrachna
    Andrew          Ritvik
              Satvik
    Emma          Ramesh
              Somesh
              Piyush
    Andy          Ranpal
              Sonpal
              Pavan
    Brandy          Raunak
              Samar
              ParamjeetI thank to all of you in advance for your valuable time and inputs

    In SQL, something like this...
    SQL> ed
    Wrote file afiedt.buf
      1  select case when row_number() over (partition by emp.manager order by employee) = 1 then
      2           mgr.manager
      3         else
      4           null
      5         end as manager
      6        ,emp.employee
      7  from (select distinct manager from t2) mgr
      8       join t2 emp on (mgr.manager = emp.manager)
      9* order by mgr.manager, emp.employee
    SQL> /
    MANAGER  EMPLOYEE
    Andrew   Ritvik
             Satvik
    Andy     Pavan
             Ranpal
             Sonpal
    Brandy   Paramjeet
             Raunak
             Samar
    Emma     Piyush
             Ramesh
             Somesh
    Hendi    Ratna
             Satna
    Kistrien Rachna
             Samrachna
    Maria    Rolly
             Sameer
    Michael  Ratnam
             Satnam
    Mike     Radha
             Sadhna
    Nikki    Ram
             Shyam
    Nina     Rita
             Sita
    Robert   Raman
             Samar
    27 rows selected.If you want the managers on their own row with the employees underneath then you'll have to fudge it.
    SQL> ed
    Wrote file afiedt.buf
      1  select case when row_number() over (partition by emp.manager order by employee nulls first) = 1 then
      2           mgr.manager
      3         else
      4           null
      5         end as manager
      6        ,emp.employee
      7  from (select distinct manager from t2) mgr
      8       join
      9       (select distinct manager, null as employee from t2
    10        union all
    11        select manager, employee from t2
    12       ) emp on (mgr.manager = emp.manager)
    13* order by mgr.manager, emp.employee nulls first
    SQL> /
    MANAGER  EMPLOYEE
    Andrew
             Ritvik
             Satvik
    Andy
             Pavan
             Ranpal
             Sonpal
    Brandy
             Paramjeet
             Raunak
             Samar
    Emma
             Piyush
             Ramesh
             Somesh
    Hendi
             Ratna
             Satna
    Kistrien
             Rachna
             Samrachna
    Maria
             Rolly
             Sameer
    Michael
             Ratnam
             Satnam
    Mike
             Radha
             Sadhna
    Nikki
             Ram
             Shyam
    Nina
             Rita
             Sita
    Robert
             Raman
             Samar
    39 rows selected.

  • Query strange behaviour...please help...

    Dear All,
    I do have one query having two where conditions and group by and an order by ..
    The problem is i run with particular combition of column values in where...oracle is exiting from sqlplus..(i.e disconnected)..
    if i change where cluase combition which working fine...the problem is only for particular combination of where clause columns..(which more than 2 million records)..
    Even i tested saperately the groupby and order by..it is working fine..
    I am using 10g..really dont understand this oracle behaviour..
    Please suggest...
    Thanks
    Onenessboy

    It 's like - you have given all the ingredients and follow the exact process to cook a special item - but forget to open the fire.
    Where is your code? How do we investigate your problem?
    Please post your table's DDL and some test data in form of DML and also post your exact DB version with proper format.
    Got me?
    Regards.
    Satyaki De.

  • Query Filling up Temp DB --Please Help

    Friends,  when I execute this proc it fills up the temp db very quickly.  Could you guys please take a look at the attached script and help me 
    Create PROCEDURE Test
    @loginid INT,
    @companyid INT,
    @streetnumber nvarchar(50) = NULL,
    @streetname nvarchar(50) = NULL,
    @city nvarchar(50) = NULL,
    @zip nvarchar(50) = NULL,
    @lastname nvarchar(50) = NULL,
    @firstname nvarchar(50) = NULL,
    @companyname nvarchar(50) = NULL,
    @builder nvarchar(50) = NULL,
    @lotnumber nvarchar(50) = NULL,
    @subdivision nvarchar(50) = NULL,
    @showaccount bit,
    @showsite bit,
    @activeonly bit = NULL,
    @branchType int,
    @BranchIndex int,
    @prgActive bit = NULL,
    @prgCancel bit = NULL,
    @prgPendingCancel bit = NULL,
    @siteNational bit = NULL,
    @siteResidential bit = NULL,
    @siteCommercial bit = NULL,
    @prgPC bit = NULL,
    @prgTCTB bit = NULL,
    @prgPCTCTB bit = NULL
    AS
    BEGIN
    DECLARE @sql nvarchar(MAX),
    @paramlist nvarchar(4000)
    SELECT @sql =
    N' SET NOCOUNT ON
    CREATE TABLE #temp
    accountid int, siteid int, contactid int,phoneid int,addressid int, haspc bit, hastctb bit, branchid int
    create index tmpaccountid on #temp(accountid)
    create index tmpsiteid on #temp(siteid)
    create index tmpcontactid on #temp(contactid)
    create index tmpphoneid on #temp(phoneid)
    create index tmpaddressid on #temp(addressid)
    create index tmpbranchid on #temp(branchid)
    IF @showaccount=1 BEGIN
    INSERT INTO #temp (accountid,siteid,contactid,phoneid,addressid,branchid)
    SELECT distinct taccount.accountid, isnull(taccountsite.siteid,0), tcontact.contactid,
    tcontactphonenumber.phoneid,taddress.addressid, taccount.billingcenterid
    FROM taddress with (nolock) INNER JOIN
    taccount with (nolock) ON taddress.addressid = taccount.billingaddressid INNER JOIN
    tlogincompanybranch ON taccount.billingcenterid = tlogincompanybranch.branchid INNER JOIN
    tcontact ON taccount.primarycontactid = tcontact.contactid LEFT JOIN
    tcontactphonenumber ON tcontactphonenumber.phoneid = tcontact.primaryphoneid
    LEFT JOIN taccountsite ON taccountsite.accountid = taccount.accountid
    LEFT JOIN tsite ON taccountsite.siteid = tsite.siteid
    if (@builder is not null) or (@lotnumber is not null) or (@subdivision is not null)
    begin
    SELECT @sql = @sql + ' LEFT JOIN tbuilder on tsite.builderid = tbuilder.builderid
    LEFT JOIN tcontact bc ON tbuilder.primarycontactid = bc.contactid '
    end
    if @branchType = 1
    begin
    SELECT @sql = @sql + ' INNER JOIN testimate est ON est.siteid = tsite.siteid
    INNER JOIN tlogincompanybranch svccenterbranch on est.servicecenter=svccenterbranch.branchid and svccenterbranch.loginid = @loginid '
    end
    SELECT @sql = @sql + ' WHERE taccount.companyid = @companyid and tlogincompanybranch.loginid=@loginid '
    if @branchType = 1 and @branchIndex <> 0
    begin
    SELECT @sql = @sql + ' AND est.servicecenter = @branchIndex '
    end
    if @activeonly is not null
    begin
    SELECT @sql = @sql + ' AND taccount.isactive <> 0 '
    end
    if @lastname is not null
    begin
    SELECT @sql = @sql + ' AND upper(tcontact.lastname) LIKE @lastname + ''%'''
    --SELECT @sql = @sql + ' AND upper(tcontact.lastname) LIKE N' + quotename(@lastname + '%', '''')
    end
    if @firstname is not null
    begin
    SELECT @sql = @sql + ' AND upper(tcontact.firstname) LIKE @firstname + ''%'''
    end
    if @companyname is not null
    begin
    SELECT @sql = @sql + ' AND upper(tcontact.businessname) LIKE @companyname + ''%'''
    end
    if @streetnumber is not null
    begin
    SELECT @sql = @sql + ' AND taddress.streetnumber = @streetnumber '
    end
    if @streetname is not null
    begin
    SELECT @sql = @sql + ' AND upper(taddress.streetname) LIKE @streetname + ''%'''
    end
    if @city is not null
    begin
    SELECT @sql = @sql + ' AND upper(taddress.city) LIKE @city + ''%'''
    end
    if @zip is not null
    begin
    SELECT @sql = @sql + ' AND taddress.postalcode LIKE @zip + ''%'''
    end
    if @builder is not null
    begin
    SELECT @sql = @sql + ' AND upper(bc.businessname) LIKE ''%'' + @builder + ''%'''
    end
    if @lotnumber is not null
    begin
    SELECT @sql = @sql + ' AND upper(tsite.lotnumber) LIKE @lotnumber '
    end
    if @subdivision is not null
    begin
    SELECT @sql = @sql + ' AND upper(tsite.subdivision) LIKE @subdivision + ''%'''
    end
    if (@siteNational is not null) or (@siteResidential is not null) or (@siteCommercial is not null)
    begin
    SELECT @sql = @sql + ' AND ( '
    if @siteResidential is not null
    begin
    SELECT @sql = @sql + ' tsite.propertytype = 1 '
    end
    if @siteCommercial is not null
    begin
    if (@siteCommercial is not null) and (@siteResidential is not null)
    begin
    SELECT @sql = @sql + ' OR tsite.propertytype = 2 '
    end
    else
    begin
    SELECT @sql = @sql + ' tsite.propertytype = 2 '
    end
    end
    if @siteNational is not null
    begin
    if (@siteNational is not null) and ((@siteResidential is not null) or (@siteCommercial is not null))
    begin
    SELECT @sql = @sql + ' OR tsite.propertytype = 5 '
    end
    else
    begin
    SELECT @sql = @sql + ' tsite.propertytype = 5 '
    end
    end
    SELECT @sql = @sql + ' ) '
    end
    if @branchType = 2
    begin
    SELECT @sql = @sql + ' AND taccount.billingcenterid = @BranchIndex '
    end
    SELECT @sql = @sql + ' END '
    SELECT @sql = @sql + ' IF @showsite = 1 BEGIN
    INSERT INTO #temp (accountid,siteid,contactid,phoneid,addressid, branchid)
    SELECT distinct taccountsite.accountid,tsite.siteid,tsite.primarycontactid,
    isnull(tcontactphonenumber.phoneid, 0),taddress.addressid,0
    FROM taccountsite INNER JOIN
    taccount a on a.accountid=taccountsite.accountid INNER JOIN
    tlogincompanybranch on a.billingcenterid=tlogincompanybranch.branchid INNER JOIN
    tsite with (nolock) ON taccountsite.siteid = tsite.siteid INNER JOIN
    taddress with (nolock) ON tsite.addressid = taddress.addressid INNER JOIN
    tcontact ON tsite.primarycontactid = tcontact.contactid LEFT JOIN
    tcontactphonenumber ON tcontact.primaryphoneid = tcontactphonenumber.phoneid '
    if @builder is not null
    begin
    SELECT @sql = @sql + ' LEFT JOIN tbuilder ON tsite.builderid = tbuilder.builderid
    LEFT JOIN tcontact bc ON tbuilder.primarycontactid = bc.contactid '
    end
    if @branchType = 1
    begin
    SELECT @sql = @sql + ' INNER JOIN testimate est ON est.siteid = tsite.siteid
    INNER JOIN tlogincompanybranch svccenterbranch on est.servicecenter=svccenterbranch.branchid and svccenterbranch.loginid = @loginid '
    end
    SELECT @sql = @sql + ' WHERE taddress.companyid = @companyid and tlogincompanybranch.loginid=@loginid '
    if @activeonly is not null
    begin
    SELECT @sql = @sql + ' AND a.isactive <> 0 '
    end
    if @lastname is not null
    begin
    SELECT @sql = @sql + ' AND upper(tcontact.lastname) LIKE @lastname + ''%'''
    --SELECT @sql = @sql + ' AND upper(tcontact.lastname) LIKE N' + quotename(@lastname + '%', '''')
    end
    if @branchType = 1 and @branchIndex <> 0
    begin
    SELECT @sql = @sql + ' AND est.servicecenter = @branchIndex '
    end
    if @firstname is not null
    begin
    SELECT @sql = @sql + ' AND upper(tcontact.firstname) LIKE @firstname + ''%'''
    end
    if @companyname is not null
    begin
    SELECT @sql = @sql + ' AND upper(tcontact.businessname) LIKE @companyname + ''%'''
    end
    if @streetnumber is not null
    begin
    SELECT @sql = @sql + ' AND taddress.streetnumber = @streetnumber '
    end
    if @streetname is not null
    begin
    SELECT @sql = @sql + ' AND upper(taddress.streetname) LIKE @streetname + ''%'''
    end
    if @city is not null
    begin
    SELECT @sql = @sql + ' AND upper(taddress.city) LIKE @city + ''%'''
    end
    if @zip is not null
    begin
    SELECT @sql = @sql + ' AND taddress.postalcode LIKE @zip + ''%'''
    end
    if @builder is not null
    begin
    SELECT @sql = @sql + ' AND upper(bc.businessname) LIKE ''%'' + @builder + ''%'''
    end
    if @lotnumber is not null
    begin
    SELECT @sql = @sql + ' AND upper(tsite.lotnumber) LIKE @lotnumber '
    end
    if @subdivision is not null
    begin
    SELECT @sql = @sql + ' AND upper(tsite.subdivision) LIKE @subdivision + ''%'''
    end
    if (@siteNational is not null) or (@siteResidential is not null) or (@siteCommercial is not null)
    begin
    SELECT @sql = @sql + ' AND ( '
    if @siteResidential is not null
    begin
    SELECT @sql = @sql + ' tsite.propertytype = 1 '
    end
    if @siteCommercial is not null
    begin
    if (@siteCommercial is not null) and (@siteResidential is not null)
    begin
    SELECT @sql = @sql + ' OR tsite.propertytype = 2 '
    end
    else
    begin
    SELECT @sql = @sql + ' tsite.propertytype = 2 '
    end
    end
    if @siteNational is not null
    begin
    if (@siteNational is not null) and ((@siteResidential is not null) or (@siteCommercial is not null))
    begin
    SELECT @sql = @sql + ' OR tsite.propertytype = 5 '
    end
    else
    begin
    SELECT @sql = @sql + ' tsite.propertytype = 5 '
    end
    end
    SELECT @sql = @sql + ' ) '
    end
    if @branchType = 2
    begin
    SELECT @sql = @sql + ' AND taccount.billingcenterid = @BranchIndex '
    end
    SELECT @sql = @sql + ' END '
    if (@prgActive is not null) or (@prgCancel is not null) or (@prgPendingCancel is not null)
    begin
    SELECT @sql = @sql + ' delete tmp
    from #temp tmp
    left join testimate e on e.siteid = tmp.siteid
    left join tprogram p on p.estimateid = e.estimateid
    where p.programid IS NULL '
    if @prgActive is null
    begin
    SELECT @sql = @sql + ' OR (p.canceldate is null and p.pendingcanceldate is null) '
    end
    if @prgCancel is null
    begin
    SELECT @sql = @sql + ' OR p.canceldate is not null '
    end
    if @prgPendingCancel is null
    begin
    SELECT @sql = @sql + ' OR p.pendingcanceldate is not null '
    end
    end
    SELECT @sql = @sql + ' ;WITH counts AS
    SELECT
    tmp.accountid,
    pccount = SUM(CASE WHEN ps.reportcategory = 1 THEN 1 ELSE 0 END),
    tctbcount = SUM(CASE WHEN ps.reportcategory = 3 THEN 1 ELSE 0 END)
    FROM
    #temp tmp
    INNER JOIN testimate e ON e.siteid = tmp.siteid
    INNER JOIN tprogram p ON p.estimateid = e.estimateid
    INNER JOIN tprogramsetup ps ON ps.programtypeid = p.programtypeid
    GROUP BY tmp.accountid
    UPDATE #temp
    SET haspc = CASE WHEN c.pccount > 0 THEN 1 ELSE 0 END,
    hastctb = CASE WHEN c.tctbcount > 0 THEN 1 ELSE 0 END
    FROM #temp tmp
    INNER JOIN counts c ON c.accountid = tmp.accountid '
    if (@prgPC is not null) or (@prgTCTB is not null) or (@prgPCTCTB is not null)
    begin
    SELECT @sql = @sql + ' DELETE
    FROM #temp
    WHERE (haspc = 0 AND hastctb = 0) OR (haspc IS NULL OR hastctb IS NULL) '
    if @prgPC is null
    begin
    SELECT @sql = @sql + ' OR (haspc = 1 AND hastctb = 0)'
    end
    if @prgTCTB is null
    begin
    SELECT @sql = @sql + ' OR (haspc = 0 AND hastctb = 1)'
    end
    if @prgPCTCTB is null
    begin
    SELECT @sql = @sql + ' OR (haspc = 1 AND hastctb = 1)'
    end
    end
    SELECT @sql = @sql + ' IF @showaccount=1 AND @showsite = 0 BEGIN
    SELECT DISTINCT taccount.accountnum,taccount.isactive, b.branchname, 0 as siteid, isnull(max(tcontact.firstname),'''') as firstname,isnull(max(tcontact.lastname),'''') as lastname,
    isnull(max(tcontact.businessname),'''') as businessname,max(taddress.streetnumber) as streetnumber,
    max(taddress.predirection) as predirection ,isnull(max(taddress.streetname),'''') as streetname,max(taddress.streetsuffix) as streetsuffix,max(taddress.postdirection) as postdirection,
    isnull(max(taddress.city),'''') as city,isnull(max(taddress.state),'''') as state,max(taddress.postalcode) as postalcode,isnull(taccount.mysearch,'''') as mysearch,taccount.accountid,
    isnull(max(tsite.lotnumber),'''') as lotnumber, haspc=CONVERT(BIT,ISNULL(haspc,0)), hastctb=CONVERT(BIT,ISNULL(hastctb,0))
    FROM #temp INNER JOIN taccount ON #temp.accountid = taccount.accountid
    LEFT JOIN tcontact ON #temp.contactid = tcontact.contactid
    LEFT JOIN taddress ON #temp.addressid = taddress.addressid
    LEFT JOIN taccountsite ON taccountsite.accountid=taccount.accountid
    LEFT JOIN tsite ON (taccountsite.siteid = tsite.siteid and tsite.addressid=taddress.addressid )
    LEFT JOIN tbranch b ON (taccount.billingcenterid = b.branchid)
    if @branchType = 1
    begin
    SELECT @sql = @sql + ' LEFT JOIN testimate est ON est.accountid = taccount.accountid '
    if @BranchIndex <> 0
    begin
    SELECT @sql = @sql + ' AND est.servicecenter = @BranchIndex '
    end
    SELECT @sql = @sql + ' GROUP BY taccount.accountnum, #temp.siteid, tcontact.firstname, tcontact.lastname,
    tcontact.businessname, taddress.streetnumber, taddress.predirection, taddress.streetname, taddress.streetsuffix, taddress.postdirection, taddress.city, taddress.state, taddress.postalcode, taccount.mysearch, taccount.accountid, taccount.isactive, haspc, hastctb, b.branchname
    HAVING count(est.servicecenter) > 0 '
    end
    else
    begin
    if @branchType = 2
    begin
    SELECT @sql = @sql + ' WHERE taccount.billingcenterid = @BranchIndex '
    end
    SELECT @sql = @sql + ' GROUP BY taccount.accountid, taccount.isactive,taccount.accountnum,taccount.mysearch, haspc, hastctb,b.branchname '
    SELECT @sql = @sql + ' ORDER BY taccount.accountnum '
    end
    SELECT @sql = @sql + ' END ELSE BEGIN
    SELECT DISTINCT taccount.accountnum,taccount.isactive, case when billingbranch.branchname is not null and @showaccount = 1 then billingbranch.branchname else isnull(b.branchname,'''') end as branchname, case when #temp.branchid = 0 then #temp.siteid else 0 end as siteid, isnull(tcontact.firstname,'''') as firstname,isnull(tcontact.lastname,'''') as lastname,
    isnull(tcontact.businessname,'''') as businessname,taddress.streetnumber,
    taddress.predirection,isnull(taddress.streetname,'''') as streetname,taddress.streetsuffix,taddress.postdirection,
    isnull(taddress.city,'''') as city,isnull(taddress.state,'''') as state,taddress.postalcode,isnull(taccount.mysearch,'''') as mysearch,taccount.accountid,
    isnull(max(tsite.lotnumber),'''') as lotnumber, haspc=CONVERT(BIT,ISNULL(haspc,0)), hastctb=CONVERT(BIT,ISNULL(hastctb,0))
    FROM #temp INNER JOIN taccount ON #temp.accountid = taccount.accountid
    LEFT JOIN tcontact ON #temp.contactid = tcontact.contactid
    LEFT JOIN taddress ON #temp.addressid = taddress.addressid
    LEFT JOIN taccountsite ON taccountsite.accountid=taccount.accountid
    LEFT JOIN tsite ON (taccountsite.siteid = tsite.siteid and tsite.addressid=taddress.addressid )
    LEFT JOIN testimate est ON est.siteid = tsite.siteid
    LEFT JOIN tbranch b ON (est.servicecenter = b.branchid)
    LEFT JOIN tbranch billingbranch ON (#temp.branchid = billingbranch.branchid)
    if @branchType = 1
    begin
    if @BranchIndex <> 0
    begin
    SELECT @sql = @sql + ' AND est.servicecenter = @BranchIndex '
    end
    SELECT @sql = @sql + ' GROUP BY taccount.accountnum,taccount.isactive, #temp.siteid, tcontact.firstname, tcontact.lastname,tcontact.businessname, taddress.streetnumber,
    taddress.predirection,taddress.streetname, taddress.streetsuffix,taddress.postdirection,taddress.city, taddress.state, taddress.postalcode,taccount.mysearch, taccount.accountid, haspc, hastctb, b.branchname, billingbranch.branchname, #temp.branchid
    HAVING (count(est.servicecenter) > 0 or billingbranch.branchname is not null) '
    end
    else
    begin
    if @branchType = 2
    begin
    SELECT @sql = @sql + ' WHERE taccount.billingcenterid = @BranchIndex '
    end
    SELECT @sql = @sql + ' GROUP BY taccount.accountid, taccount.isactive,taccount.accountnum, tcontact.firstname, tcontact.lastname,
    tcontact.businessname, #temp.siteid,
    taddress.streetnumber, taddress.predirection, taddress.streetname,
    taddress.streetsuffix, taddress.postdirection,taddress.city, taddress.state,
    taddress.postalcode,taddress.postalcodeex,taccount.mysearch, haspc, hastctb, b.branchname, billingbranch.branchname, #temp.branchid '
    end
    SELECT @sql = @sql + ' ORDER BY taccount.accountnum
    END
    DROP TABLE #temp
    SET NOCOUNT OFF '
    SELECT @paramlist = N' @loginid INT,
    @companyid INT,
    @streetnumber nvarchar(100),
    @streetname nvarchar(50),
    @city nvarchar(50),
    @zip nvarchar(50),
    @lastname nvarchar(50),
    @firstname nvarchar(50),
    @companyname nvarchar(50),
    @builder nvarchar(50),
    @lotnumber nvarchar(50),
    @subdivision nvarchar(50),
    @showaccount bit,
    @showsite bit,
    @activeonly bit,
    @branchType int,
    @BranchIndex int,
    @prgActive bit,
    @prgCancel bit,
    @prgPendingCancel bit,
    @siteNational bit,
    @siteResidential bit,
    @siteCommercial bit,
    @prgPC bit,
    @prgTCTB bit,
    @prgPCTCTB bit '
    EXEC sp_executesql @sql, @paramlist,
    @loginid, @companyid, @streetnumber, @streetname, @city, @zip, @lastname, @firstname, @companyname, @builder,
    @lotnumber, @subdivision, @showaccount, @showsite, @activeonly, @branchType, @BranchIndex, @prgActive,
    @prgCancel,@prgPendingCancel, @siteNational, @siteResidential, @siteCommercial, @prgPC, @prgTCTB, @prgPCTCTB
    END

    Does it fill up tempdb, no matter which parameters you provide?
    Narrow down which conditions that cause the procedure to fail. Add a @debug parameter and
    IF @debug = 1
       PRINT @sql
    Take a look at that SQL, and see if it looks OK. Maybe you have an incorrect condition somewhere?
    You can also create a temporary procedure from the generated SQL, and then run it, to see more what is happening.
    If nothing stands out, try reducing the query until tempdb stays in check.
    Since you create temp tables, there are two possible reasons (at least) why tempdb fills up:
    1) You are inserting too much data into the temp tables (for instance because of a poorly written join).
    2) The query generates a worktable which overflows.
    I don't think anyone wants to try to read and understand your dynamic SQL code, but hopefully these tips helps you with the troubleshooting.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • SQL Between Query....Urgent Please Help ..

    Hi,
    Can any one solve my problem.
    Iam having two numaric columns in my database table. I like to retrive
    them in the specific range.
    The Example Table is.
    Table Name is : SR_Table
    testDate(numeric) testTime(numeric)
    1 1
    1 2
    1 3
    1 4
    1 5
    1 6
    2 1
    2 2
    2 3
    2 4
    Infact i like to get the records between testDate = 1 and testTime = 2
    and testDate = 2 and testTime = 3
    Iam using the sql query as:
    select * from SR_Table where testdate between '1' and '2' and testtime between '2' and '4'..
    instead of giving 9 records its just giving 6 records ... it maight me a mistake in my query. the output for the above query is:
    testDate(numeric) testTime(numeric)
    1 2
    1 3
    1 4
    2 2
    2 3
    2 4
    The records
    1 5
    1 6
    2 1 are missing...
    infact iam expecting 9 records as
    testDate(numeric) testTime(numeric)
    1 2
    1 3
    1 4
    1 5
    1 6
    2 1
    2 2
    2 3
    2 4
    Please solve my problem for using BETWEEN together in two coloumns.
    Thanks,
    Srinivas Mannava

    Looks like there's a few ways to approach this, depending on your data.
    If you are truly wanting values between a given range, and you have a different range for each column, then modifying your query as suggested by DrClap should work properly.select * from SR_Table
    where (testdate > 0 and testdate < 3)
    and (testtime > 1 and testtime < 5)
    // > 0 and < 3 means 1 or 2
    // > 1 and < 5 means 2, 3, or 4Looking at your example again, however, it appears that you are wanting both values together to act as a single key. Your example data would then contain the values 11 - 16 and 21 - 24.
    If this is the case, then you're going to have to get a little more complicated, and implementation may depend on the database that you are using.
    If your sample data is representative of your real data (nothing but INT values) then it won't be too bad (this is an Oracle implementation):select [other_fields], TO_NUMBER(testdate || testtime) as test
    from SR_Table
    where test > 11 and test < 17 and test > 20 and test < 25If your data is more complex, then the query becomes more complex and we'll really need to know exactly what you're trying to do.

  • Cannot query varray of object types-please help

    I am attempting to query the "diminfo" field of the view "MDSYS.all_sdo_geom_metadata". The field is "described" as MDSYS.SDO_DIM_ARRAY, which I believe is a varray of MDSYS.SDO_DIM_ELEMENT.
    I have run OTT to generate the class files, but nothing is generated for the MDSYS.SDO_DIM_ARRAY "type" (maybe because it's not really a type?). A class is generated for the SDO_DIM_ELEMENT objects.
    Anyway, I have tried to query the field using both "VALUE(diminfo)" and "REF(diminfo)":
    select VALUE(diminfo) from all_sdo_geom_metadata;
    - or -
    select REF(diminfo) from all_sdo_geom_metadata;
    and I get back an ORA-904 "invalid identifier". When I remove the "VALUE" or "REF" from the query, the error goes away, and is replaced by an ORA-32162 "Read/Write method not registered" further down in the code when I try to retreive the value from the recordset:
    myDimInfo = rSet->getObject(1);
    Since the field type (MDSYS.SDO_DIM_ARRAY) isn't really an object type, I can see why the "Read/Write method not registered" occurs-there are no methods to register.
    Can someone provide a code snippet of how to perform this query?
    Thanks in advance

    Hi,
    I am using OTT generated objects to pass them to my PL/SQL procedures as OUT parameters. When I call the registerOutParam() function, I get this error ORA-32162: Read/Write SQL method not registered.
    I am calling my mapping function after creating environment and before creating my stateless connection pool. But still I am getting this exception at runtime while calling registerOutParam().
    Environment* env;
    env = Environment::createEnvironment(Environment::OBJECT);
    MessageTOMapping(env); // Calling the mapping function here.
    // Creating the stateless connection pool.
    StatelessConnectionPool* scp;
    scp = env->createStatelessConnectionPool("naveen",
    "naveen",
    "//10.105.153.11:1521/pls",
    10,
    5,
    2,
    StatelessConnectionPool::HOMOGENEOUS);
    // Fetch a connection from the stateless connection pool
    conn = scp->getConnection();
    // After this, I create my Statement and call the registerOutParam() which
    // causes ORA-32162 exception.
    Please note that I do not get this error when I don't use any connection-pooling mechanism. That is, if I create an environment in OBJECT mode, call the mapping function with its pointer and create a normal Connection object (without any pooling etc), my application runs perfectly fine. E.g. if I replace the above piece of code with the code below, my application runs fine.
    Environment* env;
    env = Environment::createEnvironment(Environment::OBJECT);
    MessageTOMapping(env); // Calling the mapping function here.
    conn = env->createConnection("naveen", "naveen", "//10.105.153.11:1521/pls");
    // After this, I create my Statement and call the registerOutParam() which
    // does not give problem now and my application runs pefectly fine.
    Can anyone let me know what I am doing wrong while using the stateless connection pooling mechanism? I definitely need to use Stateless Connection Pooling and must not get connections directly from env->createConnection().
    Any help will be greatly appreciated.
    Thanks and Regards,
    Naveen

  • Query bean and multipleSelection (Urgent, please help!!!!)

    In my search page(query region, Construction Mode:     autoCustomizationCriteria, result table: advancedTable).
    I have a column of check box, some how the check box value is not updated when it is checked.
    Do you see what is missing?
    thank you in advance.
    Lei
    Here is my code and out put:
    if (pageContext.getParameter("Delete") != null){
    System.out.println("Delete button: "+ pageContext.getParameter("Delete"));
    System.out.println("delete button is clicked.");
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    // am.invokeMethod("deleteGoalSheet");
    OAViewObject vo = (OAViewObject)am.findViewObject("GoalSheetResultGAVO1");
    System.out.println("Find Object GoalSheetResultGAVO1 Successfuly");
    //Receiving first row of the VO
    GoalSheetResultGAVORowImpl row = (GoalSheetResultGAVORowImpl) vo.first();
    System.out.println("####################################");
    System.out.println("Fetched first row of GoalSheetResultGAVO");
    while (row != null)
    String sourceName = (String) row.getAttribute("SourceName");
    String selectFlag = (String) row.getAttribute("SelectFlag");
    System.out.println("Attribute sourceName Value -> "+sourceName);
    System.out.println("Attribute selectFlag Value -> "+selectFlag);
    if (selectFlag == null)
    System.out.println("Column SelectFlag is null");
    if (selectFlag!=null)
    if (selectFlag.equals("Y"))
    //row.setAttribute("GsStatusCode",Constants.GOAL_SHEET_STATUS_CODE_DEL);
    row.setGsStatusCode(Constants.GOAL_SHEET_STATUS_CODE_DEL);
    System.out.println("####################################");
    System.out.println("Fetching next row of GoalSheetResultGAVO");
    row = (GoalSheetResultGAVORowImpl) vo.next();
    System.out.println("####################################");
    System.out.println("Last row fetched, exiting loop");
    am.invokeMethod("apply");
    07/06/24 22:31:29 Find Object GoalSheetResultGAVO1 Successfuly
    07/06/24 22:31:29 ####################################
    07/06/24 22:31:29 Fetched first row of GoalSheetResultGAVO
    07/06/24 22:31:29 Attribute sourceName Value -> Nashif, Adam L
    07/06/24 22:31:29 Attribute selectFlag Value -> null
    07/06/24 22:31:29 Column SelectFlag is null
    07/06/24 22:31:29 ####################################
    07/06/24 22:31:29 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:29 Attribute sourceName Value -> Miranda, Miguel Angel
    07/06/24 22:31:29 Attribute selectFlag Value -> null
    07/06/24 22:31:29 Column SelectFlag is null
    07/06/24 22:31:29 ####################################
    07/06/24 22:31:29 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:29 Attribute sourceName Value -> Cameron, David B
    07/06/24 22:31:29 Attribute selectFlag Value -> null
    07/06/24 22:31:29 Column SelectFlag is null
    07/06/24 22:31:29 ####################################
    07/06/24 22:31:29 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:29 Attribute sourceName Value -> Aagaard, Jorleif
    07/06/24 22:31:29 Attribute selectFlag Value -> null
    07/06/24 22:31:29 Column SelectFlag is null
    07/06/24 22:31:29 ####################################
    07/06/24 22:31:29 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:29 Attribute sourceName Value -> Miranda, Miguel Angel
    07/06/24 22:31:29 Attribute selectFlag Value -> null
    07/06/24 22:31:29 Column SelectFlag is null
    07/06/24 22:31:29 ####################################
    07/06/24 22:31:29 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:29 Attribute sourceName Value -> Miranda, Miguel Angel
    07/06/24 22:31:29 Attribute selectFlag Value -> null
    07/06/24 22:31:29 Column SelectFlag is null
    07/06/24 22:31:29 ####################################
    07/06/24 22:31:29 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:29 Attribute sourceName Value -> Walsh, Terry
    07/06/24 22:31:29 Attribute selectFlag Value -> null
    07/06/24 22:31:29 Column SelectFlag is null
    07/06/24 22:31:29 ####################################
    07/06/24 22:31:29 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:29 Attribute sourceName Value -> Putman, Steven
    07/06/24 22:31:29 Attribute selectFlag Value -> null
    07/06/24 22:31:29 Column SelectFlag is null
    07/06/24 22:31:29 ####################################
    07/06/24 22:31:29 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:29 Attribute sourceName Value -> Miranda, Miguel Angel
    07/06/24 22:31:29 Attribute selectFlag Value -> null
    07/06/24 22:31:29 Column SelectFlag is null
    07/06/24 22:31:29 ####################################
    07/06/24 22:31:29 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:29 Attribute sourceName Value -> Miranda, Miguel Angel
    07/06/24 22:31:29 Attribute selectFlag Value -> null
    07/06/24 22:31:29 Column SelectFlag is null
    07/06/24 22:31:29 ####################################
    07/06/24 22:31:29 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:30 Attribute sourceName Value -> Kumasaka, Koby R
    07/06/24 22:31:30 Attribute selectFlag Value -> null
    07/06/24 22:31:30 Column SelectFlag is null
    07/06/24 22:31:30 ####################################
    07/06/24 22:31:30 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:30 Attribute sourceName Value -> Kumasaka, Koby R
    07/06/24 22:31:30 Attribute selectFlag Value -> null
    07/06/24 22:31:30 Column SelectFlag is null
    07/06/24 22:31:30 ####################################
    07/06/24 22:31:30 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:30 Attribute sourceName Value -> Hagan, Thomas J
    07/06/24 22:31:30 Attribute selectFlag Value -> null
    07/06/24 22:31:30 Column SelectFlag is null
    07/06/24 22:31:30 ####################################
    07/06/24 22:31:30 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:30 Attribute sourceName Value -> Hagan, Thomas J
    07/06/24 22:31:30 Attribute selectFlag Value -> null
    07/06/24 22:31:30 Column SelectFlag is null
    07/06/24 22:31:30 ####################################
    07/06/24 22:31:30 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:30 Attribute sourceName Value -> Aagaard, Jorleif
    07/06/24 22:31:30 Attribute selectFlag Value -> null
    07/06/24 22:31:30 Column SelectFlag is null
    07/06/24 22:31:30 ####################################
    07/06/24 22:31:30 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:30 Attribute sourceName Value -> Cortes, Gustavo
    07/06/24 22:31:30 Attribute selectFlag Value -> null
    07/06/24 22:31:30 Column SelectFlag is null
    07/06/24 22:31:30 ####################################
    07/06/24 22:31:30 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:30 Attribute sourceName Value -> Putman, Steven
    07/06/24 22:31:30 Attribute selectFlag Value -> null
    07/06/24 22:31:30 Column SelectFlag is null
    07/06/24 22:31:30 ####################################
    07/06/24 22:31:30 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:30 Attribute sourceName Value -> Taverner, Timothy
    07/06/24 22:31:30 Attribute selectFlag Value -> null
    07/06/24 22:31:30 Column SelectFlag is null
    07/06/24 22:31:30 ####################################
    07/06/24 22:31:30 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:30 Attribute sourceName Value -> Thibodeau, Paul J
    07/06/24 22:31:30 Attribute selectFlag Value -> null
    07/06/24 22:31:30 Column SelectFlag is null
    07/06/24 22:31:30 ####################################
    07/06/24 22:31:30 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:30 Attribute sourceName Value -> Miranda, Miguel Angel
    07/06/24 22:31:30 Attribute selectFlag Value -> null
    07/06/24 22:31:30 Column SelectFlag is null
    07/06/24 22:31:30 ####################################
    07/06/24 22:31:30 Fetching next row of GoalSheetResultGAVO
    07/06/24 22:31:30 ####################################
    07/06/24 22:31:30 Last row fetched, exiting loop

    Hi Shiv
    Following is page xml, and my controller is at query region level not page level, that should not be the reason, right?
    thanks
    Lei
    GoalSheetSearchPG.xml
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <page xmlns:jrad="http://xmlns.oracle.com/jrad" xmlns:oa="http://xmlns.oracle.com/oa" xmlns:ui="http://xmlns.oracle.com/uix/ui" version="10.1.3_798" xml:lang="en-US" xmlns:user="http://xmlns.oracle.com/jrad/user" xmlns="http://xmlns.oracle.com/jrad" file-version="$Header: /opt/cvsroot/Repository/OAF/OIC/Goaling/src/oracle/apps/xxg2c/goaling/webui/GoalSheetSearchPG.xml,v 1.1.1.1 2007/06/08 18:02:07 lezhou Exp $">
    <content>
    <oa:pageLayout id="PageLayoutRN" windowTitle="Goal Sheet" amDefName="cisco.oracle.apps.xxg2c.goaling.server.GoalsheetSearchAM">
    <ui:corporateBranding>
    <oa:image id="corporateBrandingImage" source="/OA_MEDIA/FNDSSCORP.gif"/>
    </ui:corporateBranding>
    <ui:contents>
    <oa:query id="QueryRN" mode="autoCustomizationCriteria" dispSimple="true" dispAdvanced="false" dispCustomized="true" defaultPanel="customized" amDefName="cisco.oracle.apps.xxg2c.goaling.server.GoalsheetSearchAM" controllerClass="cisco.oracle.apps.xxg2c.goaling.webui.GoalSheetSearchCO">
    <oa:simpleSearchMappings>
    <oa:queryCriteriaMap id="SrpNameMap" criteriaItem="SearchSrpName" resultsItem="SrpName"/>
    <oa:queryCriteriaMap id="CompPlanNameMap" criteriaItem="SearchCompPlanName" resultsItem="CompPlanName"/>
    <oa:queryCriteriaMap id="GoalsheetStatusMap" criteriaItem="SearchGoalSheetStatus" resultsItem="GsStatusCode"/>
    <oa:queryCriteriaMap id="FiscalYearMap" criteriaItem="SearchFiscalYear" resultsItem="FiscalYear"/>
    <oa:queryCriteriaMap id="ShareNodeMap" criteriaItem="SearchShareNode" resultsItem="ShareNode"/>
    </oa:simpleSearchMappings>
    <oa:simpleSearchPanel>
    <oa:header text="Simple Search" id="SimpleSearchHdr">
    <ui:contents>
    <oa:messageComponentLayout id="CustomerSimpleSearch" rows="3" columns="2">
    <ui:contents>
    <oa:messageChoice id="SearchGoalSheetStatus" queryable="true" serverUnvalidated="true" initSortSeq="first" pickListViewDef="" pickListDispAttr="Meaning" pickListValAttr="LookupCode" selectiveSearchCriteria="true" prompt="Goal Sheet Status" pickListViewName="GsStatusLookupsVO1"/>
    <oa:messageLovInput id="SearchShareNode" queryable="true" selectiveSearchCriteria="true" prompt="Share Node" externalListOfValues="/oracle/apps/xxg2c/goaling/lov/webui/LookupLovRN" unvalidated="true" rendered="true">
    <lovMappings>
    <lovMap id="lovMap3" lovItem="LastUpdateLogin" resultTo="SearchShareNode" criteriaFrom="SearchShareNode"/>
    </lovMappings>
    </oa:messageLovInput>
    <oa:messageLovInput id="SearchSrpName" prompt="Resource Name" externalListOfValues="/cisco/oracle/apps/xxg2c/common/lov/webui/SalesRepsLovRN" unvalidated="true" queryable="true" selectiveSearchCriteria="true">
    <lovMappings>
    <lovMap id="lovMap1" lovItem="SrpName" resultTo="SearchSrpName" criteriaFrom="SearchSrpName"/>
    </lovMappings>
    </oa:messageLovInput>
    <oa:messageChoice id="SearchFiscalYear" queryable="true" serverUnvalidated="true" pickListViewDef="" pickListDispAttr="Meaning" selectiveSearchCriteria="true" prompt="Fiscal Year" pickListValAttr="LookupCode" dataType="NUMBER" pickListViewName="FiscalYearLookupsVO1" allowBlankValue="false"/>
    <oa:messageLovInput id="SearchCompPlanName" prompt="Comp Plan Name" externalListOfValues="/cisco/oracle/apps/xxg2c/common/lov/webui/CompPlansLovRN" unvalidated="true" queryable="false" selectiveSearchCriteria="true" warnAboutChanges="false">
    <lovMappings>
    <lovMap id="lovMap2" lovItem="CompPlanName" resultTo="SearchCompPlanName" criteriaFrom="SearchCompPlanName"/>
    </lovMappings>
    </oa:messageLovInput>
    </ui:contents>
    </oa:messageComponentLayout>
    </ui:contents>
    </oa:header>
    </oa:simpleSearchPanel>
    <ui:contents>
    <oa:advancedTable id="ResultsTable" viewName="GoalSheetResultGAVO1" width="100%">
    <ui:contents>
    <oa:column id="SrpNameCol">
    <ui:columnHeader>
    <oa:sortableHeader id="SrpNameHdr" prompt="Resource Name"/>
    </ui:columnHeader>
    <ui:contents>
    <oa:messageStyledText id="SrpName" viewAttr="SourceName" prompt="Resource Name" queryable="true"/>
    </ui:contents>
    </oa:column>
    <oa:column id="SourceEmailCol">
    <ui:columnHeader>
    <oa:sortableHeader id="SrpEmailHdr" prompt="Email Id"/>
    </ui:columnHeader>
    <ui:contents>
    <oa:messageStyledText id="SrpEmail" dataType="VARCHAR2" prompt="Email ID" viewAttr="SrpEmailId" maximumLength="2000"/>
    </ui:contents>
    </oa:column>
    <oa:column id="SrpEmpIdCol" width="10">
    <ui:columnHeader>
    <oa:sortableHeader id="SrpEmpIdHdr" prompt="Employee Id"/>
    </ui:columnHeader>
    <ui:contents>
    <oa:messageStyledText id="SrpEmpNum" dataType="NUMBER" prompt="eMPLOYEE id" viewAttr="SrpEmployeeNumber"/>
    </ui:contents>
    </oa:column>
    <oa:column id="CompPlanNameCol">
    <ui:columnHeader>
    <oa:sortableHeader id="CompPlanNameHdr" prompt="Comp Plan Name"/>
    </ui:columnHeader>
    <ui:contents>
    <oa:messageStyledText id="CompPlanName" dataType="VARCHAR2" prompt="Comp Plan Name" viewAttr="Name" maximumLength="30" queryable="true" selectiveSearchCriteria="true"/>
    </ui:contents>
    </oa:column>
    <oa:column id="SrpGoalHeaderIdCol">
    <ui:columnHeader>
    <oa:sortableHeader id="SrpGoalHeaderHdr" prompt="GS ID"/>
    </ui:columnHeader>
    <ui:contents>
    <oa:messageStyledText id="SrpGoalHeaderId" dataType="NUMBER" prompt="GS ID" viewAttr="SrpGoalHeaderId" maximumLength="15" queryable="true"/>
    </ui:contents>
    </oa:column>
    <oa:column id="GSStatusCol">
    <ui:columnHeader>
    <oa:sortableHeader id="GSStatusHdr" prompt="GS Status"/>
    </ui:columnHeader>
    <ui:contents>
    <oa:messageStyledText id="GsStatus" dataType="VARCHAR2" prompt="GS Status" viewAttr="Meaning" maximumLength="80"/>
    </ui:contents>
    </oa:column>
    <oa:column id="GSStartDateCol">
    <ui:columnHeader>
    <oa:sortableHeader id="GSStartDateHdr" prompt="GS Start Date"/>
    </ui:columnHeader>
    <ui:contents>
    <oa:messageStyledText id="GsStartDate" dataType="DATE" prompt="GS Start Date" viewAttr="GsStartDate" queryable="true"/>
    </ui:contents>
    </oa:column>
    <oa:column id="GSEndDateCol">
    <ui:columnHeader>
    <oa:sortableHeader id="GSEndDateHdr" prompt="GS End Date"/>
    </ui:columnHeader>
    <ui:contents>
    <oa:messageStyledText id="GsEndDate" dataType="DATE" prompt="GS End Date" viewAttr="GsEndDate"/>
    </ui:contents>
    </oa:column>
    <oa:column id="CreateNewCol">
    <ui:columnHeader>
    <oa:sortableHeader id="CreateNewHdr" prompt="Create New"/>
    </ui:columnHeader>
    <ui:contents>
    <oa:image id="CreateNewLink" dataType="VARCHAR2" prompt="CreateNewLink" viewAttr="Create New" source="adddocumenttolist_enabled.gif" rendered="true"/>
    </ui:contents>
    </oa:column>
    <oa:column id="CopyCol">
    <ui:columnHeader>
    <oa:sortableHeader id="CopyHdr" prompt="Copy"/>
    </ui:columnHeader>
    <ui:contents>
    <oa:switcher id="Copy" viewAttr="CopyFlag">
    <ui:case name="copy_enabled">
    <oa:image id="copy_enabled" source="duplicate_enabled.gif">
    <ui:primaryClientAction>
    <ui:fireAction event="Copy"/>
    </ui:primaryClientAction>
    </oa:image>
    </ui:case>
    <ui:case name="copy_disabled">
    <oa:image id="copy_disabled" source="duplicate_disabled.gif"/>
    </ui:case>
    </oa:switcher>
    </ui:contents>
    </oa:column>
    <oa:formValue id="FiscalYear" viewAttr="PeriodYear" dataType="NUMBER"/>
    <oa:formValue id="ShareNode" viewAttr="NodeId"/>
    <oa:formValue id="GsStatusCode" viewAttr="StatusCode"/>
    <oa:column id="column1">
    <ui:columnHeader/>
    <ui:contents>
    <oa:messageCheckBox id="item1" viewAttr="SelectFlag"/>
    </ui:contents>
    </oa:column>
    </ui:contents>
    <ui:tableActions>
    <oa:flowLayout id="region1">
    <ui:contents>
    <oa:submitButton id="Delete" text="Delete" prompt="Delete"/>
    <oa:exportButton id="Export" exportAllRows="true" text="Export"/>
    </ui:contents>
    </oa:flowLayout>
    </ui:tableActions>
    <ui:tableSelection>
    <oa:multipleSelection id="multipleSelection1" viewAttr="Checked"/>
    </ui:tableSelection>
    </oa:advancedTable>
    </ui:contents>
    </oa:query>
    </ui:contents>
    </oa:pageLayout>
    </content>
    </page>

Maybe you are looking for

  • How can i buy free apps without a credit card

    Hi does anybody know how i can set up an app store account for the purpose of downloading only free apps without providing credit card details? cheers.

  • Shared Photo Streams - Some Pictures Will Just Not Share

    I am using Aperture to create Shared Photo Streams. I have created 20 or so Shared Photo Streams, many of which work as advertised. But I have a couple of situations where certain photos just refuse to get shared in to any Shared Photo Stream. I disc

  • LCD live viewing & copy work with EOS 70D (W)

    Hi, Can anyone please provide insight, guidance, solutions to accomplish this efficiently? Goal/operation: I want to use the camera for copy work: portfolio, flat art, photos, objects etc. I have old family photo albums I want to copy/photograph each

  • ! Error when copying song from Purchased to IPod play list.  How to fix?

    ! Error when copying song from Purchased to IPod play list. How to fix?

  • Java Thread implementation

    Here is my code, I would like to know if I implement my threads nicely here, I am worrying those threads are still alive, they should be interrupted. but why I got different thread ID when i resume it? // Two player board game play in turn. Human pla