How to find the status of lines (modified or not)

Hello

Is it possible to find if a line status is modified (but not committed) and user who made the change?
Avoid locking if we want to check if there is a line in our select statement can cause the deadlock.

your response is so much appreciated

In this case, you can skip all the locked rows. This is a clause without papers prior to Oracle 11 g. The following code illustrates the approach:

// we create a test table with 10 rows
SQL> create table footab as
  2  select rownum as FOO_ID, object_name as VALUE from all_objects where owner = 'SYS' and rownum  < 11;

Table created.

// we create a procedure that will pretend to be another session trying to update the table, while
// we are busy updating some rows (it is an autonomous transaction)
SQL> create or replace procedure UpdateFoo is
  2          pragma autonomous_transaction;
  3
  4          cursor c is
  5          select
  6                  f.*
  7          from    footab f
  8          for update
  9          skip locked;
 10
 11          type TBuffer is table of c%rowtype;
 12          buffer TBuffer;
 13  begin
 14          -- an ugly loop hack used to demonstrate what it can lock
 15          -- and updating those rows
 16          open c;
 17          loop
 18                  fetch c bulk collect into buffer limit 100;
 19
 20                  for i in 1..buffer.Count
 21                  loop
 22                          dbms_output.put_line(
 23                                  'row:'||i||
 24                                  ' id:'||buffer(i).foo_id
 25                          );
 26
 27                          update footab
 28                          set value = lower(value)
 29                          where foo_id = buffer(i).foo_id;
 30                  end loop;
 31
 32                  exit when c%NotFound;
 33          end loop;
 34          close c;
 35          commit;
 36  end;
 37  /

Procedure created.

// the contents of our table
SQL> select * from footab;

    FOO_ID VALUE
---------- ------------------------------
         1 DUAL
         2 SYSTEM_PRIVILEGE_MAP
         3 TABLE_PRIVILEGE_MAP
         4 STMT_AUDIT_OPTION_MAP
         5 RE$NV_LIST
         6 STANDARD
         7 DBMS_STANDARD
         8 USER_REGISTRY
         9 ALL_REGISTRY_BANNERS
        10 V_$BH

10 rows selected.

// we lock and update row 5 - and we do not commit
SQL> update footab set value='UPDATED' where foo_id = 5;

1 row updated.

// the other session's transaction runs, attempting to update all rows -
// but skip any rows that are already lock (row 5 in this case)
SQL> exec UpdateFoo
row:1 id:1
row:2 id:2
row:3 id:3
row:4 id:4
row:5 id:6
row:6 id:7
row:7 id:8
row:8 id:9
row:9 id:10

PL/SQL procedure successfully completed.

// what can we see now in the test data?
SQL> select * from footab;

    FOO_ID VALUE
---------- ------------------------------
         1 dual
         2 system_privilege_map
         3 table_privilege_map
         4 stmt_audit_option_map
         5 UPDATED
         6 standard
         7 dbms_standard
         8 user_registry
         9 all_registry_banners
        10 v_$bh

10 rows selected.

// we commit our transaction
SQL> commit;

Commit complete.

// if the other session transaction runs now, it will find all rows
// available for update
SQL> exec UpdateFoo
row:1 id:1
row:2 id:2
row:3 id:3
row:4 id:4
row:5 id:5
row:6 id:6
row:7 id:7
row:8 id:8
row:9 id:9
row:10 id:10

PL/SQL procedure successfully completed.

// contents of the test data after its update
SQL> select * from footab;

    FOO_ID VALUE
---------- ------------------------------
         1 dual
         2 system_privilege_map
         3 table_privilege_map
         4 stmt_audit_option_map
         5 updated
         6 standard
         7 dbms_standard
         8 user_registry
         9 all_registry_banners
        10 v_$bh

10 rows selected.

SQL> 

Tags: Database

