oracle 扩展字段脚本,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 应用 确定

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值