Triggering on when objects are INVALID

Hi, I'd like to have a trigger which compile an objects right after the object's status changes to INVALID. How can I do it ?
Is there any trigger event ? or should I use audit ?

Przemek Piechota wrote:
Hi, I'd like to have a trigger which compile an objects right after the object's status changes to INVALID. How can I do it ?
Is there any trigger event ? or should I use audit ?It's possible to have INVALID objects when making change on an object without checking its dependencies. So before making any change in the production database, you HAVE to be sure that no any objects will be INVALID by checking its dependencies from DBA_DEPENDENCIES view
There're generally two ways to be notifed when there are an INVALID object in any database
The first method is using OEM. Go to Administration->Metric and POlicy Settings-> and set the value for the Owner's Invalid Object Count metric and change Collection Schedule to any time you want
The second method is writing a shell script which queries (each 10 minute for example) all your databases (using status column of the DBA_OBJECTS view) and send you email or sms message when finds any INVALID object
Kamran Agayev A.
Oracle ACE
My Oracle Video Tutorials - http://kamranagayev.wordpress.com/oracle-video-tutorials/

Similar Messages

  • Why objects are invalid?

    Hi all,
    IS there any specificreasons why there are so many objects are invalid....
    [per]
    SQL>
    SQL> select A.Owner Oown,
    2 A.Object_Name Oname,
    3 A.Object_Type Otype,
    4 'Miss Pkg Body' Prob
    5 from DBA_OBJECTS A
    6 where A.Object_Type = 'PACKAGE'
    7 and A.Owner ='data'
    8 and not exists
    9 (select 'x'
    10 from DBA_OBJECTS B
    11 where B.Object_Name = A.Object_Name
    12 and B.Owner = A.Owner
    13 and B.Object_Type = 'PACKAGE BODY')
    14 union
    15 select Owner Oown,
    16 Object_Name Oname,
    17 Object_Type Otype,
    18 'Invalid Obj' Prob
    19 from DBA_OBJECTS
    20 where Object_Type in
    21 ('PROCEDURE','PACKAGE','FUNCTION','TRIGGER','PACKAGE BODY','VIEW')
    22 and Owner ='data'
    23 and Status != 'VALID'
    24 order by 1,4,3,2
    25 /
    data
    CHK_CURR_CORR_REG_ART_CO_DEEP
    FUNCTION Invalid Obj
    data
    FN_CHK_MAIN_ACT
    FUNCTION Invalid Obj
    data
    F_GET_FC_OPBAL
    FUNCTION Invalid Obj
    data
    F_GET_LC_OPBAL
    FUNCTION Invalid Obj
    data
    F_GET_MAIN_FC_OPBAL
    FUNCTION Invalid Obj
    data
    F_GET_MAIN_LC_OPBAL_DIV_1
    FUNCTION Invalid Obj
    data
    F_GET_MAIN_LC_OPBAL_DIV_DEPT
    FUNCTION Invalid Obj
    data
    F_GET_SUB_FC_OPBAL
    FUNCTION Invalid Obj
    data
    F_GET_SUB_LC_OPBAL
    FUNCTION Invalid Obj
    data
    ODB_CHK_COMB_FIRM
    FUNCTION Invalid Obj
    data
    O_DGET_JOB_AUTO_CSV_STS_AUTO
    FUNCTION Invalid Obj
    data
    O_DGET_JOB_CSV_STATUS
    FUNCTION Invalid Obj
    data
    O_GET_SRN_APPL_DT
    FUNCTION Invalid Obj
    data
    O_GET_SRN_CCT_REG_DT
    FUNCTION Invalid Obj
    data
    O_GET_SRN_NAME1
    FUNCTION Invalid Obj
    data
    O_GET_SRN_PAID_FEES
    FUNCTION Invalid Obj
    data
    REM_TEST
    FUNCTION Invalid Obj
    data
    SAR_TEST_FUNC
    FUNCTION Invalid Obj
    data
    CUSTOMER_UPDATE
    PACKAGE Invalid Obj
    data
    OVERLOAD_EG
    PACKAGE Invalid Obj
    data
    PACK1
    PACKAGE Invalid Obj
    data
    PDM_STUD_REFUND_PECS
    PROCEDURE Invalid Obj
    data
    PDM_STUD_REFUND_TCS
    PROCEDURE Invalid Obj
    data
    PDM_STUD_REG_CCT
    PROCEDURE Invalid Obj
    data
    PDM_STUD_REG_FND
    PROCEDURE Invalid Obj
    data
    PDM_STUD_REG_INT
    PROCEDURE Invalid Obj
    data
    PDM_STUD_REG_INT_DUMMY
    PROCEDURE Invalid Obj
    data
    PDM_STUD_REG_INT_DUP_FND_NO
    PROCEDURE Invalid Obj
    data
    PDM_STUD_REG_PE2ART
    PROCEDURE Invalid Obj
    data
    PDM_STUD_REG_PE2ART_RAGHU
    PROCEDURE Invalid Obj
    data
    PDM_STUD_REG_PEI
    PROCEDURE Invalid Obj
    data
    PDM_STUD_REG_PEII
    PROCEDURE Invalid Obj
    data
    ODBTRG101_ITEM
    TRIGGER Invalid Obj
    data
    ODBTRG103_REF
    TRIGGER Invalid Obj
    data
    ODBTRG437_AAT_ACVT_UPT_DAK
    TRIGGER Invalid Obj
    data
    ODBTRG437_AFCD
    TRIGGER Invalid Obj
    data
    ODBTRG437_AFCD_01
    TRIGGER Invalid Obj
    data
    ODBTRG437_AR
    TRIGGER Invalid Obj
    data
    ODBTRG437_BIN
    TRIGGER Invalid Obj
    data
    OV_MEM_FEE_CHK
    VIEW Invalid Obj
    data
    A_DUMMY
    PACKAGE Miss Pkg Body
    data
    CUSTOMER_UPDATE
    PACKAGE Miss Pkg Body
    data
    DBMS_LOCK
    PACKAGE Miss Pkg Body
    data
    ORNDBPKG_ART_FEE_COLL
    PACKAGE Miss Pkg Body
    data
    OVERLOAD_EG
    PACKAGE Miss Pkg Body
    data
    PACK1
    PACKAGE Miss Pkg Body
    data
    PKS
    PACKAGE Miss Pkg Body
    data
    RECEIPT_NO_VARIABLE
    PACKAGE Miss Pkg Body
    data
    STAGE_PACK
    PACKAGE Miss Pkg Body
    SQL> spool off

    SET SERVEROUTPUT ON;
    SET LINESIZE 1000;
    DECLARE
         || Cursor to all Object types in All_Objects belonging to the current user.
         CURSOR Cur_Object_Types
         IS
         SELECT DISTINCT Object_Type
           FROM All_Objects
          WHERE Owner = User;
         || Select the Invalid objects for the given object type.
         CURSOR Cur_Invalid_Objects(
              p_Object_Type     IN All_Objects.Object_Type%TYPE
         IS
         SELECT Object_Name, Status      
           FROM All_Objects
          WHERE Object_Type = p_Object_Type
            AND Status <> 'VALID'
            AND Owner = User;
         || Cursor to select the status of function based indexes.
         CURSOR Cur_FuncIdx
         IS
         SELECT Index_Name, FuncIdx_Status
           FROM User_Indexes
          WHERE FuncIdx_Status <> 'ENABLED';
         || Select all public synonyms created for current user object for
         || which underlying objects does not exists.
         CURSOR Cur_Synonyms
         IS
         SELECT Synonym_Name
               FROM All_Synonyms
          WHERE Owner = 'PUBLIC'
            AND Table_Owner = User
            AND Synonym_Name NOT IN (SELECT Object_Name
                                 FROM User_Objects);
         ln_LoopCnt     NUMBER;
         ln_TabIdxCnt     NUMBER;
         lv_Object_Type     VARCHAR2(100);
         lv_Object_Name     VARCHAR2(100);
         lv_Status     VARCHAR2(100);
         TYPE IObj_Type
         IS
         RECORD (Object_Type     VARCHAR2(100)
                ,Object_Name     VARCHAR2(100)
                ,Status          VARCHAR2(100)
         TYPE IObj_Tab_Type
         IS
         TABLE OF IObj_Type;
         IObj_Table      IObj_Tab_Type;
    BEGIN
         DBMS_OUTPUT.DISABLE;
         DBMS_OUTPUT.ENABLE(999999999999);
         DBMS_OUTPUT.PUT_LINE(CHR(10));
         IObj_Table   := IObj_Tab_Type();
         ln_TabIdxCnt := 0;
         FOR I IN Cur_Object_Types
         LOOP
                ln_LoopCnt := 0;
              FOR J IN Cur_Invalid_Objects(I.Object_Type)
              LOOP
                   ln_TabIdxCnt := ln_TabIdxCnt + 1;
                   ln_LoopCnt   := ln_LoopCnt + 1;          
                   IObj_Table.Extend;
                   IObj_Table(ln_TabIdxCnt).Object_Type := I.Object_Type;
                   IObj_Table(ln_TabIdxCnt).Object_Name := J.Object_Name;
                   IObj_Table(ln_TabIdxCnt).Status      := J.Status;
              END LOOP;
         IF ln_LoopCnt = 0 THEN
              ln_TabIdxCnt := ln_TabIdxCnt + 1;
              IObj_Table.Extend;
              IObj_Table(ln_TabIdxCnt).Object_Type := I.Object_Type;
              IObj_Table(ln_TabIdxCnt).Object_Name := ' ';
              IObj_Table(ln_TabIdxCnt).Status      := 'NONE';
         END IF;
         END LOOP;
         ln_LoopCnt := 0;
         FOR K IN Cur_FuncIdx
         LOOP
              ln_TabIdxCnt := ln_TabIdxCnt + 1;
              ln_LoopCnt   := ln_LoopCnt + 1;          
              IObj_Table.Extend;
              IObj_Table(ln_TabIdxCnt).Object_Type := 'FUNCTION BASED INDEX';
              IObj_Table(ln_TabIdxCnt).Object_Name := K.Index_Name;
              IObj_Table(ln_TabIdxCnt).Status      := K.FuncIdx_Status;
         END LOOP;
         IF ln_LoopCnt = 0 THEN
              ln_TabIdxCnt := ln_TabIdxCnt + 1;
              IObj_Table.Extend;
              IObj_Table(ln_TabIdxCnt).Object_Type := 'FUNCTION BASED INDEX';
              IObj_Table(ln_TabIdxCnt).Object_Name := ' ';
              IObj_Table(ln_TabIdxCnt).Status      := 'NONE';
         END IF;     
         ln_LoopCnt := 0;
         FOR L IN Cur_Synonyms
         LOOP
              ln_TabIdxCnt := ln_TabIdxCnt + 1;
              ln_LoopCnt   := ln_LoopCnt + 1;          
              IObj_Table.Extend;
              IObj_Table(ln_TabIdxCnt).Object_Type := 'PUBLIC SYNONYM WITHOUT UNDELYING OBJECT IN SCHEMA '||USER;
              IObj_Table(ln_TabIdxCnt).Object_Name := L.Synonym_Name;
              IObj_Table(ln_TabIdxCnt).Status      := 'UNDERLYING OBJECT NOT FOUND';
         END LOOP;
         IF ln_LoopCnt = 0 THEN
              ln_TabIdxCnt := ln_TabIdxCnt + 1;
              IObj_Table.Extend;
              IObj_Table(ln_TabIdxCnt).Object_Type := 'PUBLIC SYNONYM WITHOUT UNDELYING OBJECT IN SCHEMA '||USER;
              IObj_Table(ln_TabIdxCnt).Object_Name := ' ';
              IObj_Table(ln_TabIdxCnt).Status      := 'NONE';
         END IF;          
         IF IObj_Table.COUNT > 0 THEN
              FOR I IN 1..IObj_Table.COUNT
              LOOP
              lv_Object_Type     := IObj_Table(I).Object_Type;     
              lv_Object_Name     := IObj_Table(I).Object_Name;     
              lv_Status     := IObj_Table(I).Status;
                   IF I = 1 THEN
                        DBMS_OUTPUT.PUT_LINE('+-----------------------------------------------------------------------------------------------------------------------------+');
                        DBMS_OUTPUT.PUT_LINE(RPAD('|                                               LIST OF INVALID OBJECTS',134,' ')||'|');
                        DBMS_OUTPUT.PUT_LINE('|-----------------------------------------------------------------------------------------------------------------------------|');
                        DBMS_OUTPUT.PUT_LINE(RPAD('|                   OBJECT TYPE                              |               OBJECT NAME        |               STATUS',134,' ')||'|');
                        DBMS_OUTPUT.PUT_LINE('|-----------------------------------------------------------------------------------------------------------------------------|');
                   END IF;
                   DBMS_OUTPUT.PUT_LINE('| '||RPAD(lv_Object_Type,59,' ')||'| '||RPAD(lv_Object_Name,32,' ')||' | '||RPAD(lv_Status,28,' ')||'|');
              END LOOP;
              DBMS_OUTPUT.PUT_LINE('|-----------------------------------------------------------------------------------------------------------------------------|');
         ELSE
              DBMS_OUTPUT.PUT_LINE('THERE ARE NO INVALID OBJECTS IN SCHEMA '||USER||'.');
         END IF;
         DBMS_OUTPUT.PUT_LINE(RPAD('| NOTE: ',134,' ')||'|');
         DBMS_OUTPUT.PUT_LINE(RPAD('|      If you find any object in status INVALID / DISABLED / UNDERLYING OBJECT NOT FOUND, then ',134,' ')||'|');
         DBMS_OUTPUT.PUT_LINE(RPAD('|      execute the procedure RECOMPILE_INVALID_OBJECTS to fix the same.',134,' ')||'|');
         DBMS_OUTPUT.PUT_LINE('+-----------------------------------------------------------------------------------------------------------------------------+');
    END;
    [\pre]
    HTH..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • [svn:fx-trunk] 8551: Fix for focusSkin and errorSkin to account for bogus bitmap snapshots when objects are 3D transformed .

    Revision: 8551
    Author:   [email protected]
    Date:     2009-07-14 11:31:50 -0700 (Tue, 14 Jul 2009)
    Log Message:
    Fix for focusSkin and errorSkin to account for bogus bitmap snapshots when objects are 3D transformed.
    Bugs: SDK-17766
    Reviewer: Glenn
    QE Notes: None
    Doc Notes: None
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-17766
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/ErrorSkin.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/skins/spark/FocusSkin.as

  • System tablespace space not regained when objects are dropped

    Mine is a Oracle 10g 10.2 on windows.
    I am importing a export file into a user ,It takes some amount of space in SYSTEM and another tablespace .When I drop the user space in system tablespace is not coming back. ANY IDEA WHY
    BEFORE IMPORT
    SQL> select sum(bytes)/1024/1024 from dba_segments where owner='SYSTEM';
    SUM(BYTES)/1024/1024
    22.1875
    SQL> select sum(bytes)/1024/1024 from dba_segments where owner='SYS';
    SUM(BYTES)/1024/1024
    544.1875
    SQL> select sum(bytes)/1024/1024 from dba_segments where segment_name='SOURCE$';
    SUM(BYTES)/1024/1024
    41
    I use the following commands to import
    SQL>create user <username> identified by <password> default tablespace <tsname> quota unlimited on <tsname>;
    SQL>grant create session,imp_full_database to <username>;
    imp system file=filename.dmp log=logname.log fromuser=<username> touser=<username> statistics=none
    AFTER IMPORT
    SQL> select sum(bytes)/1024/1024 from dba_segments where segment_name='SOURCE$';
    SUM(BYTES)/1024/1024
    53
    SQL> select sum(bytes)/1024/1024 from dba_segments where owner='SYSTEM';
    SUM(BYTES)/1024/1024
    22.1875
    SQL> select sum(bytes)/1024/1024 from dba_segments where owner='SYS';
    SUM(BYTES)/1024/1024
    728.375
    AFTER DROPPING THE USER/SCHEMA
    SQL> select sum(bytes)/1024/1024 from dba_segments where owner='SYS';
    SUM(BYTES)/1024/1024
    728.375
    SQL> select sum(bytes)/1024/1024 from dba_segments where owner='SYSTEM';
    SUM(BYTES)/1024/1024
    22.1875
    SQL> select sum(bytes)/1024/1024 from dba_segments where segment_name='SOURCE$';
    SUM(BYTES)/1024/1024
    53
    I even tried deleting the objects first and then dropping the user
    SQL> delete from source$ where obj# in(select object_id from dba_objects where owner='USERNAME');
    211252 rows deleted.
    SQL> commit;
    Commit complete.
    SQL> drop user USERNAME cascade;
    User dropped.
    The space used by the schema on system tablespace is not coming back.

    Hi user509593!
    Adding objects to a tablespace requires space in that tablespace. This space is managed in segments and extents. If an extent is fully used (that means 100 % usage) a new extent will be added to a segment. Oracle uses a mechanism called "High Water Mark" to mark the last used extent.
    Your problem is that oracle don't set this High Water Mark back if you are dropping objects from a tablespace. Once an extent is marked as it it retains marked as used.
    Before Adding Objects:
    u = used Extent
    x = free Extent
    | = High Water Mark
    uuuuuuxxxxx
    ...........|
    After Adding Objects:
    uuuuuuuxxxx
    ............|
    After dropping objects:
    uuuuuuuxxxx
    ............|
    The only chance to get your "unused" space back is to reorganized your tablespace. But before you reorganize something please read the documentation to know all about the costs and traps that comes with reorganization.
    Hope this help!
    null

  • Iweb background stretches when objects are moved around the page

    Hello, I am creating a simple site in iWeb and I cannot get my background image to be consistent through all of my pages. What I mean is the position of the image varies slightly through the pages. In my home page (and all of my other pages)the background is set to "Image Fill" and "Scale to Fill", and the page sizes are all the same at 700px wide by 480px high. I have the nav bar and page heading/title positioned exactly the same on all pages also.
    I notice that when I move around text boxes that are in a page the background stretches or shrinks depending on the position of the box, and am assuming that this has something to do with it, but like I said before, the navigation and header "text boxes" are all positioned the same. Is there any way to turn off this scaling of the background when moving objects around the page? Or does anyone have any suggestions on how to fix this image and make it consistent through all of my pages? Thanks for your help.

    When you set as image as a page background and set it to scale for fill, when you move text downward, extending the length of the page, the image size will change no matter what fill option is used, fit, fill stretch or tile. Using the original size will keep the image exactly the same in all instances but if the page is lengthened beyond the images height you'll get the browser's background to show in the page. But, if you size the image you're using to be taller than any of your pages it will be fixed in all your pages. NOTE: You can use this method only on White and Black blog layouts. However it the blog length gets long it will extend beyond the image height. So set up the image and blog accordingly.
    Try using the image for the browser background and set the page background to none. That will keep the image the same for all layouts. If you have a blog you can change the theme to White or Black, depending on the font color needed, and can use the image for browser background method. The image will need to be large enough to fill the browser's window and will be locked at the left edge. That is if the browser window is widened the image will not be centered but set at the left side of the window.

  • Graphic Styles multiplying when objects are copied

    I have some groups containing lines with graphic styles. Sometimes, when I copy and paste these groups I get new graphic styles with name plus the number 1, 2, 3...
    E.g. "Foo" -> "Foo 1", later "Foo 1" -> "Foo 2"
    Do you know how to avoid this happening?

    That could help - but it seems that it would kill your CS5 specific stuff if you opened the file up in an earlier version?
    Is that not true? Would I lose any other data?
    I tried bcl5462's comment below but the import into cs4 failed completely (I get a "PDF Objects that have been Reinterpreted error" and none of my original document remains), and I'm not sure if it even deals with graphic styles (from http://kb2.adobe.com/cps/408/kb408008.html )
    Open the file with Illustrator CS5 (trial)
    From Window > Actions, "Delete Unused Panel Items"
    Also - try clicking on the brushes panel and selecting all unused brushes - delete.
    Select all unused swatches and delete.
    Save the file.
    Open the file with an older version of Illustrator (e.g. Illustrator CS3)
    This will inform you the file was saved in a newer version of Illustrator and the file will be imported.
    In this process Illustrator CS3 will not import the corrupted brushes or swatches.
    Save the cleaned file.

  • LVOOP challenge question: How is Memory managed when objects are data members?

    Background:
    I am working on a compact field point and am sensitive to memory usage.
    I would like to know hoe the labview Realtime compiler treats my code (It is a bit of a Black Box.
    My Class contains other objects:
    and then later in my code I use what I call Run Loops: Multiple Parallel loops executing various threads: Below.
    It also calls some of the classes Ancestor objects:
    My question is: does this approach make a second copy of the embedded(Included) objects.
    If so does anyone have any clever ideas about how to avoid this?
    Thanks in advance.
    iTm
    iTm - Senior Systems Engineer
    uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT

    tst,
    Thanks for the Link,  And the response.
    In the spirit of sharing ideas, if my application wasn't a pyramid of classes, it would be an easier solution:
    Use in-place structures, that way they won't be copied
    The hearteache is that when you do that, you lose access to the parent data and functions.
    Plan "b" is to convert the embedded objects to Refnums, That way only the Pointer is retained by the parent class.
    The Drawback is that they can be painful to code as a Data value reference read is required for each thread and may only be used from within the object. Refnums don't polymorph easily
    I have also unearthed some very odd compiler behavior.
    iTm L
    Plan "C" is to "Check out" the Object replacing it with a default. and hope the compiler doesn't allocate memory for it.
    iTm - Senior Systems Engineer
    uses: LABVIEW 2012 SP1 x86 on Windows 7 x64. cFP, cRIO, PXI-RT

  • Looking up values from Map/HashMap  when Objects are used as keys

    I'm trying to understand why Map/HashMap don't test for equals() when looking up a key ( which is an Object that overrides equals() and hashCode()) in the Map.
    I've written this code, based on some code from the SCJP book, but it is not exactly the same, this code talks about a different issue not addressed in the book.
    I've added my questions inside the comments below, I think that is the best way I can ask it.
    import java.util.*;
    class Bird{
         public String name;
         public Bird(String name){
              this.name = name;
         //Override equals()
         public boolean equals(Object o){
              if(((Bird)o).name.equals(this.name)){
                   return true;
              }else{
                   return false;
            //Override hashCode
         public int hashCode(){
              return name.length();
    class TestMapLookup{
         static public void main(String[] args){
              Map<Object, Object> hashMap = new HashMap<Object, Object>();
              Bird b = new Bird("crow");
              hashMap.put(b, "somevalue");
              //according to the book, the map object calls the key's (Bird object's)
              //hashCode() first and then equals()
              //to find this key in the map
              System.out.println(hashMap.get(b));
              //Using the b reference to lookup value
              //ouputs - somevalue
              System.out.println(hashMap.get(new Bird("crow")));
              //Using a new Bird object to lookup value
              //outputs - somevalue
              //because Bird overrides equals and hashCode
              //otherwise we'd get null
              //Now change the name of the bird in the b reference
              b.name = "sparrow";
              //Notice that the crow's hashCode is 4
              //sparrow's hashCode is 7 , in the above implementation of hashCode
              System.out.println(hashMap.get(b));
              //Again using b reference to lookup value
              //ouputs - null
              //because the hashCode of b.name does not match
              //the hashCode of any of the keys stored in the map
              System.out.println(hashMap.get(new Bird("crow")));
              //This also outputs null
              //for the same reason that there's no key in the map
              //with a hashcode of 7
              //This is where it becomes strange......................
              //Change the name of the bird in the b reference
              //so that the new name has the same hashCode, as the key in the map
              b.name = "dove";
              System.out.println(hashMap.get(b));
              //In the above - the hashCode matches
              //but equals() fails
              //even though equals() fails, the key is still located and the value is output
              //output is "somevalue"
              //same here:
              b.name = "1234";
              System.out.println(hashMap.get(b));
              //output is "somevalue" instead of null
              b.name = "abcd";
              System.out.println(hashMap.get(b));
              //output is "somevalue" instead of null
              //why does it output "somevalue" instead of null , even though when the map
              //looks up the key , equals() returns false?     
              System.out.println(hashMap.get(new Bird("crow")));
              //In this case ( new Bird reference ) it prints null
    }I'm aware of best practices in coding and coding conventions but haven't used them here, because this is in preparation for SCJP - which tests on a lot of different things.
    I appreciate any info.

    It is correct that b is referring to the same object that the map's key is pointing to, but why does the following
    print null , instead of "somevalue"?
    at these lines in the code above.
    b.name = "sparrow";
    System.out.println(hashMap.get(b));Because the hashCode used when you stored b was 4, and now it's 7. You should read the Wikipedia article on Hashtable, but a simplistic explanation is that a HashMap has a bunch of "buckets," say 10, each indexed with a number 0-9. To decide which bucket to put a new key-value pair in, you take the hashcode (say 2112) and take the remainder of hashcode/number of buckets (in this case, 2112%10=2). So when you store the key-value, it gets "put" in this bucket.
    When you change the hashcode of b by changing its name attribute, it doesn't change the fact that the pair is in that bucket. But, it now looks in the wrong bucket and so can't find the pair.
    A hashtable gets its good efficiency by not having to look through all values to find the pair. It can jump directly to the correct bucket, which takes constant time instead of being dependent on the number of items in the collection.
    endasil wrote:
    You should never, ever change an object being used as a key in a map.I guess this is a best practice, I just wanted to try changing the key object to test a few things for SCJP, which does not test on coding best practices but tests on how the code behaves.Yep, and what you should take away is that this is WHY it's bad to change the key :).

  • Illus. CS3 Windows: Im having trouble selecting text when objects are beneath it.

    Technically, I CAN select text, its just a pain in the ***. There is a very fine line to click on and I usually end up selecting the obnect that the text is on top of. If someone knows another way to do this I will be most appreciative.
    Cheers,

    Have you perhaps enabled the Type Object Selection by Path Only option (see Illustrator preferences) ?
    If so, disable it.

  • Time when Oracle object become invalid

    We can find if there are invalid objects in the database.
    But is there a way to find when the object become invalid. I am interested in finding the time when object become invalid.
    Let me know if Oracle can tell this information.
    Thank you.
    --harvey                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi harvey;
    Please check below thread:
    Determine when objects become invalid
    Determine when objects become invalid
    http://stackoverflow.com/questions/1467604/determining-when-an-oracle-database-object-became-invalid
    Also see:
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28310/general007.htm
    Regard
    Helios

  • Why Synonym becomes INVALID when changes are made on the related object ?

    Hi all,
    WHY SYNONYMS becomes invalid when changes are made on related OBJECTS ?
    Is there any specific reasons for this.?
    Is there any method or procedures to make the synonym VALID as soon as the we perform any alteration on the related object.
    Thanks
    Himabala

    Synonym will be validated when it is accessed, no need to take an action.

  • Object Class Invalid when downloading the pricing procedure from ECC to CRM

    Hi,
    I want to download the pricing procedure for that I have created the ZDNL_CUST_CND which contains only the following tablesT683, T683S, T683T and T683U.
    When I check in R3AM1 status is Red.
    The following Error have been found in SLG1
    •     Object class invalid
    •     Error in inbound data check
    Message no. CND_MAP120
    Diagnosis
    During the receiving inspection, serious errors were found in the consistency of the exchange object.
    System Response
    Data exchange is terminated
    •     Data exchange terminated     
    Message no. CND_MAP122
    Diagnosis
    Data exchange has been terminated due to serious errors. No exchanged data has been posted in the system.
    The following Error has been found in SMQ1
    •     R3AD_CONDITIONS     STOP
    Details of STOP
    Set by Host name: litldq; Transaction: ; Report: SAPMSSY1
    I have checked the connection, everything is perfect.
    What may be the problem?
    Thanks

    Hi,
      Please try to re-generate the adapter object (ZDNL_CUST_CND) services using trx.
    SMOGGEN
    . After this, try re-running the load.
    I assume that your CRM inbound mapping module are correctly coded. If the problem persists, try de-registering the R3AD_CONDITIONS inbound queue using trx.
    SMQR
    and then debugging the inbound queue from the same trx. after re-starting the load.
    Reward if this helps!
    Regards,
    Sudipta.

  • REUSE SETTINGS supresses error messages when compiling an invalid object

    Hello,
    my test:
    Create a table and a packaged procedure referencing the table. Then drop the table and recompile the package:
    CREATE TABLE x (
        y     NUMBER
    CREATE OR REPLACE PACKAGE y
    AS
    PROCEDURE z;
    END y;
    SHOW ERRORS
    CREATE OR REPLACE PACKAGE BODY y
    AS
    PROCEDURE z
    IS
      v_count PLS_INTEGER;
    BEGIN
      SELECT COUNT(*)
      INTO v_count
      FROM x;
    END z;
    END y;
    SHOW ERRORS
    DROP TABLE x;
    PROMPT 1.Compile package
    ALTER PACKAGE y COMPILE;
    SHOW ERRORS
    PROMPT 2.Compile package body
    ALTER PACKAGE y COMPILE BODY;
    SHOW ERRORS
    PROMPT 3.Compile package with "REUSE SETTINGS"
    ALTER PACKAGE y COMPILE REUSE SETTINGS;
    SHOW ERRORS
    PROMPT 4.Compile package body with "REUSE SETTINGS"
    ALTER PACKAGE y COMPILE BODY REUSE SETTINGS;
    SHOW ERRORS
    SELECT object_name
          ,object_type
    FROM   user_objects
    WHERE  status = 'INVALID';
    --DROP PACKAGE y;Partly unexpected output
    Tabelle wurde erstellt.
    Package wurde erstellt.
    Keine Fehler.
    Package Body wurde erstellt.
    Keine Fehler.
    Tabelle wurde gelöscht.
    1.Compile package
    Warnung: Paket wurde mit Kompilierungsfehlern geõndert.
    Keine Fehler.
    2.Compile package body
    Warnung: Paketrumpf wurde mit Kompilierungsfehlern geõndert.
    Fehler bei PACKAGE BODY Y:
    LINE/COL ERROR
    8/3      PL/SQL: SQL Statement ignored
    10/8     PL/SQL: ORA-04044: procedure, function, package, or type is not
             allowed here
    3.Compile package with "REUSE SETTINGS"
    Warnung: Paket wurde mit Kompilierungsfehlern geõndert.
    Keine Fehler.
    4.Compile package body with "REUSE SETTINGS"
    Warnung: Paketrumpf wurde mit Kompilierungsfehlern geõndert.
    Keine Fehler.
    OBJECT_NAME     OBJECT_TYPE
    Y               PACKAGE BODY
    1 Zeile wurde ausgewõhlt.It says
    - Table created
    - Package created
    - Package body created
    - Table dropped
    - Package header compiled with errors (why?)
    - Package body compiled with errors (shown error is expected)
    - Package header compiled with errors (again why?)
    - Package body compiled with errors (no errors shown)
    So why is the header compiled with errors, when the object is valid.
    And why is no error shown for COMPILE REUSE SETTINGS when there are errors for the body?
    I use REUSE SETTINGS when recompiling invalid objects that were compiled for debug with
    ALTER PACKAGE abc COMPILE PLSQL_DEBUG = TRUE REUSE SETTINGSRegards
    Marcus
    Version:
    SQL*Plus: Release 10.2.0.1.0 - Production on Di Jan 27 12:45:20 2009
    Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options

    Hi,
    From SQL Reference Manual [REUSE SETTINGS|http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_1007.htm#BGBGEIGD]:
    Specify REUSE SETTINGS to prevent Oracle from dropping and reacquiring compiler switch settings. With this clause, Oracle preserves the existing settings and uses them for the recompilation of any parameters for which values are not specified elsewhere in this statement.
    For backward compatibility, Oracle Database sets the persistently stored value of the PLSQL_COMPILER_FLAGS initialization parameter to reflect the values of the PLSQL_CODE_TYPE and PLSQL_DEBUG parameters that result from this statement.
    Regards,

  • When an Object got invalid?

    Hi All,
    Is there any way to findout when(date / time) an object got invalid, as the LAST_DDL_TIME and TIMESTAMP columns of the DBA_OBJECTS do not change if the parent object gets affected and child become invalid right?

    Enfact I want to know at what time an object became INVALID,
    there are 2 n more DBA's applying the Script for the Database, One is working on an assignment to remove the unwanted Objected from DB and the other is working on normal development , now both executed their script which invalidated around 200 Objects, I want to know Invalid objects by each action (Cleanup or Development action) As I am aware of the time the statements were executed, one way to get the list, is to revert the changes and work pro-activly, but it would be very easy for me if I group the list of objects invalidated by the time.otherwise I would have to get the list of all objects before and after every action activity, which is frequent
    Thanks

  • Workflows not triggered when documents are created in Doc Set via Content Organizer

    The following is my scenario:
    A document set (containing several documents) is created in Library A on Site A
    Using Send To, the Document Set is sent to the Drop Off Library on Site B (a different Site Collection)
    A Content Organizer rule then moves the Document Set and its documents to destination Library B
    In Library B I have defined a workflow (using Visual Studio 2012) that is triggered when new item is create
    When the Document Set arrives in Library B from the Drop Off library (i.e. when the Content Organizer moves the Doc Set to Library B), the workflow is triggered (and executes) on the Document Set, but it is NOT triggered on the documents within the Document
    Set.   How can I get the workflow to trigger on the documents within the set when they are created via the Content Organizer rule?
    The interesting thing is that if I manually add another document to the Document Set in Library B, the workflow is triggered on that document.  It just does not trigger when the documents are created via the Content Organizer.

    Hi,
    In edit Content Organizer rule page, I see there is an option as Automatically create a folder for each unique value of a property:
    However, unlike the drop down used in the property based filters above, this drop down *only* contains properties that are required by your content type. 
    This is done to prevent adding folders that have no values for a property. 
    If you need to put similar documents to the same folder, you could consider making use of this feature.
    Regards,
    Rebecca Tu
    TechNet Community Support

Maybe you are looking for

  • My iPod Nano no longer randomly shuffles

    All of a sudden, my iPod Nano no longer moves randomly to the next song, but repeats the same song over and over.  I have to manually "shuffle."  The shuffle indicator does not seem to activate.  Any advice?

  • Problems booting OSX 10.2 on a Beige G3

    Hello, I bought a Beige G3 minitower today just to fool around with. It's a pretty decent machine, here are the specs: G3 292mhz 256MB RAM 6GB HDD (have another 6GB but I need a new IDE cable) So it came with OS 9.2.2 on it and I know for a fact that

  • Import directive

    Hi, what does it really do the import directive/statement? Please don't tell me it includes all the bytecodes from the packages used in the bytecodes generated from the java class which use them. Please help. Marla

  • My iphone dont show image artist

    hi please help me my iphone model 5s is dont show arist image in music player serial number : F1*****F9R IMEI/MEID : ***** Update : IOS 7.1.2 <EDITED by HOST>

  • W2K server w/PCI CAN cards freezes. Any ideas?

    We are running a pick-to-light system on the CANbus and the server locks up for no reason. Only recovery is to restart.