Stored procedures oracle parameter marker


Author
Message
John Frankewicz
John Frankewicz
StrataFrame Beginner (40 reputation)StrataFrame Beginner (40 reputation)StrataFrame Beginner (40 reputation)StrataFrame Beginner (40 reputation)StrataFrame Beginner (40 reputation)StrataFrame Beginner (40 reputation)StrataFrame Beginner (40 reputation)StrataFrame Beginner (40 reputation)StrataFrame Beginner (40 reputation)
Group: Forum Members
Posts: 36, Visits: 65
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 '?'

StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
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.).



GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search