Skip to content

Override and Overtake

Override and overtake are the two ways you can change the code in the layer you are working in. With an override you can add code Pre and Post the call to the underlying layer. With override you can't change the code in the middle of the method. You can also override views.

Overtake is the way to use when you must change the code in the middle of the method or if you can't run the previous layers code. If you carry out an overtake then you also assume ownership for this piece of code. Overtaken methods don't call the other layers code. Overtakes should only be used when no other option exists. You can also overtake views.

See also override and overtake syntax in Developer Studio.

Override of methods/records

Override is the preferable way of making enhancements to code. This means that you add code Pre or Post previous layers code. Override methods must always contain a 'super call'. Also you must always annotate the override with the annotation @Override. You can also override type records, in order to add attributes to the record.

Super Call

The super call is an IFS extension to the PL/SQL language. The super call, calls a method with the same name as the overridden method, in the layer below with the signature replicating what is in the super call.

Below is an example of an override with a super call, and an example of an override of type record:

@Override
PROCEDURE Check_Insert___ (
   newrec_ IN OUT override_overtake_tab%ROWTYPE,
   indrec_ IN OUT Indicator_Rec,
   attr_   IN OUT VARCHAR2 )
IS
BEGIN
   --Add pre-processing code here
   SELECT nvl(max(queue_id) + 1, 1)
   INTO newrec_.queue_id
   FROM BATCH_QUEUE;
   Client_SYS.Add_To_Attr('QUEUE_ID', newrec_.queue_id, attr_);

   super(newrec_, indrec_, attr_);

   --Add post-processing code here
   IF newrec_.object_group_id = 'XxX' THEN
      Transaction_SYS.Init_Processing__(newrec_.queue_id);
   END IF;
EXCEPTION
   WHEN dup_val_on_index THEN
      Error_SYS.Record_Exist(lu_name_);
END Check_Insert___;

Adding additional parameters

It is also possible to expand a method's parameter list, by adding DEFAULT parameters in the PLSQL method implementation.

When adding additional parameters to a method they must be placed last and also have a DEFAULT clause that sets appropriate values in case the method is called with the original set of parameters. In this case, period_status_ is added.

NOTE: As per design, adding additional parameters by doing overrides and overtakes is not supported for projection action and function definitions.

Overtake of methods

An Overtake is not the IFS preferred way of making enhancements to the code, but does need to be used when you cannot carry out an override. When you overtake a method you can rewrite the method so it behaves in exactly the way you want. You must always annotate the overtake with the annotation @Overtake [layer], where layer is the layer that you have overtaken the method from.

Example of an overtake of Base:

@Overtake Base
FUNCTION Get_Description (
   object_group_id_ IN     VARCHAR2 ) RETURN VARCHAR2
IS
   temp_ override_overtake_tab.description%TYPE;
   CURSOR get_attr IS
   SELECT DISTINCT(description)
      INTO  temp_
      FROM  override_overtake_tab
      WHERE object_group_id = object_group_id_ or object_group_id_ = 'XxX';
BEGIN
   OPEN get_attr;
   FETCH get_attr INTO temp_;
   CLOSE get_attr;
   RETURN temp_;
EXCEPTION
   WHEN no_data_found THEN
      RETURN NULL;
   WHEN too_many_rows THEN
      Raise_Too_Many_Rows___(object_group_id_, 'Get_Description');
END Get_Description;

Original code:

@Overtake Base
FUNCTION Get_Description (
   object_group_id_ IN     VARCHAR2 ) RETURN VARCHAR2
IS
   temp_ override_overtake_tab.description%TYPE;
   CURSOR get_attr IS
   SELECT DISTINCT(description)
      INTO  temp_
      FROM  override_overtake_tab
      WHERE object_group_id = object_group_id_ or object_group_id_ = 'XxX';
BEGIN
   OPEN get_attr;
   FETCH get_attr INTO temp_;
   CLOSE get_attr;
   RETURN temp_;
EXCEPTION
   WHEN no_data_found THEN
      RETURN NULL;
   WHEN too_many_rows THEN
      Raise_Too_Many_Rows___(object_group_id_, 'Get_Description');
END Get_Description;

Override and Overtake of columns

If you are declaring new views in the view file, with column names that have already been used, you automatically get the same properties on each column as the base, core or extension column have.

@Override
COLUMN Description IS
Flags = 'A----';

If you want to clear properties, and not inherit any properties you can choose to overtake the column and redefine the properties.

@Overtake Base
COLUMN Queue_Id IS
Datatype = 'STRING(100)'
Flags = 'AM---'
Prompt = 'Queue Identity';  

Please note that re-declare, override or overtake does not change the column definitions for the views declared in previous layer. To change the column properties on views in previous layers you have to override or overtake the view and re-declare the property.

@Override
VIEW Sample_View IS
Description.Datatype = 'STRING(200)';

You can also of course add SELECT statement and/or WHERE statement after this if needed.