日期:2014-05-16  浏览次数:20732 次

ECAP下db2基本操作

启动db2数据库

su - db2inst1

db2start



下拉框表、授权表、菜单表
select * from t_option where OPTION_SET in ('PJtype','PJstat')

export to t_option.txt.20100906 of del select * from t_option

export to t_authorization.txt.zq_e.20100906 of del select * from t_authorization where TRANSCODE like '%ZQ_E%'

export to t_child_busi_tran.txt.zq_e.20100906 of del select * from t_child_busi_tran where TRAN_CODE like '%ZQ_E%'

export to t_teller_busi.txt.all.20100906 of del select * from t_teller_busi


查询柜员
select * from t_teller where brch_no1 = '06221' and teller_level >10

机构柜员信息查询

select * from t_brhm where branch_no like '141%'

select * from t_teller where brch_no1 = '08593'

export to t_teller.txt.20100901 of del select * from t_teller where brch_no1 = '08593'



批量执行sql
db2 connect to ecap

db2 -tvf test.sql

select * from t_child_busi_tran where TRAN_CODE like 'JM_F12_9140%';

select * from t_child_busi_tran where TRAN_CODE like 'JM_F11_9140%';


基本操作
db2 connect to ecapdb

查看表结构
db2 describe table t_authorization

select * from t_authorization"

Column name                     schema    Data type name      Length     Scale s
------------------------------- --------- ------------------- ---------- ----- -
TRANSCODE                       SYSIBM    VARCHAR                     20     0
SUBTRANSCODE                    SYSIBM    VARCHAR                     20     0
AUTHPOINT                       SYSIBM    INTEGER                      4     0
AUTHGRADE                       SYSIBM    VARCHAR                      8     0
AUTHTYPE                        SYSIBM    VARCHAR                      8     0
PROMPTMSG                       SYSIBM    VARCHAR                    500     0
AUTHDESCRIP                     SYSIBM    VARCHAR                    500     0


select * from t_authorization where TRANSCODE = 'GM_F6_91114200'

select * from t_authorization where TRANSCODE = '_B2_000045'

insert into t_authorization values('GM_F6_91114100','',4,'','302','','')

insert into t_authorization values('GM_F6_91114100','',1,'12','100','','')

delete from t_authorization where TRANSCODE = 'GM_F6_91114100'

db2 commit


db2导表操作

db2 export to t_teller.txt of del select * from t_teller where brch_no1='04446'

EXPORT TO myfile.del OF DEL  MESSAGES msg.out
      SELECT staff.name, staff.dept, org.location
        FROM org, staff
       WHERE org.deptnumb = staff.dept;


db2 import from t_teller.txt of del insert into t_teller


db2导出、导入表数据
db2 "export to t_option.txt of del select * from t_option"

db2 "import from t_option.txt of del insert into t_option"



修改柜员和授权信息
select TELLER_NO,TELLER_LEVEL from T_TELLER where BRCH_NO1 = '20102'

update T_TELLER set TELLER_LEVEL = 7 where TELLER_NO = '0005050'

select TELLER_NO,TELLER_LEVEL from T_TELLER where BRCH_NO1 = '20402' and TELLER_NO = '0005050'


update t_authorization set AUTHTYPE = '301' where TRANSCODE = '_QY_F3_92607100'
update t_authorization set AUTHTYPE = '301' where TRANSCODE = '_QY_F3_92607200'

update t_authorization set AUTHTYPE = '100' where TRANSCODE = '_QY_F3_92607100' and AUTHPOINT = 1
update t_authorization set AUTHTYPE = '100' where TRANSCODE = '_QY_F3_92607200' and AUTHPOINT = 1




修改下拉框信息
//刷新下拉框   
  
http://108.0.108.221:9080/TxRunAction.do?TranName=clearCache 

select * from t_option where OPTION_SET = 'VoucherType10'

select * from t_option where OPTION_SET = 'aprvsign'

delete from t_option

select * from t_option where OPTION_SET = 'TCchaType'

db2 describe table t_opti