Oracle 插入值 的值来源于 其他表中。 同时需要 把这个值做为条件 判断。
insert into FBI_RETRIEVAL_CONF
select FBI_RETRIEVAL_CONF_SEQ.nextval ,
t1.finance_channel,
t2.finance_channel,
'1',
'5',
'1',
'1',
'SYSTEM',
sysdate,
sysdate
from FBI_FINANCE_CHANNEL t1
left join FBI_FINANCE_CHANNEL t2
on t1.inst_id = t2.inst_id
where t1.transaction_type = '01'
and t1.FINANCE_SYSTEM_ID = 'UPOP'
and t2.transaction_type = '07' and substr( t1.finance_channel , 0 , length( t1.finance_channel ) -2 )
= substr( t2.finance_channel , 0 , length( t2.finance_channel ) -2 )
修改某一个表的时间
update ucf_auth_withdraw_order set gmt_expire=to_date(to_char(sysdate-25/24,'yyyy-mm-dd HH24:MI:SS'),'yyyy-mm-dd HH24:MI:SS')
where id='201410171452211011810000000114';
select sysdate,to_char(sysdate-1/24,'yyyy-mm-dd HH24:MI:SS'),to_date(to_char(sysdate-1/24,'yyyy-mm-dd HH24:MI:SS'),'yyyy-mm-dd HH24:MI:SS') from dual; --减1小时
oracle 添加一列,同时添加备注信息
alter table ucf_recharge_trade_suborder add (EXCEPTION_CODE varchar2(32));
COMMENT ON COLUMN ucf_recharge_trade_suborder.EXCEPTION_CODE IS '异常编码';
PL/SQL 解决中文乱码
PLSQL中汉字显示乱码,并且SQL语句中如果有汉字,则执行时报错。其实并不是SQL语句写的有问题,而是系统不能识别汉字。
解决方法。
首先执行语句 select * from V$NLS_PARAMETERS 查看第一行中PARAMETER项中为NLS_LANGUAGE 对应的VALUE项中是否为SIMPLIFIED CHINESE。如果不是,需要设置环境变量。
双击我的电脑,在空白处右键,属性,“高级”选项卡,点击环境变量,在系统变量处点击“新建”,设置变量名:NLS_LANG , 变量值:SIMPLIFIED CHINESE_CHINA.ZHS16GBK 。