sql知识

ORA创建索引

create index IDX_SC_ORDER_STATUS on SC_ORDER_HDR_WEB (ORDER_STATUS) ONLINE;

添加字段

alter table TA_PACKAGE_HDR add VIA_DEPT_NAME VARCHAR(32);NUMBER(1)

alter table TA_PACKAGE_DTL add TRANSPORT_TIME DATE;

alter table BA_PACKAGE add PACKAGE_STATUS NUMBER(1);

alter table TA_PACKAGE_HDR add VIA_DEPT_NAME NUMBER(10,2);

 

 

ALTER TABEL SINGLE_USER_CODE ADD(IS_LOCKED NUMBER(1) DEFAULT ' ')

ALTER TABLE `config_system_param`

ADD COLUMN `param_name` VARCHAR(32) NULL DEFAULT NULL COMMENT '参数名称' ;

alter table test1

add (name varchar2(30) default ‘无名氏’ not null);

数据库死锁

select sess.sid,

    sess.serial#,

    lo.oracle_username,

    lo.os_user_name,

    ao.object_name,

    lo.locked_mode

    from v$locked_object lo,

    dba_objects ao,

    v$session sess

where ao.object_id = lo.object_id and lo.session_id = sess.sid;

 

select * from v$session t1, v$locked_object t2 where t1.sid = t2.SESSION_ID;

 

alter system kill session '951,15515';

查询表的所有列

String selectSql = String.format("select * from %s where 0", TABLE_NAME);
Cursor cursor = database.rawQuery(selectSql, null);
String[] columnNames = cursor.getColumnNames();

你可能感兴趣的:(sql)