Help in update generic query

HI, Some super_id is wrong or null in my #cred table and I want to update with the correct super_id.
The best way is to COUNT max 'super_id' on the basis of column-'b_id' and 'bid_code'.
Query condition should be based on 'b_id' and 'bid_code'. Please help for the logic of this update query.
I want also add the column of 'Correct super_id is:' in the result with the correct super_id.
Tip. 'b_id' column data must exist in  'bid_code' column. Can we use like command to avoid any hard code in the update and create generic script for update.
Example of new column of 'Correct super_id is:
The record of b_id-'SLEP' and bid_code-'SLEP_LEN' has super_id-'2' three times, one time is '1' and one time is 'null'.
So max super_id is 2 for these and this is correct super_id.
drop table #cred
create table #cred (unique_id numeric,b_id char(10), bid_code char(10), super_id numeric)
insert into #cred values (10012,'SLEP','SLEP_LEN',2)
insert into #cred values (10013,'SLEP','SLEP_LEN',1)
insert into #cred values (10014,'SLEP','SLEP_LEN',2)
insert into #cred values (10015,'SLEP','SLEP_LEN',2)
insert into #cred values (10016,'SLEP','SLEP_LEN',null)
insert into #cred values (10017,'GHEP','GHEP_RET',44)
insert into #cred values (10018,'GHEP','GHEP_RET',44)
insert into #cred values (10019,'GHEP','GHEP_RET',44)
insert into #cred values (10020,'GHEP','GHEP_RET',22)
insert into #cred values (10021,'GHEP','GHEP_RET',null)
insert into #cred values (10022,'SDEP','SDEP_Full',77)
insert into #cred values (10023,'SDEP','SDEP_Full',77)
insert into #cred values (10024,'SDEP','SDEP_Full',55)
insert into #cred values (10025,'SDEP','SDEP_Full',77)
insert into #cred values (10026,'SDEP','SDEP_Full',null)
Select * from #cred order by unique_id
--Desired Results
unique_id    b_id    bid_code    super_id   Correct super_id is:
10012    SLEP          SLEP_LEN      2
10013    SLEP          SLEP_LEN      1             2
10014    SLEP          SLEP_LEN      2
10015    SLEP          SLEP_LEN      2
10016    SLEP          SLEP_LEN      NULL       2
10017    GHEP          GHEP_RET      44       
10018    GHEP          GHEP_RET      44
10019    GHEP          GHEP_RET      44
10020    GHEP          GHEP_RET      22          44
10021    GHEP          GHEP_RET      NULL      44
10022    SDEP          SDEP_Full     77
10023    SDEP          SDEP_Full     77
10024    SDEP          SDEP_Full     55           77
10025    SDEP          SDEP_Full     77
10026    SDEP          SDEP_Full     NULL       77
 

