Home > Database > Mysql Tutorial > body text

Oracle中使用批处理文件批量建表

WBOY
Release: 2016-06-07 15:37:05
Original
1447 people have browsed it

Oracle 中使用批处理文件批量建表 假设需要建立很多表,其中一个表的建表语句保存在名为 create_table1.sql 的文件中,内容如下: drop table table1; create table table1 ( NAME VARCHAR2(100) NOT NULL, ID NUMBER(6) ) tablespace TS_DATA1; 然后你只需

Oracle中使用批处理文件批量建表

 

假设需要建立很多表,其中一个表的建表语句保存在名为“create_table1.sql”的文件中,内容如下:

drop table table1;

create table table1 (

    NAME                     VARCHAR2(100) NOT NULL,

ID                      NUMBER(6)

)

tablespace TS_DATA1;

 

然后你只需在建立两个文件:run.sqlrun.bat。

 

run.sql内容如下(包含需建立的所有表的sql文件名)

@create_table1.sql

@create_table2.sql;

@create_index1.sql;

…………

run.bat内容如下:

sqlplus username/password@dbname sqlplus.log

 

注意,将“username/password@dbname”中的各项改为自己数据库的相关登录信息即可。

双击bat文件,即可执行所有的建表文件。

PS:事先应添加环境变量:%oracle_home%%oracle_home%/bin

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!