CREATE OR REPLACE PACKAGE BODY TEST_COLLECTION AS
 
/******************************************************************************
   NAME:       TEST_COLLECTION
   PURPOSE:     test de cr&ation de ref cursor sur un e collection d'objets sans utiliser de constructeur d'objet  

   REVISIONS:
   Ver        Date        Author           Description
   ---------  ----------  ---------------  ------------------------------------
   1.0        03/07/2007  DENNIL           Created this package.   
******************************************************************************/


/**
* return a collection of TEST_TYPE  
*/
FUNCTION GET_COLLECTION
RETURN ASI.TEST_TYPES
IS
    w_collection ASI.TEST_TYPES;
    w_object ASI.TEST_TYPE;
BEGIN
    w_collection := ASI.TEST_TYPES();     
    FOR i IN 1..10 
    LOOP
        w_collection.EXTEND;
        w_collection(i) := ASI.TEST_TYPE('value'||i, 'value'||(2*i));
     END LOOP;
     
    return w_collection;         
END GET_COLLECTION;    

/**
* try to return a REF cursor on a ASI.TEST_TYPES 
*/    
FUNCTION GET_COLLECTION_TO_DATASET_1(in_collection ASI.TEST_TYPES)
  RETURN DATASET
IS
    w_result DATASET;
BEGIN  
    open w_result for
        select ASI.TEST_TYPE(a.attribut1, a.attribut2) from table(in_collection) a;             

    return w_result;
    
END GET_COLLECTION_TO_DATASET_1;
 
END TEST_COLLECTION;
/
