0 Replies Latest reply on Dec 11, 2002 6:50 AM by 234046

    Please Help - How to pass Table objects as input and output parameters using VC++

    234046
      Please help me by giving a sample code to call the procedure
      GetClassInstanceProperties from a VC++ application using
      Oracle Objects for OLE


      CREATE OR REPLACE TYPE TY_INST_ID_PROP_PAIR AS OBJECT
      (INST_ID CHAR(38), PROP_ID CHAR(38), VALUE XMLTYPE);


      CREATE OR REPLACE PACKAGE DBMS_PROPERTYSTORE
      AUTHID CURRENT_USER
      AS
           --Used to return the ids from the functions
           TYPE tt_UUIDs IS TABLE OF char(38) index by binary_integer;
           TYPE tt_inst_id_prop_pairs is table of ty_inst_id_prop_pair index by binary_integer;

           PROCEDURE GetClassInstanceProperties(ClassId IN char, Prop_Ids in TT_UUIDs,
      Inst_Id_Prop_Pairs out TT_Inst_Id_Prop_Pair);

      END DBMS_PROPERTYSTORE;


      CREATE OR REPLACE PACKAGE BODY DBMS_PROPERTYSTORE AS

           PROCEDURE GetClassInstanceProperties
           (
                ClassId IN char,
                Prop_Ids in TT_UUIDs,
                Inst_Id_Prop_Pairs out TT_INST_ID_PROP_PAIR
           )
           AS
           BEGIN
                --Return the instanceid,propertyid and values for a certain class
                --only return those properties that in the user supplied Prop_ids table
           
                FOR I in Prop_Ids.FIRST..Prop_Ids.LAST loop
                     select TY_Inst_Id_Prop_Pair(i.Inst_Id,p.Prop_Id,p.Value) into Inst_Id_Prop_Pairs(I)
                          from TBL_Instance i, table(Prop_Pairs) p
                          where I.Cls_Id.Cls_Id=ClassID
                          and p.Prop_Id = Prop_Ids(I);
                END LOOP;
           EXCEPTION
                WHEN NO_DATA_FOUND THEN
                     raise_application_error(-20100, 'No data found');
                WHEN OTHERS THEN
                     raise_application_error(-20200, SQLERRM);
           END GetClassInstanceProperties;

      END DBMS_PROPERTYSTORE;