Kevin, try
-- code #1 v2 - list
;with
T as (
SELECT unique_id, b_id, bid_code, super_id,
max(super_id) over(partition by b_id, bid_code) as super_id2
from #cred
where b_id = Left(bid_code, CharIndex('_', bid_code)-1)
SELECT unique_id, b_id, bid_code, super_id,
case when super_id=super_id2 then '' else cast(super_id2 as sql_variant) end as [Correct super_id is:]
from T
order by unique_id;
and
-- code #2 v2 - update
;with
T2 as (
SELECT unique_id,
max(super_id) over(partition by b_id, bid_code) as super_id2
from #cred
where b_id = Left(bid_code, CharIndex('_', bid_code)-1)
UPDATE T1
set T1.super_id= T2.super_id2
output inserted.unique_id, inserted.b_id, inserted.bid_code,
deleted.super_id as [old super_id], inserted.super_id as [new super_id]
from T2 inner join
#cred as T1 on T1.unique_id=T2.unique_id
where (T1.super_id <> T2.super_id2) or T1.super_id is null;
José Diz     Belo Horizonte, MG - Brasil

Similar Messages

  • Need help with Update Join Query

    Hello, I am trying to update PID of #child table with PID of #parent table if "lastname & firstname are matches in both table" but my update query is giving some error. Please help and correct the update query. I am also trying to remove any
    blank space from starting and ending.
    drop table #parent,#child
    create table #parent (PID varchar(10), lastname varchar(50), firstname varchar(50))
    insert into #parent values ('100','Josheph','Sumali')
    insert into #parent values ('400','Karen','Hunsa')
    insert into #parent values ('600','Mursan  ','  Terry')
    create table #child (PID varchar(10), lastname varchar(50), firstname varchar(50))
    insert into #child values ('2','Josheph ','Sumali   ')
    insert into #child values ('5','Karen','Kunsi')
    insert into #child values ('6','Mursan ','Terry ')
    Update #child
    set PID = p.PID
    from #child C Join
    #parent p ON c.LTRIM(RTRIM(lastname) = p.LTRIM(RTRIM(lastname)
    AND c.LTRIM(RTRIM(firstname) = p.LTRIM(RTRIM(firstname)
    /* Requested Output */
    PID        lastname      firstname
    100        Josheph       Sumali
    600        Mursan        Terry

    create table #parent (PID varchar(10), lastname varchar(50), firstname varchar(50))
    insert into #parent values ('100','Josheph','Sumali')
    insert into #parent values ('400','Karen','Hunsa')
    insert into #parent values ('600','Mursan ',' Terry')
    create table #child (PID varchar(10), lastname varchar(50), firstname varchar(50))
    insert into #child values ('2','Josheph ','Sumali ')
    insert into #child values ('5','Karen','Kunsi')
    insert into #child values ('6','Mursan ','Terry ')
    Merge #child as t
    Using #parent as p ON (LTRIM(RTRIM(t.lastname)) = LTRIM(RTRIM(p.lastname))
    AND LTRIM(RTRIM(t.firstname)) = LTRIM(RTRIM(p.firstname)) )
    When Matched Then
    Update
    set PID = p.PID;
    update #child
    Set lastname=LTRIM(RTRIM(lastname)), firstname= LTRIM(RTRIM(firstname));
    update #parent
    Set lastname=LTRIM(RTRIM(lastname)), firstname = LTRIM(RTRIM(firstname));
    select * from #child
    select * from #parent
    drop table #parent,#child

  • Help with update SQL query

    Hi,I want to update the city_code with city_new_code but want to update the data before the first hyphen of city_code.
    create table #city (city_code char(10), city_code char(2), city_new_code char(10))
    insert into #city values ('1989_DEL_J1_200','2','2000')
    insert into #city values ('1789_DEL_K1_300','2','3000')
    insert into #city values ('1999_DEL_J1_400','2','5000')
    update #city set city_code........
    /* Need Required Output*/
    city_code         city_code  city_new_code
    2000_DEL_J1_200   2              2000
    3000_DEL_K1_300  2               3000
    5000_DEL_J1_400   2              5000

    create table #city (city_code varchar(15), city_code2 char(2), city_new_code varchar(4))
    insert into #city values ('1989_DEL_J1_200','2','2000')
    insert into #city values ('1789_DEL_K1_300','2','3000')
    insert into #city values ('1999_DEL_J1_400','2','5000')
    --update #city set city_code........
    update #city
    Set city_code=stuff(city_code,1,4,city_new_code)
    Select city_code,city_code2,city_new_code from #city
    drop table #city

  • Need help in UPDATE data in SQL Query

    Hi all,
    I am trying to update data in the sql table as per below screenshot but couldn't able to do it. Can anyone help to update the data as I mention in screenshot.Appreciate you help.Thanks.
    Yellow highlighted columns are source
    Green highlighted columns are target
    Colored data should be update as per source data in sql table.Data is not static as it might have more rows to update and query should be bit dynamic.
    Maruthi...

    You have already asked this question once. You did not get any good answers, because you the information you gave was insufficient. And I'm afraid that the information is still in sufficient.
    Or more exactly, from the example you have given, the answer is: can't be done. And the reason it can't be done, is as I explained in response to you first thread: there is no information in the data to from which we can deduce that Clorox Company
    should be under "Week 1-1,K.B,F". The fact that rows are listed in a certain order in the screenshoot is of no importance, because a table is an unordered object.
    But you said in another post that you have a timestamp column. Maybe that column is usable - maybe it is not. But at least it is a key that you have more columns that the ones you show.
    The best way to get help with this type of problems is to post:
    1) CREATE TABLE statement for your table(s).
    2) INSERT statements with sample data.
    3) The desired result given the sample.
    4) A short description of the actual buisness problem you are trying to solve.
    5) Which version of SQL Server you are using.
    This makes it easy to copy and paste into a query window to develop a tested solution. Screenshots with an insufficient amount of data is not going to help you very much.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Help on update query

    Just wanna ask help in update query
    SELECT T1.ttl_cr_adjust_amt,T2.ttl_cr_adjust_amt
    FROM invoice T1
    ,(SELECT bill_date
    ,acct_no
    ,sum(summ_amt) as ttl_cr_adjust_amt
    FROM INV_ACCT_SUMM
    WHERE summ_code='LSG02'
    GROUP by bill_date,acct_no) T2
    WHERE T1.bill_date=T2.bill_date
    AND T1.acct_no=T2.acct_no
    i want update T1.ttl_cr_adjust_amt= T2.ttl_cr_adjust_amt tht means i want give T2.ttl_cr_adjust_amt to T1.ttl_cr_adjust_amt the primary key for invoice is T1.bill_date,T1.acct_no
    how to do update stament
    i need efficent
    thanks is can help

    Be care, simpe UPDATE without WHERE clause will change ALL rows in
    invoice table dispite are there any related data in inv_acc_summ.
    (NOT tested !!!)
    UPDATE invoice T1
    SET T1.ttl_cr_adjust_amt = (SELECT sum(summ_amt)
    FROM INV_ACCT_SUMM T2
    WHERE summ_code='LSG02'
    AND T1.bill_date=T2.bill_date
    AND T1.acct_no=T2.acct_no
    WHERE (t1.bill_date, t1.acc_no) IN
    SELECT t2.bill_date, t2.acc_no
    FROM INV_ACCT_SUMM t2
    WHERE t2.summ_code='LSG02'
    Rgds.

  • Generic query on documenting and maintaining schema changes -Oracle 10g

    Hi All,
    This is a generic query and i was not getting any particular forum here to put this for suggestions and help.i have put this in the documentation forum also but havent got any inputs.
    Could you all please advise a good and easy way I can store all db related stuff including every detail and minutest change done.
    I work as a Oracle-DB developer and it has been particularly difficult to keep track the changes very much.
    We have a Development pipeline(a code base for development),Testing pipeline(another code base-for Testing)
    and then comes Production Deployment(another one for clients)
    Presently,we have all our DDL,SQL,etc everything scripts stored in a sort of shared location but keeping them updated with every change done
    in any of the above pipelines is very difficult and I end up finding discrepencies between the stored versions and what is in Testing and Production.
    I typically spend a good deal of time doing comparing the entire scripts,schema changes to try to figure out what the right and latest version of a script should be.
    So,need your inputs on any particular free tool,best practises and good process for tracking easily and also maintaining db changes.
    --Thanks
    Dev

    The problem with most configuration management systems is that they were made for files, not database objects. Files such as dlls get replaced by the new version upon deployment, but database tables do not. Tables get upgraded with alter scripts. So if you want to maintain create table scripts, you need to upgrade them with every change, as well as creating alter table scripts.
    For a free configuration management system, see http://subversion.tigris.org/. Such software will also do file comparisons including version comparison.
    For comparing installation scripts to existing schemas, I would create a new schema with the installation script and then compare that new schema to an existing schema using the schema comparison feature in Toad or PLSQL Developer.
    Alternately, you can forget about maintaining installation scripts and just take an export without data from your production or test schema whenever you need to create a new installation. You can also extract DDL from prod using the dbms_metadata package. Embarcadero Rapid SQL was also good for extracting DDL.

  • UPDATING the query in materialized view

    Hi,
    i have a little doubt in Materialized view. i created a materialized view and log with the following query,
    create table test_mv (a number ,b number )
    alter table test_mv add constraint t_pk primary key ( a );
    insert into test_mv values (1,2);
    insert into test_mv values(2,2);
    insert into test_mv values(3,2);
    insert into test_mv values(4,2);
    insert into test_mv values(5,2);
    commit;
    CREATE MATERIALIZED VIEW LOG ON test_mv
    WITH SEQUENCE, ROWID
    *(a,b)*
    INCLUDING NEW VALUES;
    CREATE MATERIALIZED VIEW product_sales_mv
    ENABLE QUERY REWRITE
    AS SELECT  b  from test_mv;
    Now i want to update the query in the MV as 'Select a from test_mv' . for that i tried with
    *'ALTER MATERIALIZED VIEW product_sales_mv AS SELECT a from test_mv;'*
    But it throwing error,
    Error starting at line 5 in command:
    alter  MATERIALIZED VIEW product_sales_mv   AS SELECT  b  from test_mv
    Error report:
    SQL Error: ORA-00933: SQL command not properly ended
    +00933. 00000 - "SQL command not properly ended"+
    *Cause:+   
    *Action:+
    i guess i am doing wrong. kindly help me here. i want to update it without drop and recreate.
    thanks,
    Jeevanand.Ke

    Hi Jeeva,
    No. you cannot add or drop columns to the materialized view using the ALTER Statement.
    To Change the Structure of the view , drop and re-create the materialized view.
    To Alter a materialized view log, You can use the ALTER MATERIALIZED VIEW LOG. By this,
    You can add new columns to a materialized view log.
    ALTER MATERIALIZED VIEW LOG ON sggi_mrps.emp ADD(deptno);Thanks,
    Shankar
    Edited by: Shankar Viji on Aug 24, 2012 2:11 AM

  • Is it possible to update a query with another query?

    I'm trying to update a query with another query (see attached
    code). Here's my setup: I've got a table in an Access database in
    which I enter a string into a form and update. This string
    corresponds to a single record in another table of the same
    datasource. The first table has only one record to provide the
    second, which has many and will have more. Basically what I'm
    wondering is: Is this a valid thing to do in coldfusion? If not
    please help with an alterate method. I'm still a novice at
    coldfusion.
    The overall effect I'm going for is to display the one record
    as a featured truck profile on the web site:
    www.truckerstoystore.net.
    I currently get an error when I try to display the page with the
    current query setup.
    Check this page to see the error:
    www.truckerstoystore.net/currentTOW2.cfm
    Help on this issue is very much appreciated.
    ------------------------------------------------------------------------------------------ -----------------------------------------------------------------------

    I think this is what you are after
    <!--- this query will get all the records from the DB
    --->
    <cfquery name="cTOW" datasource="tow">
    SELECT *
    FROM currentTOW
    <!--- Do you need to find a particular record in the
    database --->
    <!--- If so, then you need a 'where' clause in here
    --->
    </cfquery>
    <!-- Loop the cTOW query for each record returned -->
    <cfloop query="cTOW">
    <!--- For the record returned from the cTOW query you now
    need to update the table --->
    <!-- Update the table -->
    <cfquery name="currentTOW" datasource="tow">
    UPDATE Your tblName
    SET
    Dataname = cTOW.DataValue
    </cfquery>
    </cfloop>
    thats it
    PS: I think your original query needs modifying. To return
    the exact records that you want to update from the original table.
    ie: Primary and foreign key relationship

  • XML update a query?

    Hey, I'm trying to get an xml query to work which when you click a button will load the next items on the xml structure.
    so like
    private var currentQueryNumber : uint = 0;
    private function updateQuery(no:uint){
         {currentQueryNumber + 1};}
    isn't right...
    Anyone able to help me in what I should be putting.

    I think we need more details, and simplified yet "complete" code.
    How is currentQueryNumber used to update the query?
    Need more details.

  • Please help to modifiy this query for better performance

    Please help to rewrite this query for better performance. This is taking long time to execute.
    Table t_t_bil_bil_cycle_change contains 1200000 rows and table t_acctnumberTab countains  200000 rows.
    I have created index on ACCOUNT_ID
    Query is shown below
    update rbabu.t_t_bil_bil_cycle_change a
       set account_number =
           ( select distinct b.account_number
             from rbabu.t_acctnumberTab b
             where a.account_id = b.account_id
    Table structure  is shown below
    SQL> DESC t_acctnumberTab;
    Name           Type         Nullable Default Comments
    ACCOUNT_ID     NUMBER(10)                            
    ACCOUNT_NUMBER VARCHAR2(24)
    SQL> DESC t_t_bil_bil_cycle_change;
    Name                    Type         Nullable Default Comments
    ACCOUNT_ID              NUMBER(10)                            
    ACCOUNT_NUMBER          VARCHAR2(24) Y    

    Ishan's solution is good. I would avoid updating rows which already have the right value - it's a waste of time.
    You should have a UNIQUE or PRIMARY KEY constraint on t_acctnumberTab.account_id
    merge rbabu.t_t_bil_bil_cycle_change a
    using
          ( select distinct account_number, account_id
      from  rbabu.t_acctnumberTab
          ) t
    on    ( a.account_id = b.account_id
           and decode(a.account_number, b.account_number, 0, 1) = 1
    when matched then
      update set a.account_number = b.account_number

  • Help needed for writing query

    help needed for writing query
    i have the following tables(with data) as mentioned below
    FK*-foregin key (SUBJECTS)
    FK**-foregin key (COMBINATION)
    1)SUBJECTS(table name)     
    SUB_ID(NUMBER) SUB_CODE(VARCHAR2) SUB_NAME (VARCHAR2)
    2           02           Computer Science
    3           03           Physics
    4           04           Chemistry
    5           05           Mathematics
    7           07           Commerce
    8           08           Computer Applications
    9           09           Biology
    2)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2) SUB_ID1(NUMBER(FK*)) SUB_ID2(NUMBER(FK*)) SUB_ID3(NUMBER(FK*)) SUBJ_ID4(NUMBER(FK*))
    383           S1      9           4           2           3
    384           S2      4           2           5           3
    ---------I actually designed the ABOVE table also like this
    3) a)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2)
    383           S1
    384           S2
    b)COMBINATION_DET
    COMBDET_ID(NUMBER) COMB_ID(FK**) SUB_ID(FK*)
    1               383          9
    2               383          4
    3               383          2
    4               383          3
    5               384          4
    6               384          2          
    7               384          5
    8               384          3
    Business rule: a combination consists of a maximum of 4 subjects (must contain)
    and the user is less relevant to a COMB_NAME(name of combinations) but user need
    the subjects contained in combinations
    i need the following output
    COMB_ID COMB_NAME SUBJECT1 SUBJECT2      SUBJECT3      SUBJECT4
    383     S1     Biology Chemistry      Computer Science Physics
    384     S2     Chemistry Computer Science Mathematics Physics
    or even this is enough(what i actually needed)
    COMB_ID     subjects
    383           Biology,Chemistry,Computer Science,Physics
    384           Chemistry,Computer Science,Mathematics,Physics
    you can use any of the COMBINATION table(either (2) or (3))
    and i want to know
    1)which design is good in this case
    (i think SUB_ID1,SUB_ID2,SUB_ID3,SUB_ID4 is not a
    good method to link with same table but if 4 subjects only(and must) comes
    detail table is not neccessary )
    now i am achieving the result by program-coding in C# after getting the rows from oracle
    i am using oracle 9i (also ODP.NET)
    i want to know how can i get the result in the stored procedure itsef.
    2)how it could be designed in any other way.
    any help/suggestion is welcome
    thanks for your time --Pradeesh

    Well I forgot the table-alias, here now with:
    SELECT C.COMB_ID
    , C.COMB_NAME
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID1) AS SUBJECT_NAME1
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID2) AS SUBJECT_NAME2
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID3) AS SUBJECT_NAME3
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID4) AS SUBJECT_NAME4
    FROM COMBINATION C;
    As you need exactly 4 subjects, the columns-solution is just fine I would say.

  • HELP TO TUNE THIS QUERY

    Hi,
    I'm using below query in procedure.It's taking more more time can some one help to tune this query or advice to rewrite the query.
    Databse :10.1
    SELECT   'Reading Comprehension' TEST_NAME,T.TEST_END_DATE TEST_SESSION_DATE,
            C.POOL_VERSION_ID, I.CREATED_ON POOL_CREATED_DT,
            C.ITEM_ID, C.ITEM_RESPONSE_ID, S.STUDENT_ID_PK, C.RESPONSE_KEY, C.IS_CORRECT RESPONSE_IS_CORRECT,
            T.SCORE SCALE_SCORE, C.RESPONSE_DURATION, P.ITEM_KEY,
            T.TEST_SESSION_DETAIL_ID, SYSDATE CREATED_ON
           -- BULK COLLECT INTO TV_PSYCHO_DET
            FROM
            CAT_ITEM_PARAMETER P, CAT_ITEM_USER_RESPONSE C, TEST_SESSION_DETAIL T,
            TEST_SESSION S, ITEM_POOL_VERSION I, TEST_DETAIL D
            ,INSTITUTION E
            WHERE  TRUNC(T.TEST_END_DATE) BETWEEN TO_DATE('01-11-09','dd-mm-yy') AND TO_DATE('30-11-09','dd-mm-yy')
            AND D.TEST_NAME =  'Reading Comprehension'
            AND T.TEST_SESSION_STATUS_ID = 3
            AND I.POOL_AVAILABILITY='Y'
            AND P.PRETEST=0 AND C.RESTART_FLAG=0
            AND T.TEST_DETAIL_ID = D.TEST_DETAIL_ID
            AND S.TEST_SESSION_ID = T.TEST_SESSION_ID
            AND C.TEST_SESSION_DETAIL_ID = T.TEST_SESSION_DETAIL_ID
            AND S.INSTITUTION_ID=E.INSTITUTION_ID
            AND SUBSTR(E.INSTITUTION_ID_DISPLAY,8,3) <> '000'
            AND I.ITEM_ID = C.ITEM_ID
            AND P.ITEM_ID = I.ITEM_ID;expln plan
    Plan hash value: 3712814491                                                                                                      
    | Id  | Operation                                 | Name                        | Rows  | Bytes | Cost (%CPU)| Time     | Pstart|
    Pstop |                                                                                                                          
    |   0 | SELECT STATEMENT                          |                             | 50857 |  7151K| 93382   (1)| 00:18:41 |       |
          |                                                                                                                          
    |*  1 |  FILTER                                   |                             |       |       |            |          |       |
          |                                                                                                                          
    |*  2 |   HASH JOIN                               |                             | 50857 |  7151K| 93382   (1)| 00:18:41 |       |
          |                                                                                                                          
    |   3 |    PARTITION HASH ALL                     |                             |  2312 | 23120 |    25   (0)| 00:00:01 |     1 |
        5 |                                                                                                                          
    |*  4 |     TABLE ACCESS FULL                     | CAT_ITEM_PARAMETER          |  2312 | 23120 |    25   (0)| 00:00:01 |     1 |
        5 |                                                                                                                          
    |*  5 |    HASH JOIN                              |                             | 94938 |    12M| 93356   (1)| 00:18:41 |       |
          |                                                                                                                          
    |*  6 |     TABLE ACCESS FULL                     | ITEM_POOL_VERSION           |  9036 |   132K|    30   (0)| 00:00:01 |       |
          |                                                                                                                          
    |*  7 |     TABLE ACCESS BY GLOBAL INDEX ROWID    | CAT_ITEM_USER_RESPONSE      |     9 |   279 |    18   (0)| 00:00:01 | ROWID |
    ROWID |                                                                                                                          
    |   8 |      NESTED LOOPS                         |                             | 45349 |  5270K| 93325   (1)| 00:18:40 |       |
          |                                                                                                                          
    |*  9 |       HASH JOIN                           |                             |  4923 |   423K| 11377   (1)| 00:02:17 |       |
          |                                                                                                                          
    |* 10 |        INDEX FAST FULL SCAN               | INSTI_ID_NAME_COUN_DISP_IDX |  8165 |   111K|    18   (0)| 00:00:01 |       |
          |                                                                                                                          
    |* 11 |        HASH JOIN                          |                             |  4923 |   355K| 11359   (1)| 00:02:17 |       |
          |                                                                                                                          
    |* 12 |         TABLE ACCESS BY GLOBAL INDEX ROWID| TEST_SESSION_DETAIL         |  4107 |   148K|  6804   (1)| 00:01:22 | ROWID |
    ROWID |                                                                                                                          
    |  13 |          NESTED LOOPS                     |                             |  4923 |   278K|  6806   (1)| 00:01:22 |       |
          |                                                                                                                          
    |* 14 |           INDEX RANGE SCAN                | TEST_DETAIL_AK_1            |     1 |    21 |     2   (0)| 00:00:01 |       |
          |                                                                                                                          
    |* 15 |           INDEX RANGE SCAN                | TEST_SESSION_DETAIL_FK2_I   | 39737 |       |   102   (0)| 00:00:02 |       |
          |                                                                                                                          
    |  16 |         PARTITION HASH ALL                |                             |  1672K|    25M|  4546   (1)| 00:00:55 |     1 |
        5 |                                                                                                                          
    |  17 |          TABLE ACCESS FULL                | TEST_SESSION                |  1672K|    25M|  4546   (1)| 00:00:55 |     1 |
        5 |                                                                                                                          
    |* 18 |       INDEX RANGE SCAN                    | CAT_ITEM_USER_RESP_IDX1     |    18 |       |     3   (0)| 00:00:01 |       |
          |                                                                                                                          
    Predicate Information (identified by operation id):                                                                              
       1 - filter(TO_DATE('01-11-09','dd-mm-yy')<=TO_DATE('30-11-09','dd-mm-yy'))                                                    
       2 - access("P"."ITEM_ID"="I"."ITEM_ID")                                                                                       
       4 - filter("P"."PRETEST"=0)                                                                                                   
       5 - access("I"."ITEM_ID"="C"."ITEM_ID")                                                                                       
       6 - filter("I"."POOL_AVAILABILITY"='Y')                                                                                       
       7 - filter(TO_NUMBER("C"."RESTART_FLAG")=0)                                                                                   
       9 - access("S"."INSTITUTION_ID"="E"."INSTITUTION_ID")                                                                         
      10 - filter(SUBSTR("E"."INSTITUTION_ID_DISPLAY",8,3)<>'000')                                                                   
      11 - access("S"."TEST_SESSION_ID"="T"."TEST_SESSION_ID")                                                                       
      12 - filter(TRUNC(INTERNAL_FUNCTION("T"."TEST_END_DATE"))>=TO_DATE('01-11-09','dd-mm-yy') AND "T"."TEST_SESSION_STATUS_ID"=3   
                  AND TRUNC(INTERNAL_FUNCTION("T"."TEST_END_DATE"))<=TO_DATE('30-11-09','dd-mm-yy'))                                 
      14 - access("D"."TEST_NAME"='Reading Comprehension')                                                                           
      15 - access("T"."TEST_DETAIL_ID"="D"."TEST_DETAIL_ID")                                                                         
      18 - access("C"."TEST_SESSION_DETAIL_ID"="T"."TEST_SESSION_DETAIL_ID")                                                         
    43 rows selected.Edited by: user575115 on Dec 18, 2009 12:31 AM

    When you see something like ...
       7 - filter(TO_NUMBER("C"."RESTART_FLAG")=0)                                                                                    It means that Oracle had to do a conversion for you since you aren't using the proper data type in your query.
    That would mean IF there is an index on that column, it won't be useable...

  • HT4623 please help me update ios 4.3 in iphone 3g

    please help me update ios 4.3 in iphone 3g

    You can't. The iPhone 3G can only go as high as iOS 4.2.1. It hardware does not suport a higher iOS.
    BW this is the iPod touch forum.

  • Tabs only open in a new window. Ctl T opens a new window NOT a new tab help-last update this problem started. How do I set FF back to open tabs in 1 window

    Tabs only open in a new window. Ctl T opens a new window NOT a new tab help-last update this problem started 2 days ago. How do I set FF back to open tabs in 1 window?
    There is no plus sign and going into optins and changing settings has not worked. I have uninstall FF and reinstall-keeping my personalization-and that was no help.
    Right clicking on FF Icon to open a new tab, or going up to FF drop down tab and clicking on new tab both do not work.
    Help everything opens a new window not a new tab. there seems to be no way to reset this or to chose a different optin. I just downloaded new tabs at end addon and it didn't do a thing.

    as a first troubleshooting step - does it work like normally when you open & run firefox in [[Safe Mode|safemode]] by pressing the shift key while you open firefox (all other instances have to be closed before)...

  • Conditionally disabling record updation after query

    Dear members
    I've a single record block and I wanna conditionaly disable records updation after query has fetched data. Problem is that if I disable the record updation in Post-Query trigger then it checks the condition for the very first fetched record and it the condition is true, then Updation is disabled for all the fetched records, even if the next records dont meet the condition. I'm using forms-10g. Can u give a better solution??? thanx.

    you have to use SET_ITEM_INSTANCE_PROPERTY to modify only one record:
    BEGIN
        IF ... <your_condition> THEN
            SET_ITEM_INSTANCE_PROPERTY('YOUR_BLOCK.YOUR_ITEM1', UPDATE_ALLOWED, PROPERTY_FALSE);
        ELSE
            SET_ITEM_INSTANCE_PROPERTY('YOUR_BLOCK.YOUR_ITEM1', UPDATE_ALLOWED, PROPERTY_TRUE);
        END IF;
    END;

Maybe you are looking for

  • Max number of messages in PI queues

    All, I got a question from a customer wondering how many messages can pill up in XI queues until the system 'explods'. Anyone of you has an idea? Thanks a lot Dimitri

  • Dots on screen

    I have an Intel iMac 21 inch bought new in Feb 2010 and have started noticing small dots appearing on the screen like dead pixels but only when I use quick look on a video or image or when playing video back in iTunes or on You Tube. They kind of spa

  • After backing up on iTunes, the new update deleted everything!!

    Hi! I have an iPod 4g.  I backed up my information on the iTunes, then followed the steps to download the new update.  After all is said and done, which took about 20 minutes, everything is gone.  The music is what gets me hot since I do not have the

  • Agent Inbox - Workitem cannot be executed

    Hi Experts, We're using IC WinClient CRM 5.0. When I click in the workitem of the interaction center to open it occurs a message: "The workitem you selected cannot be executed.   Please use CIC standard functionality" Can anyone help me? I'll reward

  • Do macbook pro cases fit on macbook pro with retina display?

    I want to order a really nice speck case for macbook pro 13inch and i have got a macbook pro 13inch with retina display. Does it matter? Is there a difference between the two?