<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    kxbin
    成功留給有準備的人
    posts - 10,  comments - 35,  trackbacks - 0
    1、更新oralce數據庫的密碼sql, alter use scott identified by scott1;其中scott為用戶名,scott1為密碼

    一、重復操作查詢

    --where條件得distinct systemdicid作為唯一標識

    select *

     from dmis_zd_systemdic t

     WHERE typeid = '06012'

       and t.systemdicid in (select min(systemdicid)

                               from dmis_zd_systemdic

                              where typeid = '06012'

                              group by name)

     order by orderno;

    二、檢查表是否存在

    select count(tname) from tab where tname = upper('表名');

    三、日期函數

    --返回當前日期年度的第一天

    select trunc(sysdate,'year') from dual;

    --返回當前日期月份的第一天

    select trunc(sysdate,'month') from dual;

    --上月最后一天

    select last_day(add_months(sysdate, -1)) from dual;

    --給定日期后最近星期幾得日期

    select next_day(to_date('2009-12-01', 'yyyy-mm-dd'), '星期一') next_day

    from dual;

    四、同一張表中,根據一個字段更新另一個字段

    update (select t.fgenerationtime as ftime, t.fgeneratedateall as str

              from dmis_fs_approvebook t

             where t.fgenerationtime is not null)

       set str = TO_CHAR(ftime, 'yyyy-mm-dd')

     where str is null;

    五、重復數據查詢

    select * FROM EMP E

    WHERE E.ROWID > (SELECT MIN(X.ROWID)

    FROM EMP X

    WHERE X.EMP_NO = E.EMP_NO);

    六、合并不同表的數據(merge  into

    merge into student s

    using (select id, name, tel from test001) x

    on (s.s_id = x.id)

    when matched then

     update set s_name = x.name

    when not matched then

     insert (s_id, s_name, s_age) values (x.id, x.name, x.tel);

    commit;

    七、查詢執行sqlv$sql

    select t.module, t.first_load_time, t.sql_text

     from v$sql t

     order by first_load_time desc;

    2、數據庫精度修改處理

    -- Create table

    /*drop table temp_data;*/

    create table temp_data

    (

     FID      VARCHAR2(40) not null,

     USEHOURS NUMBER(10) default 0,

     FVOLTAGE NUMBER(10) default 0,

     INVOLTAGE NUMBER(10) default 0

    )

    ;

    alter table TEMP_DATA

     add constraint tempfid primary key (FID);

     

    insert into temp_data

     select a.fid, a.usehours, a.fvoltage, a.involtage

        from dmis_fs_factorymonthdetail a;

     

    update dmis_fs_factorymonthdetail t

       set t.usehours = '', t.fvoltage = '', t.involtage = '';

     

    alter table DMIS_FS_FACTORYMONTHDETAIL modify USEHOURS NUMBER(10,1);

    alter table DMIS_FS_FACTORYMONTHDETAIL modify FVOLTAGE NUMBER(10,1);

    alter table DMIS_FS_FACTORYMONTHDETAIL modify INVOLTAGE NUMBER(10,1);

     

    update (select a.usehours as tusehours,

                   b.usehours as fusehours,

                   a.fvoltage as tfvoltage,

                   b.fvoltage as ffvoltage,

                   a.involtage as tinvoltage,

                   b.involtage as finvoltage,

                   a.fid       as ffid,

                   b.fid       as tfid

              from dmis_fs_factorymonthdetail a, temp_data b

             where a.fid = b.fid) tt

       set tt.tusehours = tt.fusehours,

           tt.tfvoltage = tt.ffvoltage,

           tt.tinvoltage = tt.finvoltage

     where ffid = tfid;

      

    drop table temp_data;

    commit;

     

    3、恢復drop掉的存儲過程

    用sys用戶登陸,執行如下的查詢:

    SQL> select text from dba_source as of timestamp to_timestamp('2009-03-06 09:45:00', 'YYYY-MM-DD HH24:MI:SS') where owner='IPRA' and name= 'P_IPACCHECK_NC' order by line;

    4、刪除某個用戶下的對象

    --刪除某個用戶下的對象  

    set heading off;  

    set feedback off;  

    spool c:\dropobj.sql;  

     prompt --Drop constraint  

     select 'alter table '||table_name||' drop constraint '||constraint_name||' ;' from user_constraints where constraint_type='R';  

     prompt --Drop tables  

     select 'drop table '||table_name ||';' from user_tables;   

       

     prompt --Drop view  

     select 'drop view ' ||view_name||';' from user_views;  

       

     prompt --Drop sequence  

     select



      
    posted on 2011-10-05 17:34 kxbin 閱讀(248) 評論(0)  編輯  收藏 所屬分類: ORACLE
    你恨一個人是因為你愛他;你喜歡一個人,是因為他身上有你沒有的;你討厭一個人是因為他身上有你有的東西;你經常在別人面前批評某人,其實潛意識中是想接近他。

    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    常用鏈接

    留言簿(5)

    隨筆檔案

    文章分類

    文章檔案

    相冊

    收藏夾

    J2EE

    java技術網站

    Linux

    平時常去的網站

    數據庫

    電影網站

    網站設計

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 久久久无码精品亚洲日韩蜜桃 | 夫妻免费无码V看片| 亚洲av无码一区二区三区网站| 精品久久免费视频| 中中文字幕亚洲无线码| 无码区日韩特区永久免费系列| 老司机亚洲精品影院| 久久99热精品免费观看牛牛| 久久精品国产69国产精品亚洲| 三级网站在线免费观看| 亚洲av综合色区| 亚洲精品视频在线观看免费| 亚洲国产品综合人成综合网站| 中文字幕无码不卡免费视频| 亚洲乱码在线观看| 国产精品公开免费视频| 三级片免费观看久久| 亚洲人成色7777在线观看| 日韩电影免费观看| 亚洲性69影院在线观看| 午夜视频免费成人| 无码 免费 国产在线观看91| 亚洲精品tv久久久久久久久 | 亚洲av日韩综合一区在线观看| 无码AV片在线观看免费| 亚洲伦理中文字幕| 伊人久久亚洲综合影院| 两个人看的www免费视频中文| 久久亚洲国产成人精品性色| 毛片免费观看视频| 人禽伦免费交视频播放| 无码专区—VA亚洲V天堂| 69成人免费视频| 午夜在线免费视频| 久久亚洲精品成人无码网站| 免费黄网在线观看| CAOPORN国产精品免费视频| 亚洲狠狠狠一区二区三区| 日本最新免费不卡二区在线| 91国内免费在线视频| 亚洲乱码无限2021芒果|