Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, I think I've figured out what the issue is. In the example above I omitted some additional parameters from my stored proc for berevity. I have other parameters in the query, some of which are of datatype DATE. So, consider the following table...</p> <pre><code> CREATE TABLE TEST (DATE_FIELD DATE, TIMESTAMP_FIELD TIMESTAMP); </code></pre> <p>And the stored procedure...</p> <pre><code>CREATE OR REPLACE PROCEDURE TEST_INSERT ( P_DATE IN DATE, P_TIMESTAMP IN TIMESTAMP ) AS BEGIN INSERT INTO TEST(DATE_FIELD, TIMESTAMP_FIELD) VALUES(P_DATE, P_TIMESTAMP); END TEST_INSERT; </code></pre> <p>And the following c#...</p> <pre><code>using (var cmd = new OracleCommand("TEST_INSERT", conn)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.Add("P_TIMESTAMP", OracleDbType.TimeStamp , new DateTime(2011, 07, 07, 10, 0, 0), System.Data.ParameterDirection.Input); cmd.Parameters.Add("P_DATE", OracleDbType.Date , new DateTime(2011, 07, 08), System.Data.ParameterDirection.Input); cmd.ExecuteNonQuery(); } </code></pre> <p>The result will be... </p> <pre><code>DATE_FIELD: 11-07-07 TIMESTAMP_FIELD: 11-07-08 00:00:00.000000000 </code></pre> <p>So, even though the parameters are named, it seems as though the name of the parameter is irrelevant and that the order in which parameters are added to the Parameters collection in .net will determine the values of the parameters in the stored procedure.</p> <p>So, in the c# snippet if you reverse the order in which the parameters are added to the collection to...</p> <pre><code>cmd.Parameters.Add("P_DATE", OracleDbType.Date , new DateTime(2011, 07, 08), System.Data.ParameterDirection.Input); cmd.Parameters.Add("P_TIMESTAMP", OracleDbType.TimeStamp , new DateTime(2011, 07, 07, 10, 0, 0), System.Data.ParameterDirection.Input); </code></pre> <p>then the result will be...</p> <pre><code>DATE_FIELD: 11-07-08 TIMESTAMP_FIELD: 11-07-07 10:00:000000000 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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