1 Reply Latest reply on Dec 11, 2002 8:38 PM by 82532

    How to insert null in C++ Class library

    172873
      I am using oo4o Class library. I am inserting arrays into the database
      This is my code (it is simplified):
      // C++ Code
      OStartup();
      oRes = m_o_Session.Open(); // m_o_Session is OSession // oRes is oresult
      oRes = m_o_db.Open(m_o_Session,sSource,sUser,sPassword); // m_o_db is ODatabase
      oRes = m_o_db.BeginTrans();
      // the insert proccess
      // Add Params
      OParameterCollection oParamCol = oDB.GetParameters();
      OParamArray o_NUM_INDEX_Ary = oParamCol.AddTable("xi_lv_NUM_INDEX",OPARAMETER_INVAR,OTYPE_NUMBER,10);
      OParamArray o_TEXT_Ary = oParamCol.AddTable("xi_sv_TEXT",OPARAMETER_INVAR,OTYPE_VARCHAR2,10,250);
      OParamArray o_NUMBER_OPT_Ary = oParamCol.AddTable("xi_dv_NUMBER_OPT",OPARAMETER_INVAR,OTYPE_NUMBER,10);

      for(int i =0;i<10;i++){
      o_NUM_INDEX_Ary.SetValue(i,i);
      o_TEXT_Ary.SetValue("asdasd",i);
      o_NUMBER_OPT_Ary.SetValue(??????,i);
      }

      oRes = oDB.ExecuteSQL("INSERT INTO GEN_TABLE_TEST_T (NUM_INDEX,TEXT,NUMBER_OPT) VALUES (:xi_lv_NUM_INDEX,:xi_sv_TEXT,:xi_dv_NUMBER_OPT)");

      oParamCol.Remove("xi_lv_NUM_INDEX");
      oParamCol.Remove("xi_sv_TEXT");
      oParamCol.Remove("xi_dv_NUMBER_OPT");

      oRes = m_o_db.CommitTrans();
      oRes = m_o_db.Close();
      m_o_Session.Close();
      OShutdown();

      my question is where I marked ?????? I want to insert null to a numeric field
      I tried to put NULL instead of ?????? - does not work
      I tried to put OValue initialized with null instead of ?????? - does not work
      and I need to send him in the insert Sql because sometimes it does not null and i have to give him value.


      thanks is advance
      Yoav