How to do array fetch and array insert?


I've just stumbled across the fact that I can fetch and insert arrays. I haven't found anything yet on how to implement an array insert or fetch.


Ans:

With embedded SQL, to array fetch a statement like:
select sal, ename
into :sal, :ename
from emp

you just declare your variables as arrays of a fixed length (say 100). Oracle will populate all 100 fields. The last fetch you have to find out yourself how many items were fetched. You can use the SQLCA to do this.



Ans2:

The Oracle Pro*C book has section on host arrays and array fetch/insert that is very helpful.  Using arrays can speed things up tremendously and are easy to implement in Pro-C.
 

Hosted by www.Geocities.ws

1