在Oracle数据库sqlplus命令行执行sql语句时,语句有中文报错解决
-- 建表语句 create table T_ADEV_SCLG_YXDXMB ( obj_id VARCHAR2(42) not null, xmmc VARCHAR2(400), xmbh VARCHAR2(100), jhnd INTEGER, gsmc VARCHAR2(50), xmssdwmc VARCHAR2(50), xmlx VARCHAR2(4), zcgs VARCHAR2(50), gdzcfl VARCHAR2(50), ejfl VARCHAR2(50), sjfl VARCHAR2(50), zgshzy VARCHAR2(40), xmgllx VARCHAR2(42), sbmc VARCHAR2(200), xmnr VARCHAR2(3020), tzgm VARCHAR2(20), sl INTEGER, jldw VARCHAR2(8), kypfwh VARCHAR2(42), zxxdzt VARCHAR2(40), ztz NUMBER(10,2), tzjh VARCHAR2(2000), sfdbxm VARCHAR2(20), bz VARCHAR2(2000), xmsssdw VARCHAR2(42), xmsssdwmc VARCHAR2(50), xmssxdw VARCHAR2(42), xmssxdwmc VARCHAR2(50), bzr VARCHAR2(42), bzrmc VARCHAR2(200), bzrq DATE ); -- Add comments to the table comment on table T_ADEV_SCLG_YXDXMB is '项目表'; -- Add comments to the columns comment on column T_ADEV_SCLG_YXDXMB.obj_id is '主键'; comment on column T_ADEV_SCLG_YXDXMB.xmmc is '项目名称'; comment on column T_ADEV_SCLG_YXDXMB.xmbh is '项目编号'; comment on column T_ADEV_SCLG_YXDXMB.jhnd is '计划年度'; ... ... comment on column T_ADEV_SCLG_YXDXMB.bzr is '编制人'; comment on column T_ADEV_SCLG_YXDXMB.bzrmc is '编制人名称'; comment on column T_ADEV_SCLG_YXDXMB.bzrq is '编制日期'; -- Create/Recreate indexes create index IDX_T_ADEV_SCLG_YXDXMB_XMBH on T_ADEV_SCLG_YXDXMB (XMBH); -- Create/Recreate primary, unique and foreign key constraints alter table T_ADEV_SCLG_YXDXMB add constraint PK_T_ADEV_SCLG_YXDXMB primary key (OBJ_ID);
1.切换至oracle用户
2.使用sqlplus命令登录数据库
sqlplus 用户名@'数据库IP:端口/实例名
3.输入数据库用户、密码
4.查看当前数据库字符集
修改字符集:
1.直接修改服务器的字符集为AL32UTF8
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
2.重新连接数据库
sqlplus 用户名@'数据库IP:端口/实例名'
3.重新复制要执行的sql语句执行
4.查询数据库表创建情况及表结构
select * from T_ADEV_SCLG_YXDXMB;desc T_ADEV_SCLG_YXDXMB;
select * from user_tab_cols where table_name = 'T_ADEV_SCLG_YXDXMB'; #查询名为 'T_ADEV_SCLG_YXDXMB' 的表的列信息,包括列名、数据类型、约束等。 select * from user_col_comments where table_name = 'T_ADEV_SCLG_YXDXMB'; #查询名为 'T_ADEV_SCLG_YXDXMB' 的表的列注释信息。