This discussion is archived
2 Replies Latest reply: Oct 30, 2012 4:33 AM by Herald ten Dam RSS

ExecuteSQL getting failed

970843 Newbie
Currently Being Moderated
int tmain(int argc, TCHAR* argv[])
     ODatabase odb;
     oresult res = odb.Open("MICROSOFT", "OMNIPOS", "OMNIPOS");
     char pSqlStmt[500];
     OSqlStmt osql;
///////////////////////////////procedure Creation/////////////////
     strcpy(pSqlStmt,"create or replace PROCEDURE newprocedure(inEmpName IN                VARCHAR2,outEmpno OUT NUMBER)\n AS \n");
     strcat(pSqlStmt,"select ROLL into outEmpno from Egtable WHERE NAME = inEmpName;\n");      
     strcat(pSqlStmt,"update Egtable set ROLL = outEmpno WHERE NAME = inEmpName;\n");
     oresult ot = odb.ExecuteSQL(pSqlStmt);
     if (ot == OSUCCESS)
          OValue val;
          odb.GetParameters().Add("ENAME","Zac", OPARAMETER_INVAR, OTYPE_VARCHAR2);
          odb.GetParameters().Add("ROLLNO",0, OPARAMETER_OUTVAR, OTYPE_NUMBER);          
          oresult oot = odb.ExecuteSQL("Begin newprocedure(:ENAME,:ROLLNO); End;");
          oresult i = odb.GetParameters().GetParameter("ROLLNO").GetValue(&val);
          cout<< "value is " << (const char*) val<<endl;



In the above program procedure(' newprocedure') got succesfully created coz oresult return Success but this line >>>>
oresult oot = odb.ExecuteSQL("Begin newprocedur(:ENAME,:ROLLNO); End;"); getting failed, i didnt get the problem.Please helpme with solution.
And my table look like this


Roll      Name
1     kate     
3     Zac

Please help me with solution.


  • Correct Answers - 10 points
  • Helpful Answers - 5 points