My ruby on rails code is generating the following oracle INSERT query: set define off;
INSERT INTO "MEMBER_ROLES" ("CREATED_AT", "ID", "NAME", "ORG_ID", "UPDATED_AT") VALUES (:a1, :a2, :a3, :a4, :a5) [["created_at", Tue, 10 Mar 2015 17:32:27 UTC +00:00], ["id", 6], ["name", "test1"], ["org_id", "2"], ["updated_at", Tue, 10 Mar 2015 17:32:27 UTC +00:00]]
I don't see any error in the console, but when I log into SQL developer I don't see the record being inserted.
Now If i try to manually run the above query in SQL developer i get the following error:
Bind Variable "a1" is NOT DECLARED
0 rows inserted.
This is how the table was created:
CREATE TABLE member_roles
(
id NUMBER primary key,
name VARCHAR2(200) not NULL,
org_id VARCHAR2(200) not NULL,
created_at DATE default sysdate not null,
updated_at DATE default sysdate not null
)
CREATE SEQUENCE MEMBER_ROLES_SEQ;
set define off;
CREATE OR REPLACE TRIGGER member_roles_bir
BEFORE INSERT ON MEMBER_ROLES
FOR EACH ROW
BEGIN
SELECT MEMBER_ROLES_SEQ.NEXTVAL
INTO :new.id
FROM dual;
END;
Has anyone else encountered similar issues?
Aucun commentaire:
Enregistrer un commentaire