Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Example type and procedure in Oracle:</p> <pre><code>TYPE NUMBER_ARRAY IS TABLE OF NUMBER NOT NULL INDEX BY PLS_INTEGER; PROCEDURE procedure_name(array IN NUMBER_ARRAY); </code></pre> <p>Example call of the stored procedure with NHibernate:</p> <pre><code>ISQLQuery query = _session.CreateSQLQuery("BEGIN procedure_name(:array); END;" query.SetParameter("array", array, new Int64ArrayType()); query.ExecuteUpdate(); </code></pre> <p>You need to implement that Int64ArrayType yourself:</p> <pre><code>[Serializable] public class Int64ArrayType : ImmutableType { public Int64ArrayType() : base(SqlTypeFactory.Int64) { } public override object Get(System.Data.IDataReader rs, string name) { return rs[name]; } public override object Get(System.Data.IDataReader rs, int index) { return rs[index]; } public override void Set(System.Data.IDbCommand cmd, object value, int index) { OracleCommand orclCmd = (OracleCommand)cmd; orclCmd.Parameters[index].OracleDbType = OracleDbType.Int64; orclCmd.Parameters[index].CollectionType = OracleCollectionType.PLSQLAssociativeArray; orclCmd.Parameters[index].Value = value; } public override string ToString(object val) { return String.Join(";", (object[])val); } public override string Name { get { return "Int64ArrayType"; } } public override Type ReturnedClass { get { return typeof(long[]); } } public override object FromStringValue(string xml) { string[] stringElements = xml.Split(';'); long[] array = new long[stringElements.Length]; for (int i = 0; i &lt; stringElements.Length; i++) { array[i] = Convert.ToInt64(stringElements[i]); } return array; } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload