Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Error: ERR-1002 Unable to find item ID for item "ROWID"

John like many othersAug 10 2020 — edited Aug 11 2020

Hello

I have an Interactive GRID and would like to insert/update by PL/SQL on Processing (Interactive Grid - Automatic Row Processing (DML)). Therefore I have taken the code template in the Help area and adjusted for my table:

begin

    case :APEX$ROW_STATUS

    when 'C' then

        insert into T_IB_SD_AIC_AUM_EXCLUSIONS_T ( cont_type_gk, validfrom, validto, bu_gk_list )

        values ( :CONT_TYPE_GK, :VALIDFROM, :VALIDTO, :BU_GK_LIST )

        returning rowid into :ROWID;

    when 'U' then

        update T_IB_SD_AIC_AUM_EXCLUSIONS_T

           set cont_type_gk = :CONT_TYPE_GK,

               validfrom = :VALIDFROM,

               validto = :VALIDTO,

               bu_gk_list = REPLACE(:BU_GK_LIST, ':', ',')

         where rowid = :ROWID;

    when 'D' then

        delete T_IB_SD_AIC_AUM_EXCLUSIONS_T

         where rowid = :ROWID;

    end case;

end;

-> The column ROWID is present and defined as PK

- Update will be ignored, no error message but the original record appears after refreshing the region

- Insert statement returns an error message: Error: ERR-1002 Unable to find item ID for item "ROWID"

I'm a bit confused it says "item" because it's a column. I'm aware Apex is pretty stupid about hidden fields and made the ROWID column visible in the interactive Grid but still the same error message.

Anyone has an idea what the problem is and how to fix it?

-> Oracle Apex 19.2

This post has been answered by John like many others on Aug 11 2020
Jump to Answer

Comments

Keyser

I've tried to reproduce the issue using the EMP table on 20.1 but can't, it works fine

can you put this into your "JavaScript Initialization Code" for the ROWID item, run the page and copy/paste the output from your browser dev tool console

function( options ) {

    console.log(options);

    return options;

}

Vikas Kumar Pandey

Hi there,

Your code is ok and use ROWID in select query.

John like many others

Thank you guys for help, really appreciated!

Added your code in ROWID on Javascript initialization, output:

  1. Object
    1. dataType: "ROWID"
    2. id: "147320781881306831"
    3. isHidden: true
    4. isPrimaryKey: true
    5. isReadOnly: false
    6. name: "ROWID"
    7. staticId: "C147320781881306831"
    8. __proto__: Object

As every row in an interactive GRID has it's own ROWID I assume APEX is aware of that.

Keyser

this is mine from 20.1

  1. Object
    1. dataType: "ROWID"
    2. id: "33623506008920468369"
    3. isHidden: true
    4. isPrimaryKey: true
    5. name: "ROWID"
    6. staticId: "C33623506008920468369"
    7. __proto__: Object

isReadOnly is the only difference, you could try setting that back but i don't see why it would break it

personally I'm not a fan of using ROWID, under certain conditions it can change and that would cause you all sorts of problems...

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlrf/ROWID-Pseudocolumn.html#GUID-F6E0FBD2-983C-495D-98…

is there a reason you aren't using a normal Primary Key for your DML?

John like many others

I initially had it to "value protected" (read only) also to try out if this is the problem....

Now you may laugh: The table HAS a primary and I initially used it but after loading the mask all records in the displayed GRID were blue (selected) and whenever I changed a value in a record and clicked into the same column in another row it took over the values from the previous set record.I don't have this effect using ROWID but nevertheless I can try to set the original PK and see how the save process will handle that. Yes, agree, the official PK of the table should be used...

John like many others

And all this because it's not possible to set an own separator for multiple chosen values (Poup LOV, Checkbox) in the DB (colon is used). So I have to do a replace ", " -> ":" on reading and on storing back from ":" to "," (it's any existing table I can't change it's content because there are load processes expecting a comma separator). The mask is VERY simple but now spending hours for such things... Nevertheless I'm happy for your hints, thank you!

John like many others

Switching back to original PK but of course further problems with Apex: They PK (2 columns) are enterable attributes and Apex has difficulties when set/overwritten by user and PK is visible as such. No more words for that...

John like many others
Answer

Found it...

I had to read the ROWID with an alias like PK_ROWID and use this a identifier inside APEX, then it works!

Maybe this problem won't occur if the source is a table/view. In my case it's an SQL statement.So instead of:
SELECT ROWID, <any other columns>...

I did:

SELECT ROWID AS PK_ROWID, <any other columns>...

Not sure it this is a bug APEX wise but this is a working solution (works also with update and delete).

Marked as Answer by John like many others · Sep 27 2020
1 - 8

Post Details

Added on Aug 10 2020
8 comments
6,974 views