I want to store a short array of 64 bytes in Oracle database (a password hash). I thought char(64 byte) is what I need, but it seems like it doesn’t work. In Microsoft SQL, I use binary and varbinary types. What type do I need to use in Oracle?
Every example I’ve found uses blob to store binary data, but I suppose blob is intended only for large objects, not for fixed size short arrays.
When updating the data, is the code like this appropriate:
byte[] passwordHash = GenerateHash();
using (OracleCommand updateHash = new OracleCommand("update A set passwordHash = :hash where EntryId = :id", oracleConnection))
{
updateHash.Parameters.Add(":hash", passwordHash);
updateHash.Parameters.Add(":id", entryId);
if (updateHash.ExecuteNonQuery() != 1)
{
// ...
}
}
or am I missing something and byte array parameters cannot be added like this?
In addition to
blob, Oracle also has theRAWdatatype,— Oracle 10g Release 2 Datatypes
RAW can be set up to a max size of 2000 bytes, with
LONG RAWhaving a max size of 2GB.However: