Error: Primary key element is not available in the data set

Error: Primary key element is not available in the data set

perryjmperryjm Posts: 12Questions: 3Answers: 0

I'm not having great success searching for solutions to this issue. Sorry if this question has already been asked.

I am just trying to run the demo on Oracle 12.2c with Node.js. I suspect I have not created the database table correctly, though I've followed this as closely as I can. I do have some trouble creating the primary key insert trigger, and have to do it through a GUI to get it to run properly. (I think all its missing is referencing old as old new as new in the trigger creation code, though that seems like a ridiculous necessity). so it looks like this

create or replace trigger datatables_demo_on_insert 
before insert on datatables_demo 
referencing old as old new as new 

for each row
begin
SELECT datatables_demo_seq.nextval
        INTO :new.id
        FROM dual;
end;

But other than that, I merely wrap the dates on the insert statements in a to_date() function, and run the SQL exactly as is in the setup guide linked above. But I keep getting this node error when attempting to pull up any of the example pages.

Unhandled promise error:  [object Promise]Error: Primary key element is not available in the data set
stack: Error: Primary key element is not available in the data set
    at Editor.pkeyToValue (C:\Users\Mike\dev\db_editor\node_modules\datatables.net-editor-server\dist\editor.ts:688:11)
    at Editor.<anonymous> (C:\Users\Mike\dev\db_editor\node_modules\datatables.net-editor-server\dist\editor.ts:1072:38)
    at step (C:\Users\Mike\dev\db_editor\node_modules\datatables.net-editor-server\dist\editor.js:42:23)
    at Object.next (C:\Users\Mike\dev\db_editor\node_modules\datatables.net-editor-server\dist\editor.js:23:53)
    at fulfilled (C:\Users\Mike\dev\db_editor\node_modules\datatables.net-editor-server\dist\editor.js:14:58)

Any help would be appreciated!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,468Questions: 1Answers: 10,466 Site admin
    Answer ✓

    Hi,

    Are you using "ID" as the primary key, and have you set that as the (optional) third parameter for the Editor constructor in the Node.JS code? The default is id and that wouldn't match if Oracle is sending back ID.

    Thanks,
    Allan

  • perryjmperryjm Posts: 12Questions: 3Answers: 0

    Thanks Allan!

This discussion has been closed.