views:

62

answers:

1

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
WHEN (new.id IS NULL OR new.id = 0)
BEGIN
SELECT tbl_sq.nextval INTO :new.id FROM dual;
END;
/
+1  A: 

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.

Vadim K.