oracle 添加 删除列 修改表名字 ;加注释 异常解释
2011-05-12 22:05
302 查看
desc xujin; alter table xujin add 字段名 字段类型; alter table xujin modify cloumn 列名字 列类型;修改列名 ,列类型 alter table xujin drop cloumn 列名字 删除; rename oldtablename to newtablename; comment on column xujin.name is 'name 的描述性语言'; sql隐式游标 %found %notfound %isopen %rowcount sql%found insert update delte select into 有影响的记录 那么sql%founnd 则为ture; sql%notfound insert update delete select into 没有有影响的记录 那么sql%founnd 则为ture; %rowcount insert update (select into 没有返回行是0) delete 所影响的记录 oracle 异常处理 begin exception when others then when no_data_found then when to_many_rows_then end; oracle 自定义异常 declare exception_name exception; begin statmens; raise exception_name ; exception when exception_name then end; ----无聊写一些小例子 也巩固下自己知识点 ----------------异常 自己定义的一场小例子 /*declare exception_name exception; begin raise exception_name; exception when exception_name then dbms_output.put_line('aaaaaaaaa'); end;*/ -- 输出多行 /**declare v_name varchar2(200); begin select name into v_name from xujin ; exception when too_many_rows then dbms_output.put_line('aaaaaaaaaaaaaa'); end;*/ --没有数据输出 /** declare v_name varchar2(200); begin select name into v_name from xujin where name='xujin'; exception when no_data_found then dbms_output.put_line('aaaaaaaaaaaaaa'); end;**/ ---利用异常 输出 declare v_name varchar2(200); begin update xujin set name='a' where rownum=1; if sql%rowcount>=1 then dbms_output.put_line('bbbbbbbb'); goto log; end if; if sql%notfound then dbms_output.put_line('cccccccc'); end if; dbms_output.put_line('cccccccc'); <<log>> dbms_output.put_line('eeeeeeeeeeeeeee'); if sql%found then dbms_output.put_line('ddddddddddddd'); end if; exception when no_data_found then dbms_output.put_line('aaaaaaaaaaaaaa'); dbms_output.put_line(sqlcode+sqlerrm);--oralce 存储过程异常代码 commit; end;
相关文章推荐
- oracle 添加、删除列、修改表名字
- Oracle 增加修改删除字段与添加注释
- ORACLE 删除,更新,添加注释
- Oracle 增加、修改、删除字段与添加注释
- oracle 添加删除 某个字段,并添加注释
- oracle删除分区和添加分区
- Oracle中创建表,创建序列,创建自增字段,添加注释, 添加记录,添加触发器,提交
- Oracle Data Guard_ 主库添加或删除在线重做日志文件
- Oracle 删除用户时出现异常ora-01922: CASCADE must bu specified to drop 用户名
- 为SQL Server表中的列添加/修改/删除注释属性(sp_addextendedproperty、sp_updateextendedproperty、sp_dropextendedproperty)
- oracle添加删除重做日志成员
- Unity NGUI中动态添加和删除sprite(附上转载者注释)
- Vim 添加删除多行注释
- oracle添加删除多列
- Mysql、SqlServer和Oracle 添加、修改、删除 字段总结
- oracle怎样修改表名、列名、字段类型、添加表列、删除表列
- vim 多行添加注释,删除注释
- Oracle主键外键 约束的 创建,添加和删除
- Oracle约束的添加和删除
- phpmyadmin4.5.0.2 表结构页名字栏添加注释