Oracle 游标 以及CLOB的简单操作

Sample:

 

declare
  cursor Mycursor is  select * from auto_event where event_id between 54652 and 54681;
 
  begin
    For  MyOncursor in Mycursor
        Loop     
          if MyOncursor.status=2  then       
            update cm_auto_event set status=11 where event_id =MyOncursor.event_id;
          end if;
        end loop;
  end;

 

其中 注意if 语句的写法

当让游标的遍历还有 好几种方法:不知道行不行得通

declare
  cursor Mycursor is  select event_id,status from cm_auto_event where event_id between 54652 and 54681;
  eventid number;
  status number;
 
  begin
  open Mycursor;
  fetch Mycursor into eventid,status;
    while Mycursor%found 
      Loop
   
        if status=2
          then       
          update cm_auto_event set status=11 where event_id =eventid;
        end if;
      end loop;
    close Mycursor;
    end;

 

**************华丽的分割线*********************************************

 

下面是关于 CLOB的操作:

Declare
content varchar2(20000) := '字符型打字段最大的容量好像为4G';
Begin
          insert into table_name values (265,'RBC Dexia merge',content,2,user,sysdate) ;
End;

你可能感兴趣的:(oracle,user,table,insert,merge)