随笔分类 - Oracle
摘要:在使用wmsys.wm_concat合并查询结果时,发现中文显示乱码,例如: {TX 此时需要将字段通过to_char转义一下即可。 SELECT t6.username,t6.swjgjc,wmsys.wm_concat(to_char(t6.role_name)) as role_name
阅读全文
摘要:spuuids字段内容为:'08A7A8D9DDF3AB4923428C7883DDBA49,14A44FC2B4EF434C274489FC1DDAA9D9,C055DB766347D6C78854671C7383AC26' SELECT regexp_substr(t.spuuids,'[^,]
阅读全文
摘要:/*第1步:创建ODPS数据表空间 */create tablespace ODPS logging datafile '/home/oracle/tablespace_dir/ODPS.dbf' size 100m autoextend on next 50m maxsize 20480m ext
阅读全文
摘要:1:查出锁定表的信息SELECT s.sid, s.serial#, s.username, s.schemaname, s.osuser, s.process, s.machine,s.terminal, s.logon_time, l.typeFROM v$session s, v$lock l
阅读全文
摘要:1:首先创建存储过程 2:定义任务 JOB 每天凌晨执行一次。 对应脚本
阅读全文
摘要:前提:在法定节日表(t_fdjr )中维护法定节日包括周六周天
阅读全文
摘要:create or replace trigger tri_test before insert on test for each row declare begin if :new.uuid is null then :new.uuid:=sys_guid(); end if; end tri_test;
阅读全文
摘要:>hx_djgrant select on dj_nsrxx to hx_sb;>hx_sbcreate synonym dj_nsrxx for hx_dj.dj_nsrxx;
阅读全文
摘要:例如执行一下语句:insert into NSRXT_SP (SP_ID, SP_TITLE, SP_DESC, SP_URL, SP_TYPE, SP_SUB_TYPE, ADD_TIME, CZRY_DM)values (227, '【提醒】新所得税申报表填写小提示', null, 'http:...
阅读全文
摘要:--加法 select sysdate,add_months(sysdate,12) from dual; --加1年 select sysdate,add_months(sysdate,1) from dual; --加1月 select sysdate,to_...
阅读全文
摘要:符合条件进行更新操作,不符合则进行插入操作.merge into myd_nsrdt nusing (select '9'as mydtmid,'1'as tmtype,'370200123456788'as nsrsbh,'' as nsrmc, 'sn' as region,4 as pf,'...
阅读全文
摘要:--创建事务级别的结果临时表create global temporary table tmp_yshy( c1 varchar2(100), c2 varchar2(100))on commit delete rows;--创建事务级别的存储sql语句的临时表create global tempo...
阅读全文
摘要:SQL> set autotraceUsage: SET AUTOT[RACE] {OFF | ON | TRACE[ONLY]} [EXP[LAIN]] [STAT[ISTICS]]SQL> set autotrace onSP2-0618: Cannot find the Session Ide...
阅读全文
摘要:SQL> conn scott/tigerERROR:ORA-28002: the password will expire within 1 daysConnected.SQL> conn /as sysdbaConnected.SQL> alter user scott identified b...
阅读全文
摘要:-- tanslate(str,from_str,to_str)-- 将str中的from_str替换成to_strselect translate('hello','e','o') tfrom dual;-- instr(str,des_str)-- 可以实现like功能select instr(...
阅读全文
摘要:1:实现indexOf功能,.从第1个字符开始,搜索第1次出现子串的位置select instr('->Oracle instr用法','Oracle instr用法',1,1) as i from dual; select instr('oracle','or') as i from dual...
阅读全文
摘要:select ano,sum(nvl(dmoney,0)) summoneyfrom( select t2.ano,d.dmoney from ( select t1.*,c.cno from( select a.ano,b.bno from t_a a left j...
阅读全文
摘要:1:update 时做检查使用update mw_contract set payTimes=(case when payTimes>0 then payTimes-1else payTimes end)where contractNo='2015001';2:select时使用select cas...
阅读全文
摘要:1:效果如下图所示:表T1:CREATE TABLE T1 ( WEEKWORKID VARCHAR2(20) , DD VARCHAR2(20) ) 表T2CREATE TABLE T2 ( WEEKWORKID VARCHAR2(20) , NR VARCHAR2(20) )SQL语句:...
阅读全文
摘要:y@y:~$ sqlplus Error 46 initializing SQL*PlusHTTP proxy setting has incorrect valueSP2-1502: The HTTP proxy server specified by http_proxy is not acce...
阅读全文