为什么这个存储过程不起作用?

时间:2013-08-19 20:34:50

标签: sql stored-procedures plsql sql-update inner-join

我不太清楚为什么这个存储不起作用。我收到一条消息“pl / sql语句未正确结束”。

CREATE OR REPLACE PROCEDURE APPROVEUSER (
    seuser IN USERS_STOCK_EXCHANGES.USERNAME%TYPE,
    semanager in STOCK_EXCHANGES.STOCK_EXCHANGE_MANAGER%TYPE )
    AS 
    BEGIN
      UPDATE USERS_STOCK_EXCHANGES SET VERIFY_STATUS=1
      FROM USERS_STOCK_EXCHANGES use
        INNER JOIN
           STOCK_EXCHANGES se
        ON 
          use.STOCK_EXCHANGE_ID = se.STOCK_EXCHANGE_ID
      WHERE use.USERNAME = seuser
      AND  se.STOCK_EXCHANGE_MANAGER = semanager;

    END APPROVEUSER;

1 个答案:

答案 0 :(得分:3)

UPDATE语句中没有联接,请参阅this questionOracle SQL documentation

在你的情况下,我会写这样的东西

UPDATE users_stock_exchanges use 
SET    verify_status = 1 
WHERE  EXISTS (SELECT 1 
               FROM   stock_exchanges se 
               WHERE  use.stock_exchange_id = se.stock_exchange_id 
                      AND use.username = seuser
                      AND se.stock_exchange_manager = semanager);