Isn't this Trigger code error prone?

Version: 10g Release 2
I have come across a Trigger code where the :NEW pseudo variable is being assigned value like
SELECT emp_oid into :new.emp_oid FROM emp_dtls WHERE EMP_NO =:NEW.EMP_OID;Apparently, the code is working fine. But isn't this error prone?

It is not very useful to post this single line. One doesn't even know on which table this trigger fires, nor the relationship with the affected table and the emp_dtls table, nor whether an exception handler was programmed.
(Probably not).
If my assumption is correct no exception handler was programmed, this would have resulted in kick-ass time, as the code may result in either the NO_DATA_FOUND exception or the TOO_MANY_ROWS exception.
Anyone writing that kind of code needs to be escorted to the door of unemployment immediately.
BTW will anything bad happen if you post a question consisting of more than 1 line. Salary substracted? Fingers chopped off by your boss?
Sybrand Bakker
Senior Oracle DBA

Similar Messages

  • How can i minimize this  trigger code

    Hi,
    I've written the following trigger ,based on the requirement...
    Requirement is following:
    After updating the src table(EMPS) corresponding data need to be replicated to dest (REP_EMPS)
    While UPDATING ('STATUS') the following conditions to be matched
    *(1) updating from any char to 'V then modtp= 'I' AND 'D'*
    *(2) updating from 'V r to any char then modtp= 'I' AND 'D'*
    *(3) ANY TO ANY THEN modtp='U'*
    *(4) while deleting modtp='D'*
    So the following trigger is working fine ..
    But my doubt is can i even be minimize the code so as to achieve the requirement
    CREATE TABLE TEST.EMPS
      EMPNO   NUMBER,
      ENAME   VARCHAR2(11 BYTE),
      STATUS  CHAR(1 BYTE)
    CREATE TABLE TEST.REP_EMPS
      ENO    NUMBER,
      ENM    VARCHAR2(11 BYTE),
      STS    CHAR(1 BYTE),
      MODTP  CHAR(1 BYTE)
    )Trigger:
    CREATE OR REPLACE TRIGGER TEST.EMP_UDAR1
    AFTER UPDATE OR DELETE
    OF ENAME,STATUS
    ON TEST.EMPS  REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    nmodtp char(1):='U';
    omodtp char(1):='D';
    nempno EMPS.EMPNO%TYPE:=:NEW.EMPNO;
    oempno EMPS.EMPNO%TYPE:=:OLD.EMPNO;
    nename EMPS.ENAME%TYPE:=:NEW.ENAME;
    oename EMPS.ENAME%TYPE:=:OLD.ENAME;
    nstatus EMPS.STATUS%TYPE:=:NEW.STATUS;
    ostatus EMPS.STATUS%TYPE:=:OLD.STATUS;
    docon number:=0;
    dodiscon number:=0;
    BEGIN
    IF (UPDATING('STATUS') AND (:NEW.STATUS='V' OR :OLD.STATUS='V')) THEN
      docon:=1;
      nmodtp:='I';
    ELSIF (NOT DELETING) THEN
      docon:=1;
    END IF;
    IF DELETING or (UPDATING('STATUS') AND (:NEW.STATUS='V' OR :OLD.STATUS='V')) THEN
      dodiscon:=1;
        END IF;
    INSERT ALL
    WHEN (docon=1) THEN
    INTO REP_EMPS(ENO,ENM,STS,modtp)
    VALUES(nempno,nename,nstatus,nmodtp)
    WHEN (dodiscon=1) THEN
    INTO REP_EMPS(ENO,ENM,STS,modtp)
    VALUES(oempno,oename,ostatus,omodtp)
    SELECT nempno AS nempno,
           oempno AS oempno,
           nename AS nename,
           oename AS oename,
           nstatus AS nstatus,
           ostatus AS ostatus,
           nmodtp AS modtp,
           omodtp AS modtp
    FROM DUAL;
    END;
    /i tried with following in the if condition but not getting the required output
    IF (UPDATING('STATUS') AND (:NEW.STATUS='V' OR :OLD.STATUS='V')) THEN
      docon:=1;
      nmodtp:='I';
    ELSIF (DELETING) or (UPDATING('STATUS') AND (:NEW.STATUS='V' OR :OLD.STATUS='V')) THEN
      dodiscon:=1;
    ELSE
      docon:=1;
    END IF;thank you,
    josh.....

    Hope this helps you
    create or replace
    TRIGGER EMP_UDAR1
    AFTER UPDATE OR DELETE
    OF ENAME,STATUS
    ON EMPS  REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    DECLARE
    -- no need to declaer other variables here.
    nmodtp char(1):='U';
    omodtp char(1):='D';
    docon number:=0;
    dodiscon number:=0;
    BEGIN
      IF (UPDATING('STATUS') AND (:NEW.STATUS='V' OR :OLD.STATUS='V')) THEN
        docon:=1;
        nmodtp:='I';
      ELSIF (NOT DELETING) THEN
        docon:=1;
      END IF;
      IF DELETING or (UPDATING('STATUS') AND (:NEW.STATUS='V' OR :OLD.STATUS='V'))
      THEN
        dodiscon:=1;
      END IF;
    INSERT ALL
        WHEN (docon=1) THEN
          INTO REP_EMPS(ENO,ENM,STS,modtp)
          VALUES(:New.empno,:New.ename,:New.status,:New.modtp) -- Use the :NEW.column values available
        WHEN (dodiscon=1) THEN
          INTO REP_EMPS(ENO,ENM,STS,modtp)
          VALUES(:OLD.empno,:OLD.ename,:OLD.status,:OLD.modtp)-- Use the :OLD.column values available
    SELECT *  FROM DUAL; -- You can do this
    END;

  • What is wrong with this trigger code?

    Hi folks,
    Just wondering whether I might be missing something here about Oracle 9i, that one of you might notice, either from the syntax perspective, or regarding a bug? The code below compiles in the database I have, but the trigger does not fire, and no data is being inserted into the tables. The trigger is owned by sys, and the insert statements are in dynamic sql because I don't want the trigger not to compile if ever the tables are deleted from the b1dev schema.
    Incidentally, this same trigger works well on Oracle 10.2.1.0 and Oracle 11.1.0. Any feedback would be much appreciated.
    CREATE OR REPLACE TRIGGER cc_LogOff_Trig
        BEFORE LogOff ON DATABASE
        DECLARE
           LogOff_sid   PLS_INTEGER;
           LogOff_Time  DATE := SYSDATE;
           Table_1      VARCHAR2(30) := 'CC_SESSION_EVENT_HISTORY';
           Table_2      VARCHAR2(30) := 'CC_SESSTAT_HISTORY';
           Table_Count  NUMBER;
           v_sql1       VARCHAR2(4000);
           v_sql2       VARCHAR2(4000);
        BEGIN
          SELECT sId
          INTO   LogOff_sId
          FROM   sys.v$MysTat
          WHERE  ROWNUM < 2;
          SELECT COUNT(* )
          INTO   Table_Count
          FROM   dba_Objects
          WHERE  Object_Name = Table_1
                 AND Object_Type = 'TABLE';
          IF Table_Count = 1 THEN
            v_sql1 := 'INSERT INTO bdev.cc_session_event_history(sid,   serial#,   username,   osuser,   session_process_addr,   os_client_process_id,   logon_time,   type,   event,    total_waits,   total_timeouts,   time_waited_csecs,  
      average_wait_csecs,   max_wait_csecs,    logoff_timestamp) SELECT se.sid, s.serial#, s.username, s.osuser, s.paddr, s.process, s.logon_time, s.type, se.event, se.total_waits, se.total_timeouts, se.time_waited, se.average_wait,
      se.max_wait, '''
                      ||LogOff_Time
                      ||''' FROM sys.v$session_event se, sys.v$session s WHERE se.sid = s.sid AND s.username = '''
                      ||LogIn_User
                      ||''' AND s.sid = '
                      ||LogOff_sId;
            EXECUTE IMMEDIATE v_sql1;
          END IF;
          SELECT COUNT(* )
          INTO   Table_Count
          FROM   dba_Objects
          WHERE  Object_Name = Table_2
                 AND Object_Type = 'TABLE';
          IF Table_Count = 1 THEN
            v_sql2 := 'INSERT INTO bdev.cc_sesstat_history(username,     osuser,   sid,   serial#,   session_process_addr,   os_client_process_id,   logon_time,   statistic#,   name,   VALUE,   logoff_timestamp)   SELECT s.username,   
      s.osuser,      ss.sid,     s.serial#,     s.paddr,     s.process,     s.logon_time,     ss.statistic#,     sn.name,     ss.VALUE,     '''
                      ||LogOff_Time
                      ||'''   FROM sys.v$sesstat ss,     sys.v$statname sn,     sys.v$session s 
      WHERE ss.statistic# = sn.statistic#    AND ss.sid = s.sid    AND sn.name IN(''CPU used when call started'',   ''CPU used by this session'',   ''recursive cpu usage'',   ''parse time cpu'')   
      AND s.username = '''
                      ||Login_User
                      ||''' AND s.sid = '
                      ||LogOff_sId;
            EXECUTE IMMEDIATE v_sql2;
          END IF;
          COMMIT;
        END;
    desc cc_session_event_history;
    Name                           Null     Type                                                                                                                                                                                         
    SID                                     NUMBER                                                                                                                                                                                       
    SERIAL#                                 NUMBER                                                                                                                                                                                       
    USERNAME                                VARCHAR2(30)                                                                                                                                                                                 
    OSUSER                                  VARCHAR2(30)                                                                                                                                                                                 
    SESSION_PROCESS_ADDR                    RAW(0)                                                                                                                                                                                       
    OS_CLIENT_PROCESS_ID                    VARCHAR2(24)                                                                                                                                                                                 
    LOGON_TIME                              DATE                                                                                                                                                                                         
    TYPE                                    VARCHAR2(10)                                                                                                                                                                                 
    EVENT                                   VARCHAR2(64)                                                                                                                                                                                 
    EVENT#                                  NUMBER                                                                                                                                                                                       
    TOTAL_WAITS                             NUMBER                                                                                                                                                                                       
    TOTAL_TIMEOUTS                          NUMBER                                                                                                                                                                                       
    TIME_WAITED_CSECS                       NUMBER                                                                                                                                                                                       
    AVERAGE_WAIT_CSECS                      NUMBER                                                                                                                                                                                       
    MAX_WAIT_CSECS                          NUMBER                                                                                                                                                                                       
    TIME_WAITED_MICRO                       NUMBER                                                                                                                                                                                       
    LOGOFF_TIMESTAMP                        DATE                                                                                                                                                                                         
    17 rows selected
    desc cc_sesstat_history;
    Name                           Null     Type                                                                                                                                                                                         
    USERNAME                                VARCHAR2(30)                                                                                                                                                                                 
    OSUSER                                  VARCHAR2(30)                                                                                                                                                                                 
    SID                                     NUMBER                                                                                                                                                                                       
    SERIAL#                                 NUMBER                                                                                                                                                                                       
    SESSION_PROCESS_ADDR                    RAW(0)                                                                                                                                                                                       
    OS_CLIENT_PROCESS_ID                    VARCHAR2(24)                                                                                                                                                                                 
    LOGON_TIME                              DATE                                                                                                                                                                                         
    STATISTIC#                              NUMBER                                                                                                                                                                                       
    NAME                                    VARCHAR2(64)                                                                                                                                                                                 
    VALUE                                   NUMBER                                                                                                                                                                                       
    LOGOFF_TIMESTAMP                        DATE                                                                                                                                                                                         
    11 rows selected

    I have taken out the 'commit' and have added the 'when others then null' exception clause, but I would imagine there is a better way to do it than this? I don't want to do an insert into another table either. With Oracle 11g, this gives me the compile time warning....
    CREATE OR REPLACE TRIGGER cc_LogOff_Trig
        BEFORE LogOff ON DATABASE
        DECLARE
           LogOff_sid   PLS_INTEGER;
           LogOff_Time  DATE := SYSDATE;
           Table_1      VARCHAR2(30) := 'CC_SESSION_EVENT_HISTORY';
           Table_2      VARCHAR2(30) := 'CC_SESSTAT_HISTORY';
           Table_Count  NUMBER;
           v_sql1       VARCHAR2(4000);
           v_sql2       VARCHAR2(4000);
        BEGIN
          SELECT sId
          INTO   LogOff_sId
          FROM   sys.v$MysTat
          WHERE  ROWNUM < 2;
          SELECT COUNT(* )
          INTO   Table_Count
          FROM   dba_Objects
          WHERE  Object_Name = Table_1
                 AND Object_Type = 'TABLE';
          IF Table_Count = 1 THEN
            v_sql1 := 'INSERT INTO bdev.cc_session_event_history(sid,   serial#,   username,   osuser,   session_process_addr,   os_client_process_id,   logon_time,   type,   event,    total_waits,   total_timeouts,   time_waited_csecs,  
      average_wait_csecs,   max_wait_csecs,    logoff_timestamp) SELECT se.sid, s.serial#, s.username, s.osuser, s.paddr, s.process, s.logon_time, s.type, se.event, se.total_waits, se.total_timeouts, se.time_waited, se.average_wait,
      se.max_wait, '''
                      ||LogOff_Time
                      ||''' FROM sys.v$session_event se, sys.v$session s WHERE se.sid = s.sid AND s.username = '''
                      ||LogIn_User
                      ||''' AND s.sid = '
                      ||LogOff_sId;
            EXECUTE IMMEDIATE v_sql1;
          END IF;
          SELECT COUNT(* )
          INTO   Table_Count
          FROM   dba_Objects
          WHERE  Object_Name = Table_2
                 AND Object_Type = 'TABLE';
          IF Table_Count = 1 THEN
            v_sql2 := 'INSERT INTO bdev.cc_sesstat_history(username,     osuser,   sid,   serial#,   session_process_addr,   os_client_process_id,   logon_time,   statistic#,   name,   VALUE,   logoff_timestamp)   SELECT s.username,   
      s.osuser,      ss.sid,     s.serial#,     s.paddr,     s.process,     s.logon_time,     ss.statistic#,     sn.name,     ss.VALUE,     '''
                      ||LogOff_Time
                      ||'''   FROM sys.v$sesstat ss,     sys.v$statname sn,     sys.v$session s 
      WHERE ss.statistic# = sn.statistic#    AND ss.sid = s.sid    AND sn.name IN(''CPU used when call started'',   ''CPU used by this session'',   ''recursive cpu usage'',   ''parse time cpu'')   
      AND s.username = '''
                      ||Login_User
                      ||''' AND s.sid = '
                      ||LogOff_sId;
            EXECUTE IMMEDIATE v_sql2;
          END IF;
      EXCEPTION
          WHEN OTHERS THEN
             NULL;
        END;Edited by: efachim on Jan 6, 2009 11:30 AM

  • Isn't this a typo error?

    http://java.sun.com/docs/books/tutorial/java/IandI/override.html
    Here's some code that's been posted on here before:
    public class Animal {
        public static void testClassMethod() {
            System.out.println("The class method in Animal.");
        public void testInstanceMethod() {
            System.out.println("The instance method in Animal.");
    public class Cat extends Animal {
        public static void testClassMethod() {
            System.out.println("The class method in Cat.");
        public void testInstanceMethod() {
            System.out.println("The instance method in Cat.");
        public static void main(String[] args) {
            Cat myCat = new Cat();
            Animal myAnimal = myCat;
            Animal.testClassMethod();
            myAnimal.testInstanceMethod();
    }Based on what that lesson was trying to teach shouldn't the line
    Animal.testClassMethod();be written as
    myAnimal.testClassMethod();???

    I didn't ignore this thread, just took a rest as it was late for me, sorry. Thx for the replies. However, what you've replied I've no problem in understanding. I get the point that instances of a class belong to an object whereas members of a class belong to the class. It's just that I thought the author of that lesson meant the line
    Animal.testClassMethod();to be
    myAnimal.testClassMethod();My reasoning was the topic of the lesson itself, "Overriding and Hiding Methods". An important point of that lesson is the following:
    The distinction between hiding and overriding has important implications. The version of the overridden method that gets invoked is the one in the subclass. The version of the hidden method that gets invoked depends on whether it is invoked from the superclass or the subclass. Let's look at an example that contains two classes.As a reader at this point I'm thinking the author is going to demonstrate the above quote with the following two classes
    public class Animal {
        public static void testClassMethod() {
            System.out.println("The class method in Animal.");
        public void testInstanceMethod() {
            System.out.println("The instance method in Animal.");
    public class Cat extends Animal {
        public static void testClassMethod() {
            System.out.println("The class method in Cat.");
        public void testInstanceMethod() {
            System.out.println("The instance method in Cat.");
        public static void main(String[] args) {
            Cat myCat = new Cat();
            Animal myAnimal = myCat;
            Animal.testClassMethod();
            myAnimal.testInstanceMethod();
    }Well, how does the line "Animal.testClassMethod();" demonstrate the above quote? It doesn't. It simply makes a direct call to a static method using its full name. It has nothing at all to do with objects, so yes, if you remove the other three lines in main() this one still works. Now if you change that line to "myAnimal.testClassMethod();" it still calls the static method from the superclass! But why? Afterall "myAnimal" holds a reference to a Cat! And so the line from the above quote,
    The version of the hidden method that gets invoked depends on whether it is invoked from the superclass or the subclass.rings in my mind. So, overall I'm thinking there's a typo here and that the author meant "myAnimal.testClassMethod();". Well? I'm just being curious.

  • Code Error 5 message in Indesign CS4

    Sorry second part, I brought a new internal hard drive for my desktop computer had Tekserve here in New York City install the hard drive in my Intel Mac IMac computer. Reloaded all of my Premium CS4 creative suite software into this new hard drive all with all of my other software fresh from the cd rons. I was also told about 6 months back that there may have been a problem with my internal computer's  hard drive. So everything is fresh and I'm still having this same code error 5 and having Indesign CS4 tell me once again that my book file has a code error 5 happens. Adobe Indesign technicians tell me once this code error 5 happens the files are corrupted and can not be open again. So all this happen again using Idesign CS4 taking all of the steps above..

    Please respond in http://forums.adobe.com/message/2945327#2945327

  • Part of Photoshop isn't functioning.  Under adjustments, when HDR toning is clicked on I get a code:  Error 48: File or folder does not exist.  Line:11  - $.evalFile(g_StackScriptFolderPath   "StackSupport.jsx");  How can it be fixed?

    The phone company was here working on something while I was gone.  They sat down at my computer (iMac) and since then HDR toning doesn't work.  Get the code:   Error 48: File or folder does not exist.    Line: 11     ->  $.evalFile(g_StacScriptFolderPatch + "StackSupport.jsx");   How can this be fixed?   

    Go to //Applications/Adobe Photoshop [Version]/Presets/ Scripts/Stack Scripts Only/ and see if StackSupport.jsx is there. If it is not, uninstall and reinstall Photoshop to have it added back in. If it is there, first try recreating the Photoshop Preferences (hold down Command+Option+Shift while launching Photoshop).

  • When i try to open photoshop this shows up Please uninstall and reinstall the product.  If this problem still occurs, please contact Adobe technical support for help, and mention the error code shown at the bottom of this screen.  Error: 16

    i had to take my photoshop file into a hardrive because my dad was going to give me a new Mac and when things didn't work out and went back to my old one i use the time capsule thing to save everything before but didn't give me photoshop so i physically moved the file and tried to open it but then this error shows up
    Please uninstall and reinstall the product.
    If this problem still occurs, please contact Adobe technical support for help, and mention the error code shown at the bottom of this screen.
    Error: 16
    and when i click the uninstall app on the file it tells me this
    The alias “Uninstall Adobe Photoshop CS6 2” can’t be opened because the original item can’t be found
    and when i click fix alias i click on photoshop and the app just turns into photoshop and i just run in circles
    please help thank you

    Run the cleaner tool and reinstall.
    Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6
    Download CS6 products
    Mylenium

  • Secure connection failed: The Certifying Authority for this certificate is not permitted to issue a certificate with this name. (Error code: sec_error_cert_not_in_name_space) PLEASE HELP ME!!

    I have gone to this website almost everyday for years and I have not changed anything in my internet settings, but now I'm getting this message: secure connection failed: The Certifying Authority for this certificate is not permitted to issue a certificate with this name. (Error code: sec_error_cert_not_in_name_space) The only thing I KNOW I did differently, was I installed a CAC reader to my computer, since then, this has been happening. Is there a setting I can change?? E-mail is: [email protected] Thanks! Megan

    There were recently several users getting this error code who use AVAST 2015. If you recently got that program, please see:
    * [https://support.mozilla.org/questions/1029578 Can NOT access https://www.google.com for google voice, mail etc.]
    * [https://support.mozilla.org/questions/1028985 Avast Forum connection failed - works in Chrome etc.]
    * [https://support.mozilla.org/questions/1028190 Since last FF update I can't sign out of Yahoo and when I close FF it tells me it has crashed.]

  • Just tried to import CD in my iTunes music library, but get this error code "error occurred while converting file. You do not have the privilege to make changes"....any thoughts? Have not tried to change anything- only import CD ??

    Just tried to import a new CD into my iTunes music library, but get this error code "error occurred while converting file. You do not have the privilege to make changes"....any thoughts? Have not tried to change anything- only import CD ??

    Do you have read& write permissions to your iTunes library?
    See this thread: Re: "Error has occurred... You do not have the privilege to make changes."

  • HT201210 what is error code (1)?  it is not listed but this is the error i get trying to restore my 3gs.

    what is error code (1)?  it is not listed but this is the error i get trying to restore

    Take a look here for Apple's suggestions on that error:
    http://support.apple.com/kb/TS3694#error1
    Regards.

  • I cannot install i got this : Exit Code: 7 Please see specific errors below for troubleshooting. For example,  ERROR:   -------------------------------------- Summary --------------------------------------  - 0 fatal error(s), 0 error(s)

    i cannot install the newer version
    i got this  :
    Exit Code: 7
    Please see specific errors below for troubleshooting. For example, ERROR:
    -------------------------------------- Summary --------------------------------------
    - 0 fatal error(s), 0 error(s)

    Code 6 & Code 7 http://helpx.adobe.com/creative-suite/kb/errors-exit-code-6-exit.html
    AND JUST FOR MAC USERS - Some 10.9.3 links
    -Mac 10.9.3 workaround https://forums.adobe.com/thread/1489922
    -more Mac 10.9.3 https://forums.adobe.com/thread/1491469
    -Enable Mac Root User https://forums.adobe.com/thread/1156604
    -more Root User http://forums.adobe.com/thread/879931
    -and more root user http://forums.adobe.com/thread/940869?tstart=0

  • Hey, I recently purchased the creative cloud and installed photoshop but now when I go to open the application it tells me theres a configuration error. It suggests restarting or contacting customer support but I thought I'd try this first. the error code

    I recently purchased the creative cloud and installed photoshop but now when I go to open the application it tells me theres a configuration error. It suggests restarting or contacting customer support but I thought I'd try this first. the error code is error: 213:19. Does anyone seeing this please have any advice on what to do?

    This is an open forum, not Adobe support... you need Adobe staff to help
    Adobe contact information - http://helpx.adobe.com/contact.html
    -Select your product and what you need help with
    -Click on the blue box "Still need help? Contact us"
    or
    A chat session where an agent may remotely look inside your computer may help
    Creative Cloud chat support (all Creative Cloud customer service issues)
    http://helpx.adobe.com/x-productkb/global/service-ccm.html

  • I need help with this code error "unreachable statement"

    the error_
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errors
    import java.util.*;
    import javax.swing.*;
    import java.awt.*;
    public class Tools//tool class
    private int numberOfToolItems;
    private ToolItems[] toolArray = new ToolItems[10];
    public Tools()//array of tool
    numberOfToolItems = 0;
    for(int i = 0; i < toolArray.length; i++)//for loop to create the array tools
    toolArray[i] = new ToolItems();
    }//end for loop
    }//end of array of tools
    public int search(int id)//search mehtod
    int index = 0;
    while (index < numberOfToolItems)//while and if loop search
    if(toolArray[index].getID() == id)
    return index;
    else
    index ++;
    }//en while and if loop
    return -1;
    }//end search method
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0;
    int index;
    index = search(id); <-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    }//end delete method
    public void display()//display method
    for(int i = 0; i < numberOfToolItems; i++)
    //toolArray.display(g,y,x);
    }//end display method
    public String getRecord(int i)//get record method
    // return toolArray[i].getName()+ "ID: "+toolArray[i].getID()
    }//end getrecod
    }//end class
    Edited by: ladsoftware on Oct 9, 2009 6:08 AM
    Edited by: ladsoftware on Oct 9, 2009 6:09 AM
    Edited by: ladsoftware on Oct 9, 2009 6:10 AM
    Edited by: ladsoftware on Oct 9, 2009 6:11 AM

    ladsoftware wrote:
    Subject: Re: I need help with this code error "unreachable statement"
    F:\Java\Projects\Tools.java:51: unreachable statement <-----------------------------------------------------------------------------------------------------------------THIS
    int index;
    ^
    F:\Java\Projects\Tools.java:71: missing return statement
    }//end delete method
    ^
    F:\Java\Projects\Tools.java:86: missing return statement
    }//end getrecod
    ^
    3 errorsThe compiler is telling you exactly what the problems are:
    public int insert(int id, int numberInStock, int quality, double basePrice, String nm)//insert method
    if(numberOfToolItems >= toolArray.length)
    return 0; // <<== HERE you return, so everyting in the if block after this is unreachable
    int index;
    index = search(id);  //< -----------------------------------------------------------------------------------------------------------------HERE
    if (index == -1)
    toolArray[index].assign(id,numberInStock, quality, basePrice,nm);
    numberInStock ++;
    return 1;
    }//end if index
    }//end if toolitem array
    return -1;
    }//end insert method
    public int delete(/*int id*/)//delete method
    // <<== HERE where is the return statement?
    }//end delete method
    public String getRecord(int i)//get record method
    // return toolArray.getName()+ "ID: "+toolArray[i].getID() <<== HERE you commented out the return statement
    }//end getrecod
    }//end class

  • HT3523 hello, this is the error I get when I try to play a video QuickTime Player can't open "solea-antonio-walter.mov" because a required codec isn't available. Any idea what I need to do? thank you

    Hello,
    This is the error message I get when I try to watcha burnt dvd, can anyone tell me what I need to do?
    thank you
    QuickTime Player can't open "solea-antonio-walter.mov" because a required codec isn't available.

    Quicktime X is a great little piece of software. However, Quicktime X is very finicky on which codec/file format it can decode/play.
    Luckily, there are DOZENS of alternative video/media players and extensions available for the Mac. Some of them are even FREE. Some of the better FREE ones include...
    PERIAN (quicktime extension)
    http://www.macupdate.com/app/mac/22923/perian
    QUICKTIME 7.6.6
    http://support.apple.com/kb/DL923
    VLC Media Player
    http://www.macupdate.com/app/mac/5758/vlc-media-player
    NICEPLAYER
    http://www.macupdate.com/app/mac/15136/niceplayer
    ... And if none of those work, there is a possibility that, that video file may be corrupted.

  • This trigger giving mutation error? any body can tell why?

    Hi All,
    Could any body tell me where is the problem in my trigger.
    my tables are.
    1) EMP :- emp_id,emp_movement_status
    2) EMPLOYEES_DAILY_MOVEMENT :- emp_id,transaction_time,transaction_remarks.
    if i delete a entry from transactions_table, it has to take latest remarks from the maximum record after deletion of the record, then update EMP table accordingly.
    trigger is:-
    CREATE OR REPLACE TRIGGER change_employee_status AFTER INSERT OR UPDATE OR DELETE ON
    employees_daily_movement FOR EACH ROW
    DECLARE
    local_remarks VARCHAR2(50);
    BEGIN
    IF DELETING THEN
    SELECT transaction_remarks INTO local_remarks FROM employees_daily_movement WHERE
         transaction_id = (SELECT MAX(transaction_id) FROM employees_daily_movement WHERE
         emp_id = :old.emp_id );
    /* here im expecting to take the TRANSACTION_REMARKS column value from employees_daily_movement after deleting the record which i wanted */
    UPDATE emp SET emp_movement_status = local_remarks WHERE emp_id = :old.emp_id;
    END IF;
    END;
    Thanks in advance

    Hi Mr Rao,
    You can handle muttating erros with following
    1. Database version is oracle 9i and above, you can over come this problem for ever by using pragma autonomous_transaction.
    2. Another way is, if you database version earlier to 9i then you can re-pharase this trigger by writting statement level trigger instead row level.
    Cheers!!
    Mahesh Ragineni

Maybe you are looking for

  • Execute process task 7zip

    hi, i am using 7zip in ssis process execute task. variable name defines the files to be zipped. all works fine till at random times the process execute task takes the default values of the variables instead of the run time values. And then ssis packa

  • Essbase Architects/Projects Managers

    Here is what we are recruiting for:Resource: 2 Roles:- Project Manager/Architect- Essbase ConsultantLocation:Toronto, ONContractsRates are open     Project Manager      Essbase Consultant      Overview: The client is one of North America's leading fi

  • Connecting to Database as INTERNAL

    Hi, I have a problem connecting to database as INTERNAL. I'm getting "ORA-12203: TNS unable to connect to destination" message when trying to connect to the database. Please suggest me how to connect. And what are important tasks that can be done by

  • Fetching segment content in IDOC

    Hi, My idoc segment contains total 16 fields but in those 16 fields I want to pick seventh field value. In the table edid4 the SDATA field contains mixing of all 16 fields data so how to pick seventh field data in that. Please help me. I will give po

  • Trouble in session variables

    hi, I am using "request.getSession(true)" statement .So i think i shud get a new session each time i'll start the browser. But each time when i am starting browser it is showing me the previous values, stored in text boxes. And when i'll shutdown tom