UPDATE tableA SET col1 = 'a'
WHERE col2 = 'b';IF SQL%NOTFOUND THEM
INSERT INTO tableA(col1,col2)
VALUSE('a','b');
END IF;
大概就是这样的了,你自己试试

解决方案 »

  1.   

    create or replace procedure p_test(ssid in string,starttime in string) as
    begin
    end;这也有错?
      

  2.   

    13  END IF;
     14
     15  commit;
     16  end;
     17  /警告: 创建的过程带有编译错误。SQL> show err
    PROCEDURE P_SINGLE_BET 出现错误:LINE/COL ERROR
    -------- -----------------------------------------------------------------
    13/1     PLS-00103: 出现符号 "END"在需要下列之一时:
             ,;returnreturning
             符号 ";" 被替换为 "END" 后继续。
      

  3.   

    CREATE OR REPLACE PROCEDURE update_insert ( 
    pid in int,pdocid in int,
    pperson in CHAR,pmsg IN CHAR
     ) 
    as 
    begin 
    begin 
    update diekiss set doc_id = pdocid,person=pperson,message=pmsg where id = pid;
    if SQL%NOTFOUND  then 
    insert into diekiss values(pid,pdocid,pperson,pmsg);
    end if;
    commit; 
    end; 
    end update_insert;
      

  4.   

    SQL> desc diekiss;
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     ID                                                 NUMBER(38)
     DOC_ID                                             NUMBER(38)
     PERSON                                             CHAR(8)
     MESSAGE                                            CHAR(16)
      

  5.   

    create procedure test(col1,col2) as 
    begin 
    update table_name set column1=col1,column2=col2;
    if (sql%notfound) then
    inser into table values (col1,col2);
    end if;
    commit;
    end;/
      

  6.   

    create or replace procedure p_single(sid in string,starttime in string,endtime in string,
    user in string,sub in string)  as
    begin
    update single set start_time =starttime ,end_time=endtime where userName=user and  subject=sub;
    IF SQL%NOTFOUND THEN
    INSERT INTO single(id,start_time,end_time,userName,subject)
     VALUES(sid,starttime,endtime,user,sub);END IF;commit;
    end;我先在就是这样啊,主要是update 太费时了,建了索引并没有加快速度,shared_pool_size,shared_pool_reserved_size要设置成多少啊?是不是越大越好?或者还有别的办法修改sql语句能够加快?