Question: I'd like to be able to retrieve the return value from a function in Oracle with c#.
Currently, this is what I have:

For SQL:

```
 FUNCTION add_resource (
     project_view BOOLEAN,
     project_id NUMBER,
     worker_id  NUMBER,
     role_id    NUMBER) RETURN NUMBER IS
     resource_id NUMBER;
 BEGIN
   INSERT INTO RESOURCE_T (WORKERID, ROLEID, PROJECTID)
   VALUES (worker_id, role_id, project_id)
   RETURNING RESOURCEID INTO resource_id;
   RETURN resource_id;
 END add_resource;

```

For C#

```
cmdText = "DECLARE resource_id NUMBER; BEGIN resource_id := PKG_RAP.add_resource(" + projectView + "," + id + "," + record["WORKERID"] + "," + record["ROLEID"] + "); END;"; 

using (OracleCommand cmd = new OracleCommand(cmdText, conn))
    {
         OracleTransaction trans = conn.BeginTransaction();
         try
         {
          OracleParameter prm = new OracleParameter("resource_id", OracleDbType.Int32, ParameterDirection.ReturnValue);
          cmd.Parameters.Add(prm);                      
          cmd.ExecuteNonQuery();
          trans.Commit();
         }catch 
         {
          trans.Rollback();
          throw;
         }
    }

```

The query works individually when I test it out in the database, however, the c# is not able to grab the value for resource\_id and only gets "null". Any tips would be appreciated!

Answer: 
You can't expect SQL Server to know that the date you passed in is meant to be the current date. How could it possibly tell? To SQL Server that date looks like any other date.

SQL Server will correctly notify you if records with the predicate you applied are being changed.

Issue a new SQL dependency at midnight each day.
maybe use 
"How to: Use SQL Server Change Tracking"

<http://msdn.microsoft.com/en-us/library/cc305322(v=sql.110).aspx>

There is sample code

---

maybe you don't use equal = --> use >

This will produce last 24 hours changes

Select dbo.table.lastchangedate where dbo.table.lastchangedate > > DATE\_SUB(CURDATE(), INTERVAL 1 DAY)

modyfy with getdate() and getutcdate() depends what you want 

lastchangedate >= DateAdd(hh, -24, GETDATE())