备忘:oracle遇到的应用

    技术2022-05-20  43

    (1)得到表中所有的字段

          select   *   from   user_tab_columns   where   table_name='表名'

    (2)复制表

          create table user_temp as select * from user

    (3)关联排序:当一个表的排序字段要自定义排序,而这个自定义的顺序在另一张表时

          select name from t_user order by (select min(order) from order where order.name=name)

    (4)删除dataid重复的数据

          delete table1 where rowid not in (select max(rowid) from  table1 group by (data_id))

    (5)数据恢复

          <a>首先用sys登陆查询  select * from sys.smon_scn_time;       找到 TIME_DP列想恢复的时间 的 SCN_BAS列 【如1705917】      <b>查询表      select * from 表名 AS OF SCN 1705917;      即可查询出这个时间 表的数据情况

    (6)decode的使用

          decode (zt,'0','未审批','已审批')


    最新回复(0)