Posts

Oracle Forms Exception Handling: NO_DATA_FOUND, TOO_MANY_ROWS and OTHERS

Oracle Forms Exception Handling: NO_DATA_FOUND, TOO_MANY_ROWS and OTHERS EXCEPTION block in PLSQL Oracle Forms is used to track the exceptions. Following is the PLSQL code snippet which uses NO_DATA_FOUND, TOO_MANY_ROWS and OTHERS exceptions. If the SQL SELECT query does not return any data, NO_DATA_FOUND exception is fired. If the SQL SELECT query returns more than one row where it was expected to return only one row, TOO_MANY_ROWS exception can be used to track this kind of exception. If you are not sure what kind of exception can the code throw, use OTHERS exception. DECLARE   DEPARTMENT_NAME VARCHAR(60); BEGIN   SELECT DEPTNAME INTO DEPARTMENT_NAME FROM DEPT WHERE DEPTNO = 20; EXCEPTION   WHEN NO_DATA_FOUND THEN     MESSAGE('No data found');   WHEN TOO_MANY_ROWS THEN     MESSAGE('More than one row found');   WHEN OTHERS THEN     NULL; -- don't do anything and just return from the procedure END;

Difference between WHEN-VALIDATE-ITEM and KEY-NEXT-ITEM triggers

Difference between WHEN-VALIDATE-ITEM and KEY-NEXT-ITEM triggers WHEN-VALIDATE-ITEM and KEY-NEXT-ITEM triggers are very close to each other and create a lot of confusion. Following are three differences between them to clear the picture a little bit. 1. Whenever the user changes the value in the item and tries to move out of that item using ENTER or TAB or MOUSE, WHEN-VALIDATE-ITEM trigger is fired. But, in case of KEY-NEXT-ITEM trigger, if user moves out using MOUSE, it will not fire. So, the validation written on this trigger will not fire. Better use, WHEN-VALIDATE-ITEM trigger in this case as it also works with MOUSE. 2. KEY-NEXT-ITEM trigger fires before the WHEN-VALIDATE-ITEM trigger. 3. KEY-NEXT-ITEM trigger will fire every time you move to the next field from that field but WHEN-VALIDATE-ITEM will fire only when you have acutally made any changes to that item. If you have made no changes in the item, it will not fire when you move out this item. Personally, I prefer to use WHEN...

Oracle Forms Tutorials: WHEN-VALIDATE-ITEM trigger

Oracle Forms Tutorials: WHEN-VALIDATE-ITEM trigger Consider that you have an oracle form on which there is a datablock which uses EMP table. EMP table has a column called SALARY. Now there is a contraint on the SALARY column that it should be greater than or equal to $1000. Your requirement is that whenever any user fills salary in the Oracle Forms ITEM (say ITEM_SALARY) and tabs out from that item, a validation should fire and if the value filled is not valid, it should give you an error message and does not let the cursor go to the other item. In these situations WHEN-VALIDATE-ITEM trigger is used. Following is the PLSQL code you should write on the WHEN-VALIDATE-ITEM trigger of the ITEM_SALARY item. IF :ITEM_SALARY < 1000 THEN     MESSAGE('ERROR: Salary must be at least $1000 or more.');     RAISE FORM_TRIGGER_FAILURE; -- To keep the cursor in the item END IF; You should also go through this video on YOUTUBE by Edward Honour. In this video, he tries ...

5 Things you should never discuss your manager

5 Things you should never discuss your manager An employee should be fair and transparent with his manager, but few revelations can spoil your bonding with your manager. Try never ever talking about these things to your manager: 1. Your doubt on manager' decisions - At times, you may want to raise questions on his judgement. Do yourself a favour - give it a pass. You may not know what business pressures he/she is living through. 2. Snooping on manager's life - Every employee wants to check what his or her manager is doing in social life. Don't blow your cover by admitting to doing it unashamed. 3. Office gossip - Never share office hearsay with your manager without checking its truthfulness. Sharing something random that you heard in the cafeteria and reacting to it may get him or her thinking that you are not mature or trustworthy. 4. Your personal secrets - Your life and its constant struggles are for you to handle. Pouring it all out in front of your manager will put you...

Difference between Free and FreeAndNil in Delphi: What to use when?

Difference between Free and FreeAndNil in Delphi: What to use when? Free and FreeAndNil are the main concepts of memory management in Delphi. FreeAndNil is a function declared in the SysUtils unit and was introduced in Delphi 5. Below is the implementation of FreeAndNil: procedure FreeAndNil(var Obj); var   Temp: TObject; begin   Temp := TObject(Obj);   Pointer(Obj) := nil;   Temp.Free; end; Difference between Free and FreeAndNil:  FreeAndNil first sets the object reference to nil and then frees the object.  When to use FreeAndNil instead of Free? If you want a rational answer, the question to ask is, why would you want to set an object reference to nil once you’re done with it?  And there’s only one good reason to ever do that: If you want to reuse the variable later.  There are some times when you’ll have an object that may or may not be initialized. If it’s not, then the variable will be nil, and if you find it’s nil, then you create it before...

Difference between Override and Reintroduce in Delphi

Difference between Override and Reintroduce in Delphi When you decide to declare a method as virtual, you are giving permission to derived classes to extend and override the method with their own implementation. Use the reintroduce keyword to introduce a new implementation of a parent method (this hides the parent method). You can hide a method without using reintroduce but you will get a compiler warning. Using reintroduce will suppress the warning. You tell the compiler that you know that you hide the ancestor function and replace it with this new function and do so deliberately. Difference between Override and Reintroduce 1. The reintroduce and override modifiers have different meanings. The reintroduce modifier creates a new member with the same name, signature, and visibility and hides the original member. The override modifier extends the implementation for an inherited member and allows you to implement inheritance-based polymorphism. 2. Override is used in conjuction with Virtu...

Difference between Virtual, Dynamic and Abstract methods in Delphi

Difference between Virtual, Dynamic and Abstract methods in Delphi Virtual and Dynamic methods are the strong concepts of Polymorphism in Delphi. Dynamic is semantically equivalent to Virtual. Both Virtual and Dynamic directives allows a class method to be override (replaced) by a same named method in a derived class.  You would mark a function or procedure as Virtual or Dynamic when you allow a programmer who creates a class based on your class to replace its functionality.  Virtual and Dynamic may be followed by the Abstract directive. This modifies the effect of the Virtual and Dynamic directives. It means that the current class must not code the method - it is there only as a placeholder to remind and ensure that derived classes implement it. Difference between Virtual and Dynamic methods in Delphi Although Virtual and Dynamic methods appear same but there is some differnce in their internal implementation. Virtual methods are implemented with a Virtual Method Table (VMT)....