Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2009
    Posts
    2

    Unanswered: running updates in batch mode (SQLPlus and Oracle 10g)

    All,

    I need to be running various update statements consecutively one after the other.

    UPDATE table
    SET column = expression
    WHERE predicates;
    **I use different where conditions in each update;

    Currently I am running this from the SQL prompt, one after the other manually. Is there a way I can include all these statements in a file and run it in batch mode so that all the statements are execute one after the other? I am looking for something similar to nohup in unix. I am a newbie to automating things for a Database.

    Please Help me. Thanks in advance.

  2. #2
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    >Is there a way I can include all these statements in a file and run it in batch mode so that all the statements are execute one after the other?
    YES.

    place the SQL statements in a file & make sure this filename ends with ".sql"
    Then after invoking sqlplus just do:
    SQL> @commands.sql
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Aug 2009
    Posts
    2
    Yes, but when I do that - I should stay logged to the database. I am wondering if there is a way where I can just trigger it so that it would keep running in the background

    Thanks

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    it could be run as a cron job
    Just be sure to establish correct environment before invoking sqlplus
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    look up dbms_job utility in google.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  6. #6
    Join Date
    Jul 2003
    Posts
    2,296
    and dbms_scheduler if you are 10g and above.
    - The_Duck
    you can lead someone to something but they will never learn anything ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •