zoukankan      html  css  js  c++  java
  • ORACLE常用修改字段脚本

    describe employees;

    =

    select column_name,data_type,nullable,data_length,data_

    precision,data_scale from user_tab_columns where table_

    name='EMPLOYEES';

     

    create table employees_copy as select * from employees;

     

    select * from emp_dept where rownum < 10;

    create table no_emps as select * from employees where 1=2;

     

    ■Adding columns(增加列):

    alter table emp add (job_id number);

     

    ■ Modifying columns(修改列):

    alter table emp modify (comm number(4,2) default 0.05);

    alter table author add (

      author_last_published date default SYSDATE, 

      author_item_published varchar2(40) 

      default 'Magazine Article' not null

     );

    alter table POOR."SUBADMREQUEST" MODIFY ("ACCORDDISEASEKINDRANGE" VARCHAR2(1000 CHAR) );

     

    ■ Dropping columns(删除列):

    alter table emp drop column comm;

     

    ■ Marking columns as unused(标注列不再使用):

    alter table emp set unused column job_id;

     

    ■ Renaming columns(重命名列):

    alter table emp rename column hiredate to recruited;

     

    ■ Marking the table as read-only(标注表只读):

    alter table emp read only;

     

    --select * from NLS_SESSION_PARAMETERS;

    ALTER SESSION SET NLS_DATE_FORMAT = 'yyyy-mm-dd HH24:mi:ss';

     

    alter system set nls_date_format='yyyy-mm-dd HH24:mi:ss' scope=spfile;

     

    select 'DATABASE', value

    from nls_database_parameters

    where parameter = 'NLS_DATE_FORMAT'

    union

    select 'INSTANCE', value

    from nls_instance_parameters

    where parameter = 'NLS_DATE_FORMAT'

    union

    select 'SESSION', value

    from nls_session_parameters

    where parameter = 'NLS_DATE_FORMAT';

     

    永久设置日期时间格式:In Windows, add NLS_DATE_FORMAT in environment variable:

    我的电脑 属性 高级 环境变量 新建 变量名 NLS_DATE_FORMAT 变量值 YYYY-MM-DD HH24:MI:SS 应用 确定

  • 相关阅读:
    grpc源码分析之域名解析
    使用swig工具为go语言与c++进行交互
    使用VS2015编译grpc_1.3.1
    在linux中编译grpc
    win32网络模型之重叠I/O
    滚动动画animate-scroll扩展
    Android Studio Gradle更新的解决办法
    MUI——页面的创建、显示、关闭
    VS2013中使用QT插件后每次重新编译问题
    Oracle Rman恢复
  • 原文地址:https://www.cnblogs.com/chriskwok/p/9683020.html
Copyright © 2011-2022 走看看