在oracle中填充数据库(sqlplus)

发布于 2025-01-03 01:39:39 字数 671 浏览 3 评论 0原文

我有一个包含一堆表的数据库,我想使用 SQL 插入命令填充数据库。现在我对此很陌生,所以请放宽我的要求。现在这是一个例子:

我有一个像这样的表

 TECH PERSONNEL (pplSoft, fname, lname, pittID, expertise, office phone)

,其中 fname 是名字,lname 是姓氏。我想放入

table TECH_PERSONNEL 

pplSoft  fname     lname    pittID  expertise        office_phone  expYears  supervisor


1110001  Bob       Hoffman  bh1     Unix systems     412-624-8404  15        1110001

1110002  Terry     Wood     tw1     Hardware         412-624-8831  14        1110001

但是该表有很多行数据,我是否必须在

 INSERT INTO TECH_PERSONNEL pplSOFT ('1110001', '1110002'); 

表声明之后添加代码?我只是很困惑。

I have a database with a bunch of tables and I want to populate the database using the SQL insert command. Now I am new to this so cut me some slack. Now here is an example:

I have a table like this

 TECH PERSONNEL (pplSoft, fname, lname, pittID, expertise, office phone)

Where fname is first name, and lname is last name. And I want to put in

table TECH_PERSONNEL 

pplSoft  fname     lname    pittID  expertise        office_phone  expYears  supervisor


1110001  Bob       Hoffman  bh1     Unix systems     412-624-8404  15        1110001

1110002  Terry     Wood     tw1     Hardware         412-624-8831  14        1110001

However there is many lines of data for that table would I have to put code such as

 INSERT INTO TECH_PERSONNEL pplSOFT ('1110001', '1110002'); 

after the declaration of my table? I'm just confused.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

独行侠 2025-01-10 01:39:39

基本的 INSERT 语句是:

INSERT INTO tableName (list of fields) VALUES (list of values);

鉴于您的示例 & 如果您不知道您的字段是如何定义的,则可以这样输入一行:

INSERT INTO TECH_PERSONNEL 
(pplSoft, fname, lname, pittID, expertise, office phone, expYears, supervisor) 
VALUES
('1110001', 'Bob', 'Hoffman', 'bh1', 'Unix systems', '412-624-8404', '15', '1110001');

然后是下一行,等等。如果您希望将 csv 或其他类型的文件直接导入到 Oracle 中,那就是另一个问题了。我并没有真正理解你的要求,所以这个答案只是基本的“如何使用 INSERT”。

The basic INSERT statement is:

INSERT INTO tableName (list of fields) VALUES (list of values);

Given your example & not knowing how your fields are defined, a row could go in as such:

INSERT INTO TECH_PERSONNEL 
(pplSoft, fname, lname, pittID, expertise, office phone, expYears, supervisor) 
VALUES
('1110001', 'Bob', 'Hoffman', 'bh1', 'Unix systems', '412-624-8404', '15', '1110001');

Then the next row, etc. If you're looking to use import a csv or other type of file directly into Oracle, that's a different question. I'm not really following what you're asking, so this answer is just the basic "how to use INSERT".

微凉 2025-01-10 01:39:39

请原谅我的语言,我正在用手机。

我还想知道如何动态填充表格。在 c/c++ 中随机选择值来随机化表的方式,即

char src[]={'a','b','c'};
char tbl[1024];
    //populate dynamically
for(int i(0);i<sizeof(tbl)/sizeof(char);i++){
 tbl[i]=src[random()%(sizeof(src)/sizeof(char))];
}

如何在 sqlplus 解析的 .sql 脚本中执行此类操作?

Excuse my language, I'm on a cellphone.

I would also like to know how to dynamically populate a table. The way you randomize tables with random selections of values in c/c++, i.e.

char src[]={'a','b','c'};
char tbl[1024];
    //populate dynamically
for(int i(0);i<sizeof(tbl)/sizeof(char);i++){
 tbl[i]=src[random()%(sizeof(src)/sizeof(char))];
}

How to do this type of thing in .sql scripts parsed by sqlplus?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文