CREATE PROCEDURE dbo.up_UpdatePublisherName 
(
@pub_id char(4),
@pub_name varchar(40), 
@Original_pub_name varchar(40) 

AS 
if exists(select pub_id 
 from publishers 
where (pub_id = @pub_id) AND (pub_name = @Original_pub_name)) 
Begin
 UPDATE publishers SET pub_name = @pub_name 
 WHERE (pub_id = @pub_id)
End
RETURN  

解决方案 »

  1.   

    --如果用户表中存在Jerry用户名,则选出所有的用户信息.select * from fnd_user a where exists (select * from fnd_user b where b.user_name='Jerry')
      

  2.   

    PLS-00204: 函数或伪列 'EXISTS' 只能在 SQL 语句中使用
      

  3.   

    PLS-00204 function or pseudo-column 'string' may be used inside a SQL statement onlyCause: A pseudocolumn or proscribed function was used in a procedural statement. The SQL pseudocolumns (CURRVAL, LEVEL, NEXTVAL, ROWID, ROWNUM) can be used only in SQL statements. Likewise, certain functions such as DECODE, DUMP, and VSIZE and the SQL group functions (AVG, MIN, MAX, COUNT, SUM, STDDEV, VARIANCE) can be used only in SQL statements.Action: Remove the pseudocolumn reference or function call from the procedural statement. Or, replace the procedural statement with a SELECT INTO statement; for example, replace:bonus := DECODE(rating, 1, 5000, 2, 2500, ...); 
    with the following statement:SELECT DECODE(rating, 1, 5000, 2, 2500, ...) INTO bonus FROM dual; 
      

  4.   

    set serveroutput on size 1000000;
    declare v_RecCount number;
    begin
      select count(*) into v_RecCount from Table where 条件
      if v_RecCount>0 then 
         dbms_output.put_line('ok');
      else
         dbms_output.put_line('not ok');
      end if;
    end;
      

  5.   

    if exists(select * from Table where 条件 )  then
        print '存在'
    else
       print '不存在'
    end if