title: Oracle Self Constructor function with if statment
body: <p>My question is as i am new with oracle and pl/sql that is it possible to check the values during inserting by using self constructor.
  Example checking number of a varray items depending on another attribute value?</p>
  
  <pre><code>Create or Replace Type test_arr as Varray(20) of number;
  
  Create or Replace Type test_typ as Object(
  tID number(5),
  tType varchar2(1),
  tArray test_arr
  );
  </code></pre>
  
  <p>I would like to test when tType='A' then tArray.count should be less then 2 and if the tType='B' then tArray.count should be between 5 and 20.
  I would like to test this during the insert process so:</p>
  
  <pre><code>Create Table test_tbl of test_typ;
  Insert Into test_tbl Values(187,'A',test_arr(1,6,7)); /*This should give an error and not insert the record as the tType is 'A' and the tArray has 3 values!*/
  </code></pre>
  
  <p>I am not sure if i could do that with self return. The main thing here is that i need to check during the insert process!</p>
  
  <p>I would appropriate any help. Thanks!</p>