易截截图软件、单文件、免安装、纯绿色、仅160KB

oracle sql自动递增

一、删除列
ALTER TABLE AA DROP COLUMN  DEP;
适用于小表-----数据量小的时候;
2、ALTER TABLE AA SET UNUSED("DEP") CASCADE CONSTRAINTS;
然后在负载小的时候,删除
ALTER TABLE AA DROP UNUSED COLUMNS;
二、添加列
先加一新字段再赋值:
alter table table_name add mmm  varchar2(10);
update table_name set mmm=** ;
三、设置字段值自动增加
insert into t_address (addressname) (select vcname from busstop)
create sequence seq_id_test_increment    --序列
increment by 1 start with 1 maxvalue 9999999;   
  
create or replace trigger insert_test_increment    --触发器
before insert on t_address    --t_address    表
referencing   
new as new   
old as old   
for each row   
begin  
    select seq_id_test_increment.nextval into :new.addressid from dual;    --addressid字段
end;


相关文档:

oracle与sqlserver执行count(*)返回的结果兼容

由于以前都是在sqlserver 2005处理,现在客户要求oracle数据库服务器,
最初的代码为:
allRecordSize = (Integer) rs1.getObject(1);    //Integer allRecordSize=0;
当执行的时候报:BigDecimal无法转化为Integer类型
为了兼容两者修改后的代码为:
  Object o = rs1.getObject(1);
 &nbs ......

连接oracle,sqlserver中数据库的示例代码

一 在Oracle中连接数据库
public class Test1 {
 public static void main(String[] args) {
  try {
   Class.forName("oracle.jdbc.driver.OracleDriver");
   Connection conn = DriverManager.getConnection(
       &nbs ......

Oracle 限制索引


 
 
限制索引是一些没有经验的开发人员经常犯的错误之一。在SQL中有很多陷阱会使一些索引无法使用。下面讨论一些常见的问题: 
 
 
1 使用不等于操作符(<>、!=)
 
 下面的查询即使在cust_rating列有一个索引,查询语句仍然执行一次全表扫描。
 
   ......

ORACLE中给表、列增加注释以及读取注释

在ORACLE中给表、列增加注释以及读取注释
1、给表填加注释:SQL>comment on table 表名 is '表注释";
2、给列加注释:SQL>comment on column 表.列 is '列注释';
3、读取表注释:SQL>select * from user_tab_comments where comments is not null;
4、读取列注释:SQL>select * from user_col_commnents wh ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号