Sendings typed Arrays (ArrayBindCount) with DBNull's in the middle

Hello again,
I wanted to share another problem I had using ODP against Oracle.
I need to insert multiple rows into table which allows some parameters to be null.
Table schema:
CREATE TABLE ANNOTATIONS
ANNOTATIONID NUMBER,
ANNOTATIONNAME NVARCHAR2(64) // this can be null (the same with value types like number)
Stored proc:
procedure ANNOTATIONSINSERT( in_ANNOTATIONID in ANNOTATIONS.ANNOTATIONID%type , in_ANNOTATIONNAME in ANNOTATIONS.ANNOTATIONNAME%type)
AS
BEGIN
INSERT INTO ANNOTATIONS ( ANNOTATIONID, ANNOTATIONNAME)
END;
Since I use ArrayBindCount mechanism, I use typed arrays (as the type of table column)
for example (int arrays) and send them to appropriate stored proc.
What happens when I want to put a DBNull value into one of the integer arrays?
(I need to use some conversion function: but there is no convert from System.DBNull!)
Here is a solution I found to this problem: it works although ODP doesn't support
object types
private void testCase()
     OracleConnection connection = new OracleConnection(some connection string);
     OracleCommand command = null; // = new OracleCommand("");//, connection);
     BuildANNOTATIONSINSERT(ref command); // I build here command and command parameters
     int total = 20;
     Random random = new Random();
     object [] iData = new object[total]; // YES, instantiate object arrays! and put in arrays true values
     object [] sData = new object[total];
     int data;
     for (int index=0; index<total; index++)
          data = random.Next(40000); // generate some random data
          iData[index] = data;
          if (data%4==0)
               sData[index] = System.DBNull.Value; // some of the data include null values
          else
               sData[index] = iData[index].ToString();
     try
          connection.Open();
          IDbTransaction txn = connection.BeginTransaction();
          command.Parameters[0].Value = iData;
          command.Parameters[1].Value = sData;
          command.Connection = connection;
          command.ArrayBindCount = total;
          command.ExecuteNonQuery();
          txn.Commit();
          connection.Close();
     catch (Exception eee)
          MessageBox.Show(eee.Message);
Should this work, I'm afraid to supply a functionality that works today: to a customer, and at the next
version of ODP, it will stop working. (and nobody will know why)
I can also use an error code for any type. (I can decide that -1 is error for NUMBER type and null for string types)
but I don't want to use that. Usage of objects is also costly (-20% speed performance): it seems that there is
some encapsulation of types in the core of ODP: byte[][] (also works) etc.
What is the proper way to do what I want, so it will be safe in the next versions of ODP?
Thanks!

