Originally posted by ahara
Hello;

Your previous example of code should also work in Oracle, however I think another key point should be made. Another significant difference between Access and Oracle is performance. This is why Oracle is used for the really big and important stuff. Oracle has caching capabilities that Access does not. When you send a query to Oracle, it first checks the cache to see if it is already there. If not, it recompiles it and runs it - but if it finds it in the cache, the query will fetch the records more efficiently. We are an Oracle 8i shop over here. We have implemented a standard of using paramterized command objects only for all sql statements. The following example illustrates:

VB Code:
  1. dim cmdCommand as new ADODB.Command
  2. set cmdCommand.ActiveConnection = [your connection object]
  3. cmdCommand.CommandType = adCmdText
  4. dim prmParameter as new ADODB.Parameter
  5. dim sql as String
  6.  
  7. sql = "update tableA set field1=?, field2=?, field 3=? WHERE rec_id=?"
  8.  
  9. set prmParameter = cmdCommand.CreateParameter("field1", [data type], adParamInput, [size of field], [value])
  10. cmdCommand.Parameters.Append prmParameter
  11.  
  12. ... 'add other two parameters
  13.  
  14. cmdCommand.CommandText = sql
  15. cmdCommand.Execute

Now if this is totally new to you, check out MSDN's tutorial at

http://msdn.microsoft.com/library/de...jparameter.asp

With regards to the code above.....Notice how the sql statement uses "?" marks. These represent the paramters going in. The parameters must be specified in the same order as the "?" marks in the sql statement. So each time this statement comes into Oracle's sql compiler, it will be found in the cache and run right away. I hope this does not complicate matters too much for you, but Oracle is such a good database (WAY BETTER THAN ACCESS), I truly believe as developers we should make the most of it. Cheers!

I agree. Binding is the way to go for Oracle.
Cheers,
Abhijit