Oracle OCI trigger creation
Is there any way to create trigger using OCI API?
I need to perform the following actions programmatically:
CREATE OR REPLACE TRIGGER tbl_trigger BEFORE INSERT ON tbl FOR EACH ROW
WH开发者_Python百科EN (new.id IS NULL OR new.id = 0)
BEGIN
SELECT tbl_sq.nextval INTO :new.id FROM dual;
END;
/
I'm confused as to the nature of this question.
If you're asking "Can this be done?", then yes, using OCIStmtPrepare()
and OCIStmtExecute()
.
If you have code that attempts to do this and fails, please provide a more specific question.
精彩评论