StrataFrame Forum

Stored procedures oracle parameter marker

http://forum.strataframe.net/Topic292.aspx

By John Frankewicz - 12/12/2005

There is an example in your documentation regarding stored procedures in VB land: You need more C# examples Smile

  Dim loCommand As New SqlCommand()
   '-- Create the command
   loCommand.CommandText = "SELECT MAX(or_created) FROM Orders WHERE or_cust_pk = @cust_pk"
   loCommand.Parameters.Add("@cust_pk", SqlDbType.Int)
   loCommand.Parameters("@cust_pk").Value = CustomerPK
My question is are the parameter-marker the same for Oracle as they are for SQL?  I know in the ADO.NET world it's a '?'

By StrataFrame Team - 12/13/2005

You're correct, in Oracle, have to use a ":" to identify parameters... so in your example, the code would be:



OracleCommand loCommand = new OracleCommand();

//-- Create the command

loCommand.CommandText = "SELECT MAX(or_created) FROM Orders WHERE or_cust_pk = :cust_pk";

loCommand.Parameters.Add(":cust_pk", OracleType.Number);

loCommand.Parameters[":cust_pk"].Value = CustomerPK;



However, the : is only for parameterized commands... when you call a stored procedure through Oracle, you can use any unique name you want (i.e. you cannot use the same name as the columns within the table, so "P_cust_pk" would work fine.).