Return Oracle TableRow as output param
- From: "Chris Fink" <ChrisFink@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 21 Jul 2005 13:44:03 -0700
How do I modify this code to return one output parameter, the value of the
tablerowid which is a sequence number that represents the rowid??
OleDbConnection cn = new OleDbConnection(DataSource);
// Fixed: Anonymous block required (begin-end) to support blob insert
into oracle 8i
string sql = "BEGIN INSERT INTO TABLENAME
(TABLEROWID, STRUCTUREID, STATUS, LASTUPDATEDBY, MSGIN, ORIGINATINGID,
HOSTSYSTEM) VALUES (IBTXN_SEQ.NEXTVAL, :1,:2,:3,:4,:5,:6); END;";
OleDbCommand cmd = new OleDbCommand();
//cmd.Transaction.Begin();
//cmd.Transaction.Rollback();
//cmd.Transaction.Commit;
cmd.CommandTimeout = CommandTimeOut;
cmd.CommandText = sql;
cmd.Connection = cn;
cmd.CommandType = CommandType.Text;
OleDbParameter p1 = cmd.Parameters.Add("strucID", OleDbType.VarChar,50);
p1.Direction = ParameterDirection.Input;
p1.Value = structureID.Trim();
OleDbParameter p2 = cmd.Parameters.Add("status", OleDbType.VarChar,50);
p2.Direction = ParameterDirection.Input;
p2.Value = status.ToUpper().Trim();
OleDbParameter p3 = cmd.Parameters.Add("lastUpdatedBy",
OleDbType.VarChar,50);
p3.Direction = ParameterDirection.Input;
p3.Value = lastUpdatedBy.ToUpper().Trim();
byte[] ba = stringToByteArray(msgIn);
OleDbParameter p4 = cmd.Parameters.Add("blobData", OleDbType.Binary,
ba.Length);
p4.Direction = ParameterDirection.Input;
p4.Value = ba;
// the ip/dns address of the system making the request (like http_referrer)
OleDbParameter p5 = cmd.Parameters.Add("originatingID",
OleDbType.VarChar,50);
p5.Direction = ParameterDirection.Input;
p5.Value = originatingID.ToUpper().Trim();
// the name of the host system (http, websvcs)
OleDbParameter p6 = cmd.Parameters.Add("hostSystem", OleDbType.VarChar,50);
p6.Direction = ParameterDirection.Input;
p6.Value = hostSystem.ToUpper().Trim();
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
.
- Prev by Date: Find a row index in a dataset
- Next by Date: Re: Setting version on SQL Table
- Previous by thread: Find a row index in a dataset
- Next by thread: multiple instances of named argument in list
- Index(es):