delete OPENQUERY only successful the second time executed

  • I have a linked server from SQL Server 2005 to an Oracle database using Oracle Provider for OLE DB. I have created a Stored Procedure for a delete OPENQUERY to remove entries from a table which are between two dates which are passed in as variables. When I execute the procedure I get the following message "Msg 7333, Level 16, State 2, Line 1

    Cannot fetch a row using a bookmark from OLE DB provider "OraOLEDB.Oracle" for linked server ...." and no rows are deleted. If I execute the procedure again straight away the rows are deleted as expected. Why is this successful the second time but not the first?

  • Just to rule out most likely suspects please check...

    1- Query is written using four-parts-names.

    2- There is an unique index on target table.

    3- DTC is setup and running.

    _____________________________________
    Pablo (Paul) Berzukov

    Author of Understanding Database Administration available at Amazon and other bookstores.

    Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
  • Looks like a connection problem. Check provider and connection string parameters. Try changing provider version or try Microsoft OLEDB provider for Oracle. Try with another link-test expression instead of delete: "SELECT * FROM DUAL". You also could have an Oracle procedure on the other side you call over a link.

    _____________________________________________________
    Microsoft Certified Master: SQL Server 2008
    XDetails Addin - for SQL Developers
    blog.sqlxdetails.com - Transaction log myths

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply