如何调用ORACLE的存储过程?越详细越好

解决方案 »

  1.   

    给你个例子,这里用的ADOSTOREDPROC
      try
        ADOStoredProc1.ProcedureName := '存储过程名';
        ADOStoredProc1.Parameters.Clear;
        ADOStoredProc1.Parameters.CreateParameter('@code',ftString,pdOutput,4,0);//code为存储过程里面定义的字符串类型的输出参数
        ADOStoredProc1.Prepared := true;    ADOStoredProc1.ExecProc;
      except
        on E: exception do
        begin
          AdoConnection1.RollbackTrans;  //回滚事务
          Application.MessageBox('调用存储过程失败!','错误',MB_ICONERROR + MB_OK);
        end;
      end;
      Showmessage(ADOStoredProc1.Parameters.ParamByName('@code').Value);  //显示获得的值