Amir,
ODP.NET accepts array (object array) for array binding. However, passing object array is slower because of the boxing and unboxing of types in .NET (this is not ODP.NET behavior, but .NET). You can pass a type array for array binding, and that should be faster than an object array (boxing and unboxing won't happen). For example, passing an int[] should be faster than object[] for an Oracle Number type.
However, it is not possible to assign the DBNull.Null value to an element in the type array. In this case, you should make use of the OracleParameter.ArrayBindStatus to inform ODP.NET how to bind the elements in the type array. For example, if the 3rd element is to be treated as Null value, the code will looks like this:
int[] ints = new Int32[10];
param.ArrayBindStatus = new OracleParameterStatus[10];
for (int i = 0; i &lt; 10; i++)
param.ArrayBindStatus[i] = OracleParameterStatus.Success;
//Now tell ODP.NET that the 3rd should treat as Null value
param.ArrayBindStatus[2] = OracleParameterStatus.NullInsert;
If you use object array instead, setting the element to DBNull.Null should work. But as we mentioned, using object array will then be slower.
Let us know if we've any question regarding this.
Thanks
Martha

Similar Messages

  • I have a white MacBook. I just changed out the hard drive with a 500GB. When I turn it on I get a file fold with a ? In the middle that flashes. What do I do next?

    I have a white MacBook and I just changed out the hard drive with a 500GB. When I turn it on I get a file fold with a ? In the middle that flashes. What do I do next?

    Clean Install of Snow Leopard
    Be sure to make a backup first because the following procedure will erase
    the drive and everything on it.
         1. Boot the computer using the Snow Leopard Installer Disc or the Disc 1 that came
             with your computer.  Insert the disc into the optical drive and restart the computer.
             After the chime press and hold down the  "C" key.  Release the key when you see
             a small spinning gear appear below the dark gray Apple logo.
         2. After the installer loads select your language and click on the Continue
             button. When the menu bar appears select Disk Utility from the Utilities menu.
             After DU loads select the hard drive entry from the left side list (mfgr.'s ID and drive
             size.)  Click on the Partition tab in the DU main window.  Set the number of
             partitions to one (1) from the Partitions drop down menu, click on Options button
             and select GUID, click on OK, then set the format type to MacOS Extended
             (Journaled, if supported), then click on the Apply button.
         3. When the formatting has completed quit DU and return to the installer.  Proceed
             with the OS X installation and follow the directions included with the installer.
         4. When the installation has completed your computer will Restart into the Setup
             Assistant. Be sure you configure your initial admin account with the exact same
             username and password that you used on your old drive. After you finish Setup
             Assistant will complete the installation after which you will be running a fresh
             install of OS X.  You can now begin the update process by opening Software
             Update and installing all recommended updates to bring your installation current.
    Download and install Mac OS X 10.6.8 Update Combo v1.1.

  • I CAN'T GET MY BRUSH IN PHOTOSHOP ELEMENTS 13 TO CHANGE FROM A PLUS SIGN WITH A CIRCLE IN THE MIDDLE.  I WANT TO USE A ROUND BRUSH.

    I CAN'T GET MY BRUSH IN PHOTOSHOP ELEMENTS EDITOR TO CHANGE FROM A PLUS SIGN WITH A CIRCLE IN THE MIDDLE.  I WANT TO USE A ROUND BRUSH.

    You have the caps lock on

  • I have a symbol that has appeared on my iphone 4s top right just left off the bluetooth sign, it's an arrow on a circle with a padlock in the middle any idea where it came from and what it is

    i have a symbol that has appeared on my iphone 4s top right just left off the bluetooth sign, it's an arrow on a circle with a padlock in the middle any idea where it came from and what it is

    That's the portrait orientation lock (keeps the screen from rotating to landscape mode).  To turn it off, double-tap the home button, swipe the list at the bottom to the right, then tap the left-most icon (to the left of the music controls).

  • HT5622 My Ipod Classic shows a red circle with a cross in the middle. I've completed diagnostic tests which have popped up, however any HP/FW/Hard Drive tests freeze the ipod, as if the hard drive won't spin. What do I do?

    My Ipod Classic shows a red circle with a cross in the middle. I've completed diagnostic tests which have popped up, however any HP/FW/Hard Drive tests freeze the ipod, as if the hard drive won't spin. What do I do?
    After holding down the Select and Play/Pause button, I was able to restart the Ipod and then it brought me to a Diagnositc test. I have tried doing both the Mannual and Annual test on the ipod however in each test, the ipod freezes on different access tests. The HP (headphones) test, shows the headphones are detected, but then if it tries to play a song to make sure they work it freezes and goes back to the red cross. I have looked at various other questions regarding the FW cable, however I don't believe i have such a cabel. Then the Hard Drive test freezes up and I can hear a ticking noise coming from the drive but it doesnt seem to be spinning. Alongside these test issues, any computer cannot see the Ipod when plugged in (including itunes). Therefore some tests for the USB drive cannot be completed. I do not recall dropping it badly, though I have dropped it previously. Does all this mean there is damage to the drive? Should I instead take it to an apple store?
    Many Thanks

    The stats look fine. Try the DFU Restore method shown in Corrupt iPod classic. It may pay to disable any anti-virus software and use the staged transfer method to reload data, assuming you get that far.
    tt2

  • TS1587 I cannot get my mac to boot after I turn on. I get a white screen and in a minute or so I get an icon with a ? in the middle of it????

    I cannot get my i mac to boot after I turn on. I get a bright white screen followed by an icon with a ? in the middle of it.
    I also hear the some knocking in the computer as the HD rotates???

    You will need to reinstall OS X.

  • I start my mac book pro and the screen goes white with an apple in the middle

    I start my mac book pro and the screen goes white with an apple in the middle. Starts like charging  but then it turns
    off again

    Reinstall Snow Leopard without erasing the drive
    1. Repair the Hard Drive and Permissions
    Boot from your Snow Leopard Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities menu. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.
    2. Reinstall Snow Leopard
    If the drive is OK then quit DU and return to the installer.  Proceed with reinstalling OS X.  Note that the Snow Leopard installer will not erase your drive or disturb your files.  After installing a fresh copy of OS X the installer will move your Home folder, third-party applications, support items, and network preferences into the newly installed system.
    Download and install Mac OS X 10.6.8 Update Combo v1.1.
    Reinstalling Lion/Mountain Lion Without Erasing the Drive
    Boot to the Recovery HD: Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the main menu. Repair the Hard Drive and Permissions as follows.
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu.
    Reinstall Lion/Mountain Lion: Select Reinstall Lion/Mountain Lion and click on the Continue button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.

  • My macbook turns on to a grey screen with a folder in the middle of the screen.  I don't know what to do to get it to turn on...

    My macbook turns on to a grey screen with a folder in the middle of the screen.  I don't know what to do to get it to turn on...
    This has never happened.  I have tried to do the command-option-p-r trick and that didn't work. HELP

    That folder with the question mark icon means that the MacBook can't find the boot directory. That can either mean it can't find the hard drive or the hard drive data is somehow corrupted.
    Put your install DVD into the optical drive and reboot. As soon as you hear the boot chime, hold down the "c" key on your keyboard (or the Option key until the Install Disk shows up). That willforce your MacBook to boot from the install DVD in the optical drive.
    Once it has finished booting and you Choose Your Language and you are at the Install screen launch Disk Utility from the Utilities menu. Is your Hard Drive in the list on the left?
    If it is then select the First Aid Tab run Repair Disk and if that repairs any problems run it again until the green OK appears and then run Repair Permissions.
    If your hard drive isn’t recognized in Disk Utility then your hard drive is probably dead.

  • I have a Time Capsule on which I back up 2 MacBooks and on my wife's machine she keeps having Airport Utility popping up all the time with a yellow button flashing on the left and a Red button on the right side with a "1" in the middle of it.

    I have a Time Capsule on which I back up 2 MacBooks and on my wife's machine she keeps having Airport Utility popping up all the time with a yellow button flashing on the left and a Red button on the right side with a "1" in the middle of it. Can any one tell me what is wrong. I read where when the yellow light was flashing there was a problem, but I am a novice at this and have no idea where to turn. It seems to be backing up on a regular basis.

    On the Mac......
    Open up Macintosh HD > Applicatons > Utilities > AirPort Utility
    Click on the Time Capsule icon, then click Edit in the small window that appears
    Click the Network tab at the top of the next window
    Change the setting for Router Mode from the current DHCP and NAT to read Off (Bridge Mode), then click Update at the lower right of the window, and wait a full minute for the Time Capsule to restart to a green light.
    Then.....very important
    Power off the Time Capsule and your Arris modem/router for a few minutes
    Start up the Arris first, and let it run a few minutes by itself
    Start up the Time Capsule next the same way
    Your network will now be correct, and your printing capabilities will improve.
    If Time Machine backups do not occur now, post back and we will tackle that next.

  • I cant drag musin off of my laptop into my itunes an red circle with an slanted in the middle line pops up im so very frustrated i can not put any music on my phone

    I cant drag musin off of my laptop into my itunes an red circle with an slanted in the middle line pops up im so very frustrated i can not put any music on my phone

    Hi Darray123,
    If you are having issues moving music to your iPhone, you may find the following articles helpful:
    iOS: Syncing your data with iTunes
    http://support.apple.com/kb/HT1386
    Apple Support: Managing content manually on iPhone, iPad, and iPod
    http://support.apple.com/kb/HT1535
    Regards,
    - Brenden

  • HT1386 I have a circle with a square in the middle next to songs in a play list and I am unable to play them?  WHy and how do I make this go away!

    I have a circle with a square in the middle next to songs in a play list and I am unable to play them?  WHy and how do I make this go away!

    Hi k_smith1298,
    Thanks for visiting Apple Support Communities.
    First, be sure you've restarted and reset your iPhone:
    iOS: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/ht1430
    If you are syncing music with an iTunes library, you may want to try setting up syncing in iTunes again by following the steps in the appropriate article below. If you're syncing music, try un-checking and then re-checking the "Sync music" checkbox in iTunes.
    iTunes 11 for Mac: Set up syncing for iPod, iPhone, or iPad
    http://support.apple.com/kb/PH12113
    iTunes 11 for Windows: Set up syncing for iPod, iPhone, or iPad
    http://support.apple.com/kb/PH12313
    If the issue isn't resolved after this, you may want to back up and restore your iPhone:
    iTunes: Restoring iOS software
    http://support.apple.com/kb/HT1414
    Regards,
    Jeremy

  • HT1414 I tried to do an update in the settings mode and now my ipad is frozen with a black screen with itunes app in the middle and showing to plug in the charger. Nothing is happening and tried turning off device and still nothing.

    Ipad locked up while trying to do an update. Don't know how to fix and can't use ipad at all. Black screen with itunes app in the middle of screen and it shows picture of charger that it wants me to plug in. Nothing works.

    You are in recovery mode, you need to restore it through iTunes on your computer. Follow the article you linked from.

  • When I publish a project I get a white screen first with an arrow in the middle

    I publish a project in either Captivate 6 or Captivate 7 and instead of the first slide coming up when you go to it, it has a big white screen with an arrow in the middle.
    When you click the arrow -- it goes away and the first slide starts.
    How do I get rid of the white screen first.
    Is there a way to set up a title screen?

    Well, that's the extent of my knowledge with Autoplay, I'm afraid. But some more details might help others be able to answer better:
    Are you publishing as SWF or HTML5?
    Do you experience this when previewing the project? When viewing it locally? When viewing on a server? Running the SWF file alone, or running the SWF file using its html file? On a particular device? All of the above?
    Is this a problem with particular projects, or does it happen when you create a new project?
    What specific versions of 6 and 7 are you publishing from?
    There's also this thread which might be worth a look if you're experiencing the problems with HTML5: http://forums.adobe.com/thread/1148299

  • STUCK on white screen with battery icon in the middle with RED LIGHT

    I have BB curve 8900 and my BB shutdown by itself yesterday and it wont start on again ! 
    so i charged it the red LED start to show and white screen with battery icon in the middle it looks like empty battery, and stuck on it and sometimes it keeps spinning over and over again until it bcome black screen then it starts the same begining !
    I tried the hard boot by taking the battery out for sometime and reinstalled it but it didn't work. I even try putting a different battery (friends battery) but still no joy.. 
    and the main catch is if i try taking out the battery and plug the charger or connects it to the laptop it does the same thing without even any battery in it.
    So is it really a Battery problem or the OS problem.?? (If its a OS problem, can u install it myself at home.?
    Waiting for the reply
    Thanks
    Jasdeep Jolly

    jasdeep_jolly wrote:
    if it does not boot then..??
    Well, you need to do as suggested first.
    Then, if not: If your BlackBerry stays powered off with a black screen, follow the instructions below. The only indication of life might be the blinking red LED light in the top corner. Nothing seems to wake it up and Desktop Manager doesn't recognize any device is connected.
    1) Make sure you have Blackberry Desktop Manager installed.
    http://na.blackberry.com/eng/services/desktop/
    2) On your PC, go to Start > Run and copy and paste the following line exactly (meaning with the quotation marks):
    "c:\program files\common files\research in motion\apploader\loader.exe" /nojvm
    3) The Application Loader Wizard will appear -- click "Next."
    4) In the "Connection:" drop-down menu, you should see "USB-PIN: UNKNOWN". Click the "Next" button.
    5) You should then see a list of applications ready to be installed for your Blackberry. Hit Next and Finish and you are well on your way to getting your Blackberry back to life. Congrats! Just don't disconnect anything and let the lengthy process finish completely.
    NOTE: If you do not see a list of applications mentioned in step 5 and instead see the message "The Blackberry Desktop Software does not have Blackberry Device Software for the device that you have connected to the computer. Contact your wireless service provider or system administrator," then you must download Blackberry's Operating System for your carrier and device.
    http://www.blackberryfaq.com/index.php/BlackBerry_Operating_System_Downloads
    Just select the appropriate carrier and network type, select your Blackberry model from the list and download the latest version. Install this download and follow the above steps again and you should be on the right path.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • HT4623 I tried to update my phone this morning, and now it is stuck on a black screen with an apple in the middle.

    I tried to update my phone this morning, and now it is stuck on a black screen with an apple in the middle.

    Press the Power button and hold it down until the computer turns off. Restart. Do you still get the same result? If so, then try booting into Safe Mode, then restart normally. A safe mode startup takes considerably longer than a normal one, so don't panic. You will also see a progress bar at the beginning.