Similar Questions

  • How to find the status of the package (valid/invalid) was at one time

    How to find the status of the package (valid/invalid) was at one time?
    I want to find the status of an oracle package to 15:00 yesterday. Today, the status of this package is INVALID.
    I'm sure it was VALID yesterday. But no way to prove it. Can any one help please?
    I can generate AWR report for the last 7 days...

    Try to use a flashback, like this query:

    select object_name, object_type, status
    from dba_objects AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '18' HOUR)  -- 18 hours ago
    where object_name = 'MY_OBJECT'
    ;
    

    If you have not granted privs FLASHBACK, you may connect as SYS to make a request flashback on a table data dictionary.
    But this should give you the info you need - if it's still in cancellation.

  • How to find the webcam on my hp g56122us note windows 7

    How to find the webcam on my computer vision g56122us hp laptop? I can't get my webcam so I can make a video or take a picture. I have no idea how to do so that he could appear on my screen

    Hello

    Please use it to check & difficulty:

      http://support.HP.com/us-en/document/c02452221     

    Links for XP & Vista are here also.

    Good luck.

  • How to find the number of lines in the content of the text?

    Hi all

    I have a multi line text element. I want to know the number of lines in a text element? How can I do?

    Note that all lines end with the SHIFT + ENTER.

    Example,

    It is a

    sample.

    After the line there is a there is (SHIFT + ENTER).

    Thanks for any help.

    Whenever the user enters the shift-enter, Photoshop inserts a control [EOT] (end of text) (\x03 or \u0003) character in the string.

    Also, in order to divide the text according to multiple separators in a single call, it is necessary to use a regular expression instead of a string.

    Try replacing:

    var theArray = theText.split("\r");
    

    with:

    var theArray = theText.split(/[\u0003\r]/);
    

    BTW, you can improve performance by explicitly asking the textKey for the current object of the layer property.

    Try using:

       ref.putProperty( charIDToTypeID("Prpr"), stringIDToTypeID("textKey") );
       ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    

    Instead of:

       ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
    

    HTH...

  • How to find the status of commitwork()?

    Hi guys,.

    I used the work of validation function in the custom field Delete button change. I want to know the status of the work of validation function that he has deleted successfully or not. Because whenever I need to reload the page to see the record has been removed from the grid.

    I can see a message indicating that your record has been deleted successfully with the State. Does perform a work around that.

    Thanks in advance

    http://docs.Oracle.com/CD/E41633_01/pt853pbh1/Eng/PT/TPCL/langref_PeopleCodeBuilt-inFunctionsandLanguageConstructs-073e6a.html#CommitWork-073e29

    CommitWork returns a Boolean value. That would be true if the data have been validated successfully, False otherwise.

    Based on the value returned a Boolean value you can display a message accordingly.

    For example:

    Local Boolean & commit = CommitWork();

    If & then commit

    / * Success * /.

    on the other

    / * Success * /.

    end - if;

  • How to find the number of lines executed for a single query in oracle

    Hi all

    I have a query that will return the details according to certain search criteria.
    Here I want to how many lines is performed (as a column) for the given search criteria, including the details of the column table... in a single query.



    Thanks in advance
    Geraldine

    I want all the details and number of rows in table...

    SQL> select ename, job, count (*) over () total
      from emp
     where deptno = 20
    /
    ENAME           JOB                     TOTAL
    --------------- ------------- ---------------
    SCOTT           ANALYST                     5
    SMITH           CLERK                       5
    JONES           MANAGER                     5
    ADAMS           CLERK                       5
    FORD            ANALYST                     5
    
    5 rows selected.
    
  • How to find the disk cleanup option - it is not among the accessories options

    Go to all programs, then Accessories, scrowlling - 'Disk cleanup' is not an option as it used to be before. Where to find this function on my Windows Vista?

    Hello

    Accessories - System - Disk Cleanup tools

    This is where it has always been

  • How to find the last pasted paragraphs FMP?

    I'm sticking FMP several objects at once in a file (a file of changes to the sections containing the changebars) in the main text flow. I want a separator line to go at the end of each pasted section, so I try to insert one after the paste operation. But instead of a line between each section, all lines are added at the end of the file, after all the sections. So if there are 3 glued sections at the end of the file are three lines. My code is below, do you know how I could fix this?

    Thank you, Mark

    function copyPasteChanges (doc, chgRange) {}

    Select the section with changebar and copy it.

    doc. TextSelection = chgRange;

    doc. Copy();

    Prepare for the changes doc and paste there the modified section.

    var firstChgPgf = changesDoc.MainFlowInDoc.FirstTextFrameInFlow.LastPgf;

    var changesTloc = new TextLoc (firstChgPgf, Constants.FV_OBJ_END_OFFSET);

    var changesTRange = new TextRange (changesTloc, changesTloc);

    changesDoc.TextSelection = changesTRange;

    changesDoc.Paste ();

    To go at the end of the file again (I think)

    var lastPgf = changesDoc.MainFlowInDoc.FirstTextFrameInFlow.LastPgf;

    var dividerPgf = changesDoc.NewSeriesPgf (lastPgf);

    var TLoc = new TextLoc (dividerPgf, 0);

    changesDoc.AddText (TLoc, '_');

    }

    Hi Mark,

    The problem is that the dough does not occur when you think. The dividing line is added at the end of the file, but are not your actions of dough. Actually, I think that maybe a little random where pasta is produced, because this line:

    var changesTloc = new TextLoc (firstChgPgf, Constants.FV_OBJ_END_OFFSET);

    .. .is does not create a valid text location. You can check this by abandoning the service after:

    changesDoc.TextSelection = changesTRange;

    .. and look at where's the insertion point. It will probably be everywhere where you left it last, because the call is not valid. I can't tell you exactly why, except that it has something to do with the fact that you are using the last paragraph in the stream. There is something weird to try to define a range of full-paragraph text with the last paragraph. I'm sure it's related to how the last TFP in a stream does not show a mark of FMP, but beyond that, I don't know how to do what you're trying to do with the last paragraph.

    Having no knowledge of how do it right, any time I need to do this, I create a paragraph "dummy" at the end of the flow to fill that space strange 'last FMP", then do the work around it. In the end, I just want to remove fake TFP. I don't know if it's a good idea or not, but it's the only way I ever get it to work and it sorts the mirror how you could do this manually in the GUI.

    With this, I modified your script as follows, and it seems to work better. Note that I also modified the logic of how to find the last paragraph of the flow by writing a separate function. Your call to the 'FirstTextFrameInFlow' is OK, unless your doc begins to span several pages and/or begins with several empty pages. The function I wrote ensures that you really the last TFP in the stream.

    I hope this helps.

    Russ

    function copyPasteChanges (doc, chgRange) {}

    Select the section with changebar and copy it.

    doc. TextSelection = chgRange;

    doc. Copy();

    Prepare for the changes doc and paste there the modified section.

    var lastPgf = getLastPgf (changesDoc);

    var dummyPgf = changesDoc.NewSeriesPgf (lastPgf);

    var changesTloc = new TextLoc (dummyPgf, 0);

    var changesTRange = new TextRange (changesTloc, changesTloc);

    changesDoc.TextSelection = changesTRange;

    changesDoc.Paste ();

    To go at the end of the file again (I think)

    Don't forget that last TFP is now fake TFP

    lastPgf = getLastPgf (changesDoc);

    var dividerPgf = changesDoc.NewSeriesPgf (lastPgf.PrevPgfInFlow);

    var TLoc = new TextLoc (dividerPgf, 0);

    changesDoc.AddText (TLoc, '_');

    dummyPgf.Delete ();

    }

    function getLastPgf (doc)

    {

    textFrame var is doc. MainFlowInDoc.LastTextFrameInFlow;

    var lastPgf = textFrame.LastPgf;

    While (! lastPgf.ObjectValid () & textFrame.ObjectValid ())

    {

    textFrame = textFrame.PrevTextFrameInFlow;

    lastPgf = textFrame.LastPgf;

    }

    Return lastPgf;

    }

  • How to find the number of data items in a file written with the ArryToFile function?

    I wrote a table of number in 2 groups of columns in a file using LabWindows/CVI ArrayToFile... Now, if I want to read the file with the FileToArray function so how do I know the number of items in the file. during the time of writing, I know how many elements array to write. But assume that I want the file to be read at a later time, then how to find the number of items in the file, so that I can read the exact number and present it. Thank you all

    Hello

    I start with the second question:

    bytes_read = ReadLine (file_handle, line_buffer, maximum_bytes);

    the second argument is the buffer to store the characters read, so it's an array of characters; It must be large enough to hold maximum_bytes the value NULL, if char [maximum_butes + 1]

    So, obviously the number of lines in your text tiles can be determined in a loop:

    Open the file

    lines = 0;

    While (ReadLine () > 0)

    {

    lines ++;

    }

    Close the file

  • Have deleted implementing up-to-date, but while they inspected I think it's still in my system in my history how to find the files to remove it completely?

    Original title: Remove KB3035583

    I deleted the update, but while they were inspecting it, I think it's still in my system in my history how to find the files to remove it completely?

    I am running Windows 7

    Microsoft have now updated the status of GWX, whenever changes to update is downloaded as a new update re. It is not beyond their intrigues to GWX ineffective as well. Unfortunately we have to be patient until 29 July when, according to the assurances of Microsoft this mess will be disabled. I don't know if there is code to turn it off or we wanted yet another update to do.

  • How to find the Mac address of a Blackberry Curve 8130 BlackBerry Smartphones

    I have a wireless router in my house that has a MAC filter enabled. I do not have permission to change this setting on the router. I need to find the Mac address of the Blackberry 8130 device to be added to the routers MAC filter allow list only.

    Can someone help me with the knowledge on how to find the MAC address of a Blackberry 8130 Curve?.

    Thanks for the help in advance.

    Concerning

    VK

    I forgot to mention: new to Blackberry Curve 8130 (previous was the old black version with the wheel) and the network is T-Mobile with SIM card (not CDMA).

    Does show under Options | Status as the WLAN Mac address?

  • How to find the size of the virtual server?

    Hello

    We intend to pass our applications 4 virtual servers has 2 physical servers. In this process, we need to identify the size of the current virtual servers to use as a starting point to configure or add the size in physical server. can anyone provide information on whats stats to be noticed and how to find the size of the current virtual servers?

    Thank you

    Hi Sekhar, there.

    in general, it is a fairly complex task if you want to size the new platform correctly, i.e. not to oversize it and have very low use below, i.e. spend too much on equipment.

    In fact, it's the first thing to consider the level of use of the new platform. Most likely your organization (HW and infrastructure) has targets to a minimum. optimal and maximum usage levels.

    In the case where you do not have this as a starting point, and then you continue with load average and the current peak (CPU, RAM, NW). To these basic lines, you can use the statistics of WLS Admin Console, where the use of CPU and memory statistics are presented since the server was last started. For more detailed statistics, you can use WLDF to capture measures key at regular intervals, and then base your analysis of these data.

    Finally and above all, the size of FS, but I've seen some comments above related to the size of the FS.

    HTH,

    A.

  • How to find the size of the table?

    Hi all

    Can anyone suggest how to find the size of the table? I had a few (15272 selected lines) on the name of "CMPT_" How can I check only 'CMPT_' size tables?





    Please someone help give the SQL query to run.


    Thanks in advance.


    Vincent

    madala03 wrote:

    Hi thanks for the reply

    I'm out like below

    SUM(BYTES/1024/1024)

    --------------------

    25383.25

    But how to check all the name of tables CMPT and their sizes?

    Select nom_segment, dba_Segments sum(bytes/1024/1024) where nom_segment like ' % CMPT GROUP BY nom_segment;

  • How to find the host ESX 4.1 SCSI tape drive card information...

    Dear team,

    last night we have installed card scsi tape drive on one of the host to ESX 4.1, just want to know how to find the details of scsi card in ESX 4.1 host, is possible to find via cli or hardware status tab?

    need help on the same.

    concerning

    Mr. VMware

    Hello

    You should find the information you are looking for by entering the following command.

    less/proc/scsi/aic79xx/6

    Kind regards

    Ralf

  • How to find the track of the script of the Controlfile Correct .trc file in /bdump

    Hi guys

    It's more childish requests in this forum...


    I want to know how to find the correct trace file when we question change database trace at sqlprompt to create controlfile script backup controlfile.

    As I find it a little confusing to go through the same day & .trc files almost even among hundreds of trace file in the directory /bdump to find the right one.

    If we find the alert log file in /bdump directory $ ls-al l * & get us the log file alert... If there's a similar way to find the Trace of controlfile script file?



    Thanks and greetings
    MZ

    Hi MZ;

    1. as mentioned here to use a BACKUP CONTROLFILE to TRACE AS syntax and give the name and the path that you want to
    2. check the alert.log
    3. check under bdump using the command ls - lrt

    PS: Please don't forget to change the status thread answer whether it is possible when believe you your thread replied, he pretend to wasting time in other forums users while they are looking outstanding which is not answered, thank you for understanding

    Respect of
    HELIOS

Maybe you are looking for

  • Why is an Addon without a button "delete" allowed?

    By mistake, I added an extension adware in my Firefox (ver. 32.0.3). It doesn't have a button 'delete '. I followed the instructions on how to remove it and it's over now. BUT, why in the world would any addon to Mozilla without a button being "delet

  • T530, 2101: Error detection on HDD2 (Sata Mini)

    I started to get this error every time that I reboot my machine. If I press boot ESC is going very well. Whats strange is that I watch have a Mini Sata HDD2 and if I do that I've never known about it and I can't put it in the Device Manager, etc.. Ho

  • mscorsvw.exe error

    While my pc was going through updates to MS, he projected blue.  After the reboot, I now get mscorsvw.exe error

  • Someone got my info and charged my account or you have been charged by mistake

    someone got my info and charged my account or you have been charged in error xbox live games. We went when it happen

  • Black display and loss of control after Vista updates

    Dark display died and the loss of no control, i.e. no key works & cannot turn off PC, after to apply updates to windows, once trying to display an attachment to an e-mail, once trying to use a link on another Web site. Update is responsible?  Can I d