How to get the ROWID in a Trigger?

On Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit when I try below script I always get the same Rowid as "AAAAAAAAAAAAAAAAAA". Is this normal?
Thank you.
create table testrowid (a number );
create or replace trigger testrowidbins
before insert on testrowid for each row
begin
dbms_output.put_line( 'Rowid:= ' || :new.rowid );
end;
set serveroutput on
insert into testrowid values( 1 );
insert into testrowid values( 2 );
insert into testrowid values( 3 );
rollback ;
insert into testrowid values( 1 );
insert into testrowid values( 2 );
insert into testrowid values( 3 );
commit ;
insert into testrowid values( 1 );
insert into testrowid values( 2 );
insert into testrowid values( 3 );
rollback ;

Well, it was more of a rhetorical question.
Rowid is the physical location of a row in a table. During the execution of a BEFORE trigger, the row has not yet been placed in the table hence the 'AAAAA' rowid.
During your AFTER trigger, the row exists in the table and therefore has a normal rowid.

Similar Messages

  • How to get the RowID in a VO

    Hi All,
    I have a expert mode VO. Its not a EO based VO. I need the row id in the VO query. But it throws me an ora-01445 error. I need the rowid because I need to pass it as a parameter to a procedure. How can i get this done. Any help is greatly appreciated.
    Thanks,
    Sreeram.

    HI,
    This is my sql query in the VO I am trying to develop:
    SELECT * from (SELECT aid.rowid,
    aid. ACCOUNTING_DATE,
    aid. DISTRIBUTION_LINE_NUMBER,
    aid. INVOICE_ID,
    aid. ACCRUAL_POSTED_FLAG,
    aid. ASSETS_ADDITION_FLAG,
    aid. ASSETS_TRACKING_FLAG,
    aid. CASH_POSTED_FLAG,
    aid. DIST_CODE_COMBINATION_ID,
    aid. LAST_UPDATED_BY,
    aid. LAST_UPDATE_DATE,
    aid. LINE_TYPE_LOOKUP_CODE,
    aid. PERIOD_NAME,
    aid. SET_OF_BOOKS_ID,
    aid. INVOICE_DISTRIBUTION_ID,
    aid. AMOUNT,
    g.code_combination_id,
    g.segment1,
    g.segment2,
    g.segment3,
    g.segment4,
    g.segment5,
    g.segment6,
    ppa.segment1 as Project,
    pt.task_number as TASK,
    aid.expenditure_type,
    aid.expenditure_item_date,
    hao.name as name
    FROM AP.AP_INVOICE_DISTRIBUTIONS_ALL aid,
    GL.GL_CODE_COMBINATIONS g,PA.pa_projects_all ppa, PA.pa_tasks pt, apps.hr_all_organization_units_tl hao
    WHERE aid. invoice_id = 19498
    AND LINE_TYPE_LOOKUP_CODE in ('ITEM')
    AND aid. DIST_CODE_COMBINATION_ID =g.code_combination_id
    AND aid.project_id = ppa.project_id(+)
    AND aid.task_id = pt.task_id (+)
    AND aid.expenditure_organization_id = hao.organization_id (+)) QRSLT where 1=2
    But it gives me this error:
    SQL QUERY ERROR MESSAGE:ORA-01445 Cannot select rowid from, or sample a join view with out a key-preserved table.
    Btw..this is a custom application.
    Any pointers on this..
    Thanks,
    Sreeram.
    Edited by: SreeramKosaraju on Jun 29, 2009 9:58 AM

  • How to get the rowid and the entire record selected in PLSQL?

    The code given below does not work.
    You cannot select the record and the rowid using a cursor in one-shot.
    But you could do that in a direct SELECT in "SQL Plus" when you select records for display. Is this a bug in ORACLE PLSQL? Or is there another way to do this?
    DECLARE
    objid_ VARCHAR2(200);
    rec_ xxx_tab%ROWTYPE;
    CURSOR get_rec IS
    SELECT t.*, t.rowid
    FROM xxx_tab t;
    BEGIN
    OPEN get_rec;
    FETCH get_rec INTO rec_, objid_;
    CLOSE get_rec;
    END;
    -----------------------------------

    You cannot fetch into both a record type and a variable. You have a few options, you can declare the record a s a rowtype of the cursor like this:
    DECLARE
       CURSOR c IS
          SELECT t.*, rowid rid
          FROM t;
       l_rec c%ROWTYPE;
    BEGIN
       OPEN c;
       FETCH c INTO l_rec;
       CLOSE c;
    END;You could use an implicit cursor and let Oracle deal with the record type internally (not to mention the open fetch and close) like this:
    BEGIN
       FOR rec in (SELECT t.*, rowid rid FROM t) LOOP
          do_stuff with rec.col_name
       END LOOP;
    END;Note that in both of these you must alias the rowid column to some other name, you could also manually construct the record type to match the table and add a column od ROWID datatype to hold the rowid.
    Finally, I think, depending on what you are actually going to do with the rowid, and how you feel about having records locked, you could look at declaring the cursor as FOR UPDATE and get rhe rowid for free.. This would be most appropriate if you are planning to update the table in the cursor (a bad practce by the way). Something like:
    DECLARE
       l_rec t%ROWTYPE;
       CURSOR c IS
          SELECT t.*, rowid
          FROM t;
    BEGIN
       OPEN c;
       FETCH c INTO l_rec;
       do_whatever with l_rec
       UPDATE t
       SET whatever
       WHERE current of c;
    END;John

  • How to get the username in  "atfer serverror" trigger ?

    Hi folks;
    How to get the name of the user who just miss his connection to the database in a "after serverror" trigger ?
    The code of the trigger :
    create or replace
    TRIGGER TRG_LOGGON_FAILURES
    AFTER SERVERERROR ON DATABASE
    BEGIN
      IF (IS_SERVERERROR(1017)) THEN
      UPDATE utilisateur_ora SET UTO_STA='BLOQUE', UTO_DATE_STATUT=sysdate WHERE UTO_USR_GPL=<var_user>;
      COMMIT;
      END IF;
    END;

    OK !
    Use that maybe good :
    select USERID into v_user from sys.aud$
      where ntimestamp#=(
      select max(ntimestamp#)
      from sys.aud$ );

  • How to get the return values from a web page

    Hi all :
       how to get the return values from a web page ?  I mean how pass values betwen webflow and web page ?
    thank you very much
    Edited by: jingying Sony on Apr 15, 2010 6:15 AM
    Edited by: jingying Sony on Apr 15, 2010 6:18 AM

    Hi,
    What kind of web page do you have? Do you have possibility to for example make RFCs? Then you could trigger events (with parameters that could "return" the values) and the workflow could react to those events. For example your task can have terminating events.
    Regards,
    Karri

  • How to get the focus of particular UI Element

    Hi All,
    How to get the focus of particular UI Element in webdynpro Page,
    I have a page where i am creating a ALV, I want to get that keyboard focus is on that element is there or not?
    Can anyone please give some update?
    Best regards,
    Rohit

    I would suggest try invoking REFRESH of ALV on the ON_CELL_ACTION event.
    Below excerpt is from Thomas
    The Events of inner UI elements are not exposed directly as they normally would be if they were standalone. Generally you can capture them using either the
    ON_DATA_CHECK:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c8/6c80dbedfe42d1a93f8e6df1d7244a/frameset.htm
    This gets trigger for any press of ENTER, so it generally works like the Input Field onEnter.
    You could also consider ON_CELL_ACTION:
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/45/12093591152464e10000000a1553f7/frameset.htm
    It is a higher level Event that encompasses both ON_DATA_CHECK and ON_CLICK.
    if you want to capture & refresh on some hot key combination then refer to this thread
    [https://www.sdn.sap.com/irj/scn/profile?editmode=true&userid=3760417]

  • How to get the total number of pages printed in a report?

    Hi All,
    I have a requirement where I need to print a frame of fields only in the last page. Unfortunately I cannot use the 'Print Object On' property as it doesnt work in my case. So, I am planning to write a format trigger on the frame to return TRUE if the page is the last physical page. Now, I need to know how to get the total number of physical pages that will get printed in the report so that I can use this to manipulate the frame. I was planning to use the 'Total Physical Pages' built-in, but it seems like I can just use it to print in a field and I can't use this field's value anywhere in the plsql code (formula column function/format trigger) in the report. Is there anyway to get the total number of pages printed in the report which can be used in the report plsql code?
    Thanks,
    Srini.

    i found the solution, thanks

  • How to get the current schema name

    Hi,
    Can anybody please tell me how to get the current schema name, there is some inbuilt function for this,but i am not getting that. Please help me.
    Thanks
    Jogesh

    ok folks, I found the answer at Tom's as usual.
    http://asktom.oracle.com/tkyte/who_called_me/index.html
    I rewrote it into a function for kicks. just pass the results of DBMS_UTILITY.FORMAT_CALL_STACK to this function and you will get back the owner of the code making the call as well some extra goodies like the name of the code and the type of code depending on the parameter. This ignores the AUTHID CURRENT_USER issues which muddles the schemaid. Quick question, does the average user always have access to DBMS_UTILITY.FORMAT_CALL_STACK or does this get locked down on some systems?
    cheers,
    paul
    create or replace
    FUNCTION SELF_EXAM (
       p_call_stack VARCHAR2,
       p_type VARCHAR2 DEFAULT 'SCHEMA'
    ) RETURN VARCHAR2
    AS
       str_stack   VARCHAR2(4000);
       int_n       PLS_INTEGER;
       str_line    VARCHAR2(255);
       found_stack BOOLEAN DEFAULT FALSE;
       int_cnt     PLS_INTEGER := 0;
       str_caller  VARCHAR2(30);
       str_name    VARCHAR2(30);
       str_owner   VARCHAR2(30);
       str_type    VARCHAR2(30);
    BEGIN
       str_stack := p_call_stack;
       -- Loop through each line of the call stack
       LOOP
         int_n := INSTR( str_stack, chr(10) );
         EXIT WHEN int_cnt = 3 OR int_n IS NULL OR int_n = 0;
         -- get the line
         str_line := SUBSTR( str_stack, 1, int_n - 1 );
         -- remove the line from the stack str
         str_stack := substr( str_stack, int_n + 1 );
         IF NOT found_stack
         THEN
            IF str_line like '%handle%number%name%'
            THEN
               found_stack := TRUE;
            END IF;
         ELSE
            int_cnt := int_cnt + 1;
             -- cnt = 1 is ME
             -- cnt = 2 is MY Caller
             -- cnt = 3 is Their Caller
             IF int_cnt = 1
             THEN
                str_line := SUBSTR( str_line, 22 );
                dbms_output.put_line('->' || str_line);
                IF str_line LIKE 'pr%'
                THEN
                   int_n := LENGTH('procedure ');
                ELSIF str_line LIKE 'fun%'
                THEN
                   int_n := LENGTH('function ');
                ELSIF str_line LIKE 'package body%'
                THEN
                   int_n := LENGTH('package body ');
                ELSIF str_line LIKE 'pack%'
                THEN
                   int_n := LENGTH('package ');
                ELSIF str_line LIKE 'anonymous%'
                THEN
                   int_n := LENGTH('anonymous block ');
                ELSE
                   int_n := null;
                END IF;
                IF int_n IS NOT NULL
                THEN
                   str_type := LTRIM(RTRIM(UPPER(SUBSTR( str_line, 1, int_n - 1 ))));
                 ELSE
                   str_type := 'TRIGGER';
                 END IF;
                 str_line  := SUBSTR( str_line, NVL(int_n,1) );
                 int_n     := INSTR( str_line, '.' );
                 str_owner := LTRIM(RTRIM(SUBSTR( str_line, 1, int_n - 1 )));
                 str_name  := LTRIM(RTRIM(SUBSTR( str_line, int_n + 1 )));
              END IF;
           END IF;
       END LOOP;
       IF UPPER(p_type) = 'NAME'
       THEN
          RETURN str_name;
       ELSIF UPPER(p_type) = 'SCHEMA.NAME'
       OR    UPPER(p_type) = 'OWNER.NAME'
       THEN
          RETURN str_owner || '.' || str_name;
       ELSIF UPPER(p_type) = 'TYPE'
       THEN
          RETURN str_type;
       ELSE
          RETURN str_owner;
       END IF;
    END SELF_EXAM;

  • How to get the workitem

    hi ,
    im using the task to trigger work item to a person and scheduled a deadline. but suddenly my connection to the server has lost.
    again i have opened my inbox i could not be able to have the workitem in my inbox.
    but the deadline is already triggered to another person regarding this work item.
    in this case how to get the workitem in my inbox?
    how these kind of scenarios are being handled ?
    Raghu

    You can check which are the workflow you have started from
    SBWP->OUTBOX ->Started Workflows. There you will get the workflow and check this from the Workflow log by hitting the Wflow Log button.
    Thanks
    Arghadip

  • How to get the sine wave sample of the input and output in the same time?

    I discovered that the samples were acquired did not in the same time in my vi.Could you tell me how to get the sine wave sample of the input and output in the same time?
    Output:9263;
    Input:9201
    Attachments:
    singal requency.vi ‏104 KB

    Hello Yun_Zhu,
    Your VI looks like you started from an example, and you are on the right track. 
    To clarify are you trying to synchronize the input and the output waveforms?  If you you will need to share a time base and a start trigger.  Check out the synchronization examples from LabVIEW
    Anthony F.
    Product Marketing Engineer
    National Instruments
    Attachments:
    HIODAQmxSyncMultiDev.png ‏70 KB

  • Getting the ROWID of a Row

    I'm trying to develop a generic OCI class which is also capable
    of inserting, updating and deleting records.
    Is there an OCI function which gets the ROWID of a returned row
    without having to explicitly specify it in the SELECT clause of
    the query ? At present the fields that make up the primary key
    or unique index have to be specified in the SELECT.
    Does anyone know how the OO4O Class Library gets round this
    problem ?
    Upto now I have been using OO4O but now wish to migrate to OCI
    for compatibility reasons.

    If it is a SELECT for UPDATE, the ROWID is implicitly returned .
    It can be retrieved by calling OCIAttrGet on the statment handle.

  • How to get the values from popup window to mainwindow

    HI all,
       I want to get the details from popup window.
          i have three input fields and one search button in my main window. when i click search button it should display popup window.whenever i click on selected row of the popup window table ,values should be visible in my main window input fields.(normal tables)
       now i am able to display popup window with values.How to get the values from popup window now.
       I can anybody explain me clearly.
    Thanks&Regards
    kranthi

    Hi Kranthi,
    Every webdynpro component has a global controller called the component controller which is visible to all other controllers within the component.So whenever you want to share some data in between 2 different views you can just make it a point to use the component controller's context for the same. For your requirement (within your popups view context) you will have have to copy the component controllers context to your view. You then will have to (programmatically) fill this context with your desired data in this popup view. You can then be able to read this context from whichever view you want. I hope that this would have made it clear for you. Am also giving you an [example|http://****************/Tutorials/WebDynproABAP/Modalbox/page1.htm] which you can go through which would give you a perfect understanding of all this. In this example the user has an input field in the main view. The user enters a customer number & presses on a pushbutton. The corresponding sales orders are then displayed in a popup window for the user. The user can then select any sales order & press on a button in the popup. These values would then get copied to the table in the main view.
    Regards,
    Uday

  • How to get the table of value field? and can we expand the technical limits

    Dear
    I have created value field in COPA with KEA6. And now, I need the table which the value fields are saved. Yet, I have tried a lot to find it and get failure? Can any guy help me? Please tell me how to get the table of a value field.
    And another question is that, can we extend the technical limits for the number of value field for ECC6.0?
    We have a note for R.4.x Please see below:
    OSS note 160892
    You can display the length of a data record using Transaction KEA0 ('Maintain Operating Concern'). After you have navigated to the 'Characteristics Screen' or to the 'Value field Screen' choose menu path 'Extras -> Technical Limits'.
    The maximum displayed here under 'Length in bytes on the DB' is the maximum length permitted by the Dictionary. The reserve required for the release upgrade must be subtracted from this value.
    To increase the allowed number of the value fields, increase the value that is assigned to field ikcge-bas_max_cnt (FORM init_ikcge_ke USING fm_subrc, approx. line 165) in Include FKCGNF20. It specifies the number of the possible value fields. The corresponding part of the source code is attached to the note as a correction.
    David Sun
    Regards!

    how to extend the limit of value numbers? please see the original question.

  • I downloaded and bought a movie from iTunes on my iPad and now want the same movie on my MacBook Pro but its not offering me to download it, it giving me the options of buying it which I already did. How I get the movie onto my MacBook?

    I downloaded and bought a movie from iTunes on my iPad and now want the same movie on my MacBook Pro but its not offering me to download it, it giving me the options of buying it which I already did. How I get the movie onto my MacBook?

    You can connect the iPad to your Mac's iTunes and do File > Devices > Transfer Purchases, that should copy it over to the Movies part of your library.
    Depending upon what country that you are in, and whether the film studio allows it, you might also be able to re-download it on your Mac via the Purchased link under Quicklinks on the right-hand side of the iTunes store home page.

  • How to get the value from a JavaScript and send the same to Java file?

    Hi.
    How to get the value from a JavaScript (this JS is called when an action invoked) and send the value from the JS to a Java file?
    Thanks and regards,
    Leslie V

    Yes, I am trying with web application.
    In the below code, a variable 'message' carries the needed info. I would like to send this 'message' variable with the 'request'.
    How to send this 'message' with and to the 'request'?
    Thanks for the help :-)
    The actual JS code is:
    function productdeselection()
    var i=0;
    var j=0;
    var deselectedproduct = new Array(5);
    var message = "Are you sure to delete Product ";
    mvi=document.forms[0].MVI;
    mei=document.forms[0].MEI;
    lpi=document.forms[0].LPI;
    if(null != mvi)
    ++i;
    if(null != mei )
    ++i;
    if(null != lpi)
    ++i;
    if(null != mvi && mvi.checked)
    deselectedproduct[++j]="MVI?";
    if(null != mei && mei.checked)
    deselectedproduct[++j]="GAP?";
    if(null != lpi && lpi.checked)
    deselectedproduct[++j]="LPI?";
    if( 0!=j)
    if(i!=j)
    for (x=0; x<deselectedproduct.length; x++)
    if(null != deselectedproduct[x])
    message =message+ "-" +deselectedproduct[x];
    alert(message);
    else
    //alert(" You cannot remove all products!");
    return false;
    return true;
    }