Maybe you are looking for

  • CS6 master collection (korean)trial ver. error 110 or 108

    My system is windows 7 X64 ultimate, 8G ram and 500G HDD When I tried to download CS6 master collection (korean) trial version via adobe download asistance, everytime when the progress is about 2/3 complete, the statement "error 110....." or 108 appe

  • Validation Failed when creating Web Service Proxy

    Hi I am having trouble creating a web service proxy in JDeveloper (11.1.1.3). When I enter the endpoint URL (which is a https WSDL file). I get the following error: No WSDL document could be found at https://host:port/.../.././...wsdl. I can open the

  • Socket is kept alive when it shouldn't be .... Linger & Reuse For windows?

    Hello all! Hope I can get a hand on this problem I'm having. Problem is as follows: Extremely simplistic code is used to create a ServerSocket, and then connect to the port to get a datastream. The code isn't the problem. What is the problem is that

  • Please Help - iTunes installer won't run on double-click

    I am facing a reload of Win 7 x64 tonight if I don't get this fixed. When I run the installer all it does is create a temp folder and put an .msi in there. Nothing else happens. No errors or messages, no hung processes. nothing. I've completely unins

  • Why am I getting duplicate e-mails?

    When opening e-mails on my iPhone, I find that I frequently see duplicate e-mails. This is not the case when I check mail on my iMac. It primarily happens when I receive e-mails from companies, not the individuals in my address book. I know it is not