Getting ROWID without using "FOR UPDATE" in statement

Hi,
Is there any way to get the ROWID of the current record without using "FOR UPDATE" in the statement?
Here's the story...
I'm actually working on a server that receives multiple connections from client applications. The server interacts with OCI for selecting, updating, fetching and so on. The server is able to manage many opened recordset from clients.
Here's a possible scenario:
- A client asks the server to open a recordset ie: "SELECT * FROM foo".
- Then, the server receives a command to position the cursor on the last record ie: "OCIFetch2->LAST".
- Finally, the client decides to update the current (last) record.
Since the server can receive other requests such as opening a new recordset from another client, I can't use "SELECT * FROM foo FOR UPDATE" because it blocks further call to OCIStmtExecute (even in NONBLOCKING mode).
At the same time, I can't COMMIT the transaction after the "SELECT" statement otherwise the selection gets invalidated. The selection needs to remain valid until the client decides to "close the recordset".
Is there any workaround?
Any help would be appreciated!
Thanks,
Jonathan Primeau
Software Engineer
Integration New Media, inc.

Hi again,
I found that OCIRowidToChar could save my life. In fact, by retrieving the ROWID equivalent string I could use it to build a statement like:
update foo set c1 = 1 where rowid = 'AAAHZuAABAAAMViAAL';
which will solve my problem since these strings don't change and represents a unique record.
The problem is when I try to compile this method it says:
test.cpp: In function `sword OpenRecordset(OCIServer*&, OCISvcCtx*&, OCIStmt*&,
COLDEF*)':
test.cpp:382: `OCIRowidToChar' undeclared (first use this function)
test.cpp:382: (Each undeclared identifier is reported only once for each
function it appears in.)
make: *** [test] Error 1
It seems that this function is not declared under Solaris/Oracle 9i. I searched on the web and there is not much information about that. However, it is documented in the Oracle book.
Is there any way to use this function under Solaris? If not, how can I get the string that represents a ROWID?
I use the following syntax:
sword OCIRowidToChar ( OCIRowid *rowidDesc,
OraText *outbfp,
ub2 *outbflp
OCIError *errhp );
Best regards,
Jonathan
Software Engineer
Integration New Media, inc.

Similar Messages

  • Updating ARDT table without using direct update statement

    hi,
        can any one guide me how to update REMARK field in the ADRT table without using direct UPDATE statement. It would be helpful if any one can tell me the bapi or a function module with a sample code.

    Hi                                                                               
    <b>SZA0                           Business Address Services (w/o Dialog) </b> ADDR_PERSONAL_UPDATE                                                          
    ADDR_PERSON_UPDATE                                                            
    ADDR_PERS_COMP_UPDATE                                                         
    ADDR_UPDATE                                                                   
    these are the four function modules which will update the (Business Address Services) reward if usefull
    check these is there any  help ful for u or not

  • Using for update clause in VPD(Virtual Private Databases)

    Hi,
    We are using for update clause in our procedure to explicitly lock rows in a particular table as shown below:
    SELECT AMOUNT FROM INTERFACE_TABLE
    INTO T_Amount
    WHERE ROWID = :B1
    FOR UPDATE OF BANK_ACCOUNT_NUM NOWAIT;
    But this statement is giving the following error in VPD:
    ORACLE error 1733 in FDPSTP
    Cause: FDPSTP failed due to ORA-01733: virtual column not allowed here.
    We need to lock rows in that particular table until the commit is issued,so as to prevent the updation of the rows which are being processed.
    Is there any other way in which this can be achieved.
    Thanks & Regards,
    Brahmendra Kashyap

    From the docs, which you didn't read:
    ORA-01733 virtual column not allowed here
    Cause: An attempt was made to use an INSERT, UPDATE, or DELETE statement on an expression in a view.
    Action: INSERT, UPDATE, or DELETE data in the base tables, instead of the view.
    Can you explain why you didn't read the docs? I'm just curious why so many people do absolutely nothing to resolve their problem (they would learn Oracle by doing so) and request to be spoon fed.
    Sybrand Bakker
    Senior Oracle DBA
    Experts: those who did read the documentation.

  • HT5037 what happened to iphoto5? can't get on without paying for upgrade

    I can't get on without paying for upgrade or access my photos..ugh!!

    With the amount of information you've provided it's impossible to offer a potential solution.  We can't see your computer so we need to know the details of your problem and setup, i.e.:
    what version of iPhoto are you using?
    what system version are you running?
    what do you see when iPhoto opens?
    what fixes have you tried?
    where is you library located?
    did you apply any updates or upgrades just prior to the problem occurring?
    are you running a "managed" or "referenced" library?
    what type of Mac?
    how much free space on your boot drive?
    OT

  • URGENT:HOW TO COMBINE CLUSTER AND TRANSPARENT TABLE..WITHOUT USING FOR ALL

    how can we join bkpf and bseg without using FOR ALL ENTRIES.HOW DO I COMBINE THE 2 TABLES SO THAT I GET BETTER PERFORMANCE.
    START-OF-SELECTION.
    SELECT bukrs belnr gjahr budat FROM bkpf INTO TABLE i_bkpf
    WHERE bukrs = p_bukrs AND "COMPANY CODE
    gjahr = p_gjahr AND "FISCAL YEAR
    budat IN s_budat. "POSTING DATE IN DOC
    IF sy-subrc = 0.
    SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE
    i_bseg FOR ALL ENTRIES IN i_bkpf
    WHERE bukrs = i_bkpf-bukrs AND "COMPANY CODE
    belnr = i_bkpf-belnr AND "A/CING DOC NO
    gjahr = i_bkpf-gjahr AND "FISCAL YEAR
    hkont = p_hkont. "General Ledger Account"
    IF sy-subrc = 0.
    SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE
    i_bseg1 FOR ALL ENTRIES IN i_bseg
    WHERE bukrs = i_bseg-bukrs AND "COMPANY CODE
    belnr = i_bseg-belnr AND "A/CING DOC NO
    gjahr = i_bseg-gjahr. "FISCAL YEAR
    ENDIF.
    ENDIF.
    IF NOT i_bseg1[] IS INITIAL.
    LOOP AT i_bseg1.
    IF i_bseg1-hkont = p_hkont AND i_bseg1-shkzg = 'S'.
    v_sumgl = v_sumgl + i_bseg1-dmbtr.
    ELSEIF i_bseg1-hkont = p_hkont AND i_bseg1-shkzg = 'H'.
    v_sumgl = v_sumgl - i_bseg1-dmbtr.
    ELSEIF i_bseg1-hkont NE p_hkont .
    IF i_bseg1-shkzg = 'H'.
    i_bseg1-dmbtr = - i_bseg1-dmbtr.
    ENDIF.
    i_alv-hkont = i_bseg1-hkont.
    i_alv-dmbtr = i_bseg1-dmbtr.
    APPEND i_alv.
    v_sumoffset = v_sumoffset + i_bseg1-dmbtr.
    ENDIF.
    ENDLOOP.
    regards
    Essam.([email protected])

    Hi Friend,
      I see your code.. there is no other way than using for all entries for your situation.. how ever i saw ur code and a small recommandation in the change of code.
    SELECT bukrs belnr gjahr budat FROM bkpf INTO TABLE i_bkpf
    WHERE bukrs = p_bukrs AND "COMPANY CODE
    gjahr = p_gjahr AND "FISCAL YEAR
    budat IN s_budat. "POSTING DATE IN DOC
    IF sy-subrc = 0.
    if not p_hkont is initial.
    SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE
    i_bseg1 FOR ALL ENTRIES IN i_bkpf
    WHERE bukrs = i_bseg-bukrs AND "COMPANY CODE
    belnr = i_bseg-belnr AND "A/CING DOC NO
    gjahr = i_bseg-gjahr. "FISCAL YEAR
    ENDIF.
    i_bseg[] = i_bseg[]1.
    delete i_bseg where hkont ne p_hkont.
    else.
      Your existing logic...
    endif.
    In this way you can avoide writing two selects on bseg..
    Thanks
    Mahesh

  • How to unlock a row if i use FOR UPDATE clause

    In procedure if we use FOR UPDATE clause, it will lock particular row and allow only one client to update whereas other client can only fetch data in the same row at that time.
    My question is when will it unlock the row, what should we do to unlock the row while writing procedure. Take this example here im using FOR UPDATE clause for client_count, when ll it unlock that particular row in this procedure.
    create or replace PROCEDURE newprocedur(inMerid IN VARCHAR2,outCount OUT NUMBER) AS
    CURSOR c1 IS
    select CLIENT_COUNT from OP_TMER_CONF_PARENT where MER_ID = inMerid FOR UPDATE OF CLIENT_COUNT;
    BEGIN
    Open c1;
    loop
    fetch c1 into outCount;
    exit when c1%NOTFOUND;
    outCount:=outCount+1;
    update OP_TMER_CONF_PARENT set CLIENT_COUNT = outCount where current of c1;
    end loop;
    close c1;
    END;

    Hi,
    Basically you are incrementing client_count by 1 , Why you have to fetch row one by one and update? you could just finish that in a single update
    UPDATE OP_TMER_CONF_PARENT
    SET CLIENT_COUNT = CLIENT_COUNT+1
    WHERE MER_ID     = inMerid This will increment client_count of all rows by one for the given mer_id;
    After updating you have to make the changes permanent so that other users will see the changes you have made.
    To lock the row before update you can use same select statement in you cursor
    SELECT CLIENT_COUNT
    FROM OP_TMER_CONF_PARENT
    WHERE MER_ID = inMerid FOR UPDATE OF CLIENT_COUNT;You can further modify the procedure to let other users know if the row is being updated.
    Regards
    Yoonas

  • TS1717 I have older version of itunes on Windows Vista, when i check for updates it states it cannot connect to itunes update server even though i am connected to the internet, i have an iphone that has songs in the cloud and i wan to add them to my libra

    I have older version of itunes on Windows Vista, when i check for updates it states it cannot connect to itunes update server even though i am connected to the internet, i have an iphone that has songs in the cloud and i want to add them to my library?

    Try updating your iTunes using an iTunesSetup.exe (or iTunes64Setup.exe) installer file downloaded from the Apple website:
    http://www.apple.com/itunes/download/

  • Perform multiplication, division n get remainder without using arithmetic o

    hello,
    perform multiplication, division n get remainder without using arithmetic operators
    thanks in advance
    manasi

    ram.manasi wrote:
    i can program myself however i am new to programming and have no clue how to perform arithmmetic operations without using arithmetic operators n would like to know how to go about itwell, we're not your private code-monkeys nor are we tutors. We are usually best at answering specific questions but many of us get our hackles up when someone simply demands an answer. I suggest that you find out what your teacher is expecting of you here. I would guess that this involves some recursion, but it is up to you to find out. Do some work. Then if you have a specific question, please feel free to come back and ask for help. nicely.

  • Updating without using the updater?

    Hi I was wondering if it is possible to download updates without using the updater as it is for a pc that is not online. Im after 3.2.0 on xp.
    Many thanks

    You can download the Windows updates
    here and the Mac updates
    here.

  • Using for update

    hii evryone,
    I'm retreving rows using for update
    select n from r_dummy_1 for update nowait;
    I'll update
    new session>
    I've login thru another session but there I'm able to view the same record with previous value before commiting it .Cant I lock my record from viewing it.????Because the person who had login thru different session may be reading previous value and this may lead to loss of data integrity.

    This is one of the fundamental database concepts and you should read through the Oracle docs to completely understand the principles on which Oracle operates.
    To keep it short here,
    - what you see in another session will be committed, consistent data. This is known as Read-Consistency.
    - unless or until you commit changes in one session, you should not be able to see the changes in any other session. If you do see only that will cause data integrity issue.
    E.g.:
    Assume Table A has got 10 rows before any one logs into the database.
    Session 1 - You login and insert 5 records into table A.
    In your session you will see a count of 15 records, which you can manipulate however you want before committing the changes.
    Session 2 - Another user logs in. You have NOT committed your changes. What if he queries Table A and gets to see 15 records and gets to use those records. While he tries to use those records if you ROLLBACK your session changes imagine the spite of data - this is a serious data integrity issue and is danagerous.
    That is why Oracle allows read-consistent access to data. Also unlike other database, Oracle does not block reads from writes.
    Study References to start with:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14220/title.htm#BEGIN
    or better yet I strongly recommend Tom Kyte's book: Expert One on One Oracle

  • How do creative cloud apps get installed without asking for administrator?

    The title says it all but I'll reiterate. How do CC apps downloaded with the Creative Cloud desktop app get installed without asking for administrator user/password? Its the sam on both Mac and Windows and I don't understand how its doing it. This seems like a security hole to me.

    JscottCMD are you installing the Adobe Creative applications with a Creative Cloud Individual subscription?  If so please see Install and update apps - https://helpx.adobe.com/creative-cloud/help/install-apps.html for information on how to install the applications and updates included with your membership.

  • How to lock a row by using 'for update'?

    how to lock a row by using 'for update'?

    Hi,
    SELECT * FROM <TABLE> WHERE <PK_COLUMN>=<VALUE> FOR UPDATE NOWAITThis will help in locking the row with the primary key value that you provide
    cheers
    VT

  • My computer broke and I got it fixed. It doesn't say that the hard-drive was replaced, but I can tell my data is gone, including Pages that I bought. Is there any way of getting that without paying for it again?

    My computer broke and I got it fixed. It doesn't say that the hard-drive was replaced, but I can tell my data is gone, including Pages that I bought. Is there any way of getting that without paying for it again?

    Or if you purchased Pages as part of iWork on a disk, reinstall from the same disk.
    Best of luck.

  • Lauguage packs for Windows 2012. Where can I find them without using Windows updates? I have an MSDN account but don't see them

    Hello all,
    Where can I find the language packs for WIndows 2012 r2? I can't use Windows updates so get them. I'm trying to find a manual download. I have a MSDN account but I don't see language packs on the MSDN site. Are they located on the site? I think I need a
    win_srv_2012_64bit_multi_language_lp_oem. Will the 2008 r2 or Windows 7 language packs work?

    Hi,
    Please also take a look at the article below:
    Available Language Packs for Windows
    http://technet.microsoft.com/en-us/library/hh825678.aspx
    Hope this may help
    Best regards
    Michael
    If you have any feedback on our support, please click
    here.
    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

  • Why my cellphone gets hot without using

    Why my cellphone gets hot without using

    Operate iOS devices where the temperature is between 0º and 35º C (32º to 95º F). Low- or high-temperature conditions might temporarily shorten battery life or cause the device to alter its behavior to regulate its temperature.
    Store the device where the temperature is between -20º and 45º C (-4º to 113º F). Don’t leave the device in your car, because temperatures in parked cars can exceed this range.
    When using the device or charging the battery, it is normal for it to get warm. The exterior of the device functions as a cooling surface that transfers heat from inside the device to the cooler air outside.
    Conditions and activities that may cause the device to alter performance and behavior include:
    Leaving the device in a car on a hot day.
    Leaving the device in direct sunlight for an extended period of time.
    Using certain features in hot conditions or direct sunlight for an extended period of time, such as GPS tracking or navigation in a car, or playing a graphics-intensive game.
    If the interior temperature of the device exceeds the normal operating range, the device will protect its internal components by attempting to regulate its temperature. If this occurs, you may notice the following:
    The device stops charging.
    The display dims or goes black.
    In navigation:The device will present an alert and turn off the display:
    Navigation will continue to provide audible turn-by-turn directions. When approaching a turn, the display will illuminate to guide you through the turn.
    To return the device to normal operation, press the Home Button and slide to unlock. If the device has cooled down enough, you can continue normal usage.
    Drive and ride safely. Give full attention to driving or riding and to the road.
    Cellular radios will enter a low-power state. The signal may weaken during this time.
    The camera flash is temporarily disabled.
    If the device exceeds a certain temperature threshold, it will present a temperature warning screen similar to this:
    To resume use of your device as quickly as possible, turn it off, move it to a cooler environment, and allow it to cool down.
    Note (iPhone only): When this message appears, the device may still be able to make emergency calls.

Maybe you are looking for