Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2003
    Location
    Sydney, Australia
    Posts
    66

    Unanswered: how to check if there is something to Commit

    Hi,

    when I close Toad, it asks me if I want to Commit or Rollback. But it only comes up with this question if I modified something. Alternatively, if I only execute Select ststements, then Toad does not come up with this question. Obviously, the tools knows if there are any changes pending.

    Now I need to do something similar from PL/SQL. What would be the query, to look into system views, to find out if there is any uncomitted change for my session ?

    Regards,

    Andrew

  2. #2
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    The tool knows because it keeps an internal flag indication that you changed something (or clicked in an editable view), sqlplus does not.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  3. #3
    Join Date
    Jun 2003
    Location
    Sydney, Australia
    Posts
    66
    Quote Originally Posted by beilstwh
    The tool knows because it keeps an internal flag indication that you changed something
    Even when I call a stored procedure to do the update ?

  4. #4
    Join Date
    Jun 2004
    Location
    Liverpool, NY USA
    Posts
    2,509
    You asked if sqlplus know if a transaction had been started. However, you can query that from the database.


    Code:
    select s.status
    from v$transaction t, v$session s
    where s.saddr = t.ses_addr
    and s.audsid=SYS_CONTEXT('USERENV','SESSIONID')
    If a transaction has started, it will return a status of 'ACTIVE' OR 'INACTIVE'. If no transaction has started, it will not return a row.
    Bill
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

  5. #5
    Join Date
    Jun 2003
    Location
    Sydney, Australia
    Posts
    66
    thanks, that's what I was looking for

Posting Permissions

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