Results 1 to 8 of 8
  1. #1
    mrlddst is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2014
    Posts
    22

    Best way to perform series of updates

    I'm using Access 2007, accdb format.

    I have been tasked with adding a script that used to be run against an Oracle table to now run this in Access. I have the table linked inside of the Access database. The script runs around 40 updates on two fields depending on other column values. Can I call a procedure in Oracle to update the table from Access, or if I use a function as a module, I could only call it for one field correct? I would have the same problem switch, but I probably won't go that route as it would extremely long.

    Script example
    UPDATE PPA_JAN14_TEST
    SET PPA_OE_COLUMN = NULL,
    PPA_OE = NULL;
    COMMIT;
    UPDATE PPA_JAN14_TEST
    SET
    PPA_OE_COLUMN = '1',
    PPA_OE = 'AFC-10'
    WHERE substr(rgn_dist,1,1) = '2'
    AND approp = 'XXX'
    AND AFC = 'X1'


    AND PPA_OE_COLUMN IS NULL;
    COMMIT;
    UPDATE CG_TIER_PPA_JAN14_TEST
    SET PPA_OE_COLUMN = '1',
    PPA_OE = 'AFC-10'
    WHERE substr(rgn_dist,1,1) = '2'
    AND approp = 'XXX'
    AND AFC = 'X2'
    AND PPA_OE_COLUMN IS NULL;
    COMMIT;
    and so on.........

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    The data is still in Oracle, with linked tables in Access? I've only worked with SQL Server, but presumably Oracle has similar capabilities. If so, yes you can run an Oracle procedure from Access. You can either use a pass through query or an ADO command object. You could also run a pass through query with that SQL in it. If you want to switch to Access, each UPDATE would have to be executed separately, as Access does not allow multiple statements in one query.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    mrlddst is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2014
    Posts
    22
    Thanks! I will try the passthough first.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No problem, post back if you get stuck (though my lack of Oracle experience may become a factor). For SQL Server, the pass through to run a stored procedure on the server would simply be:

    EXEC ProcedureName

    if there were no parameters.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    mrlddst is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2014
    Posts
    22
    Quick question, I haven't set up the pass through yet but if I set this as the first step in a macro that runs make tables (I want to run them after the updates). Do you think the macro won't work properly since it's not waiting on Oracle to finish?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    It's possible, though that should run pretty quick in Oracle. You may be able to have the Oracle process return a value and test for it. Or if you use VBA you can add a pause to wait x seconds (not sure if that's doable in a macro).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    mrlddst is offline Novice
    Windows Vista Access 2007
    Join Date
    Apr 2014
    Posts
    22
    Just wanted to update you. I was able to do the passthrough and attach it to a macro. The macro does wait for the procedure called in the query to finish before moving on to its next stage.

    Oh yeah, with an Oracle PL/SQL passthrough, you must use a begin/end around your call.

    Thanks again for you help.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Happy to help, and thanks for the update.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Multiple Series Charts
    By ejnitz in forum Queries
    Replies: 1
    Last Post: 02-13-2013, 10:26 AM
  2. Replies: 2
    Last Post: 06-20-2012, 03:56 PM
  3. Numeric or Date Series
    By OR1988 in forum Access
    Replies: 4
    Last Post: 10-03-2011, 07:44 AM
  4. export a series of csvfiles
    By broecher in forum Programming
    Replies: 4
    Last Post: 09-23-2010, 09:10 AM
  5. Help Querying series
    By ktmchugh in forum Queries
    Replies: 20
    Last Post: 05-05-2009, 04:31 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums