Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
带连接的Oracle SQL触发器_Sql_Oracle_Plsql_Triggers - Fatal编程技术网

带连接的Oracle SQL触发器

带连接的Oracle SQL触发器,sql,oracle,plsql,triggers,Sql,Oracle,Plsql,Triggers,我遗漏了什么?导致错误的不是连接,而是子查询的使用在此上下文中是无效的。首先选择值(如果,则从中选择),以后再使用。大概是这样的: Error(6,93): PLS-00103: Encountered the symbol "JOIN" when expecting one of the following: ) , with group having intersect minus start union where connect The symbol &

我遗漏了什么?

导致错误的不是
连接,而是子查询的使用在此上下文中是无效的。首先选择值(如果
,则从
中选择),以后再使用。大概是这样的:

Error(6,93): PLS-00103: Encountered the symbol "JOIN" when expecting one of the following:     ) , with group having intersect minus start union where    connect The symbol "," was substituted for "JOIN" to continue. 
创建或替换触发器\u名称
插入前
--或者更新-->什么?
关于表名
每行
声明
l_colu_b table_b.colu_b%类型;
开始
如果插入
然后
选择col_b
进入l_Colub
从表a自然联接表b
其中some_col=:new.some_value;
IF:new.colu\u a
此外,请使用表别名。不可能知道哪个列属于哪个表。此外,您的触发器希望在更新
之前触发。。。什么?我把它注释掉了

Error(6,93): PLS-00103: Encountered the symbol "JOIN" when expecting one of the following:     ) , with group having intersect minus start union where    connect The symbol "," was substituted for "JOIN" to continue. 
CREATE OR REPLACE TRIGGER trigger_name
   BEFORE INSERT
   --OR UPDATE of    --> of what?
   ON table_name
   FOR EACH ROW
DECLARE
   l_col_b  table_b.col_b%TYPE;
BEGIN
   IF INSERTING
   THEN
      SELECT col_b
        INTO l_col_b
        FROM table_a NATURAL JOIN table_b
       WHERE some_col = :new.some_value;

      IF :new.col_a < l_col_b
      THEN
         raise_application_error (-20000, 'Raise some error');
      END IF;
   END IF;
END;