Maybe you are looking for

  • Moving Libraries between users on same MacBook Pro

    So when I bought my new MacBook Pro, I started a new user account and imported my old user acct from my Black MacBook.  This may have been a mistake because now I have an iPhoto library and an iTunes library for each user on my new MacBook Pro.  I wo

  • Exporting from CS4 doesn't work.

    I edited together some footage, exported using Media Encoder as h.264. The progress bar reaches the end and then nothing. The status remains as "Encoding". In my export folder there is a .m4v file that is 2.68 GB, and .aac file that is 172 MB and a .

  • Printing a Numbers document

    I want to print a Numbers document from an iPad2 to a WiFi Canon MX882 printer. I have Numbers Version 1.5 on my iPad and Numbers '08 on my new iMac with Lion. I've tried sending the document to Numbers on the iMac but it says I must use Numbers '09.

  • Outlook Add-in Deployment

    I have create an outlook add-in. When i run it in my machine ,it works fine. Then i publish  it. I click the .vsto file in client machine to deploy add,it runs well and  there is no warning,when i open the outlook,i can see the add_in.however when i

  • Presenting a Quicktime movie on a secondary display

    Has anyone figured out how to present a Quicktime movie with applescript on another display? supposedly you can do it with present movie 1 display N where N is the display number. However, no matter what number I type for N, I the movie always presen