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;
相关文档:
http://www.umgr.com/blog/PostView.aspx?bpId=36294
1. 执行sql语句
int sqlite3_exec(sqlite3*, const char *sql, sqlite3_callbacksql 语法
, void *, char **errmsg );
这就是执行一条 sql 语句的函数。
第1个参数不再说了,是前面open函数得到的指针。说了是关键数据结构。
第2个参数const char ......
如果你经常遇到下面的问题,你就要考虑使用SQL Server的模板来写规范的SQL语句了:
SQL初学者。
经常忘记常用的DML或是DDL SQL 语句。
在多人开发维护的SQL中,每个人都有自己的SQL习惯,没有一套统一的规范。
在SQL Server Management Studio中,已经给大家提供了很多常用的现成SQL规范模板。
SQL Server Management ......
一 在Oracle中连接数据库
public class Test1 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(
&nbs ......
在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 ......
先构造一个表:
create table emp2(
id number(2),
name varchar(10),
currdate date,
action varchar2(1)
)
创建触发器:
create or replace trigger d_i_u_emp2
after insert or update or delete on mysort
begin
if inserting then
insert into emp2 values (12,'dog',sysdate,'i');
elsif deleting then ......