Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Repetitive insert statements

Repetitive insert statements

From: CH. <chattrin_h_at_hotmail.com>
Date: 18 Nov 2002 18:28:00 -0800
Message-ID: <7242ea7b.0211181828.6332a5b6@posting.google.com>


Hi,

I'm working on a database assignment and ran into a problem. I have a table and I need to insert 50 records into it. Right now I have 50 insert statements that enter all of the data correctly but I just found out that I cannot do it that way. I'm suppose to have just 1 insert command and execute run to enter each value (What a great way to insert data!). Please look below for an example.

create table tb(id char(4), col1 char(5), col char(5));

SQL> insert into tb values (&id, &col1, &col2); Enter value for id: 1234
Enter value for col1: 12345
Enter value for col2: 78905
old 1: insert into tb values (&id, &col1, &col2) new 1: insert into tb values (1234, 12345, 78905) SQL> run
  1* insert into tb values (&id, &col1, &col2) Enter value for id: 2345
Enter value for col1: 13241
Enter value for col2: 43211
old 1: insert into tb values (&id, &col1, &col2) new 1: insert into tb values (2345, 13241, 43211) SQL>
SQL> run
  1* insert into tb values (&id, &col1, &col2) Enter value for id: 7894
Enter value for col1: 74125
Enter value for col2: 96325
old 1: insert into tb values (&id, &col1, &col2) new 1: insert into tb values (7894, 74125, 96325) SQL> Is there a way to put everything into a script? I'd appreciate any hint or pointer or example. Please help.

Thank you
Chatt H. Received on Mon Nov 18 2002 - 20:28:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US