简体   繁体   English

Oracle OCI触发器创建

[英]Oracle OCI trigger creation

Is there any way to create trigger using OCI API? 有什么方法可以使用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;
/

I'm confused as to the nature of this question. 我对这个问题的性质感到困惑。

If you're asking "Can this be done?", then yes, using OCIStmtPrepare() and OCIStmtExecute() . 如果您问“这可以做吗?”,那么可以使用OCIStmtPrepare()OCIStmtExecute()

If you have code that attempts to do this and fails, please provide a more specific question. 如果您有尝试执行此操作的代码但失败了,请提供一个更具体的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM