Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Commit in ExecuteReader()

3396251Feb 10 2017 — edited Feb 10 2017

Hello,

I wrote the following Powershell Script (this is only part of it) to Update certain Rows in a table.

It seems that i cannot pass an array to the Oracle Command Execute Reader.

When im updating about 200.000 rows through single Queries and ExecuteReader() function in a loop, does Oracle commit at the end of the ExecuteReader() Method or when the connection is closed?

I guess when a commit is done after every executed Query the DB will have a hard time.

Anyone have a clue?

thx

# Load Oracle Assembly

$LoadOracle = [Reflection.Assembly]::LoadFile("C:\app\client\PR070921\product\12.1.0\client_1\odp.net\bin\2.x\Oracle.DataAccess.dll")

# Connect to Oracle

$SQLConnString = "User Id=$DBUsername;Password=$DBPassword;Data Source=$source"

$SQLConnection = New-Object Oracle.DataAccess.Client.OracleConnection($SQLConnString)

$SQLConnection.Open()

foreach ($line3 in $ImportInDB)

{

    $SQLQuery = "update " + $DBTable + " set"

    $SQLQuery += " BUKRS='" + $line3.BUKRS

    $SQLQuery += "', KUNDE='Test"# + $line3.KUNDE

    $SQLQuery += "' where NAME='" + $line3.NAME + "'"

    # IMPORT TO DATABASE

    try{

        $SQLCommand = New-Object Oracle.DataAccess.Client.OracleCommand($SQLQuery,$SQLConnection)

        $SQLReader = $SQLCommand.ExecuteReader()

    }

    catch{

        write_log ($_)

    }

}

$SQLConnection.Close()

This post has been answered by AndrewSayer on Feb 10 2017
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2017
Added on Feb 10 2017
2 comments
854 views