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

Home -> Community -> Usenet -> c.d.o.server -> Interactive script using sequence to insert values

Interactive script using sequence to insert values

From: <lazyboy_2k_at_yahoo.com>
Date: 10 May 2007 16:24:45 -0700
Message-ID: <1178839485.447485.179080@l77g2000hsb.googlegroups.com>


Hi,

I'm a newbie in Oracle & want to write a interactive script using a sequence to insert values into a table. In other words, here is what I'm trying to accomplish:

  1. Enter a range of how many inserts will be (i.e., let's says 5 inserts)
  2. Use sequence to insert values. Assuming that a sequence already exists.
  3. This will be an interactive script.

Here is my script but so far the syntax doesn't seem to be correct. Any helps/suggestions are appreciated.

DECLARE
   count NUMBER := 1;
   end_count NUMBER := '&end';

BEGIN
   LOOP

       ACCEPT c_lname -
       PROMPT 'Enter customer ''s last name: '
       ACCEPT c_fname -
       PROMPT 'Enter customer ''s first name: '
       ACCEPT address -
       PROMPT 'Address: '
       ACCEPT city -
       PROMPT 'City: '
       ACCEPT state -
       PROMPT 'State: '
       ACCEPT zipcode -
       PROMPT 'Zip Code: '
       ACCEPT phone -
       PROMPT 'Phone number: '
       INSERT INTO customer VALUES (customer_c_id_seq.NEXTVAL,

'&c_lname', '&c_fname','&address', '&city', '&state', '&zipcode',
'&phone');

       count := count + 1;
  EXIT WHEN count > end_count;

END;
/

TIA,
-Chris Received on Thu May 10 2007 - 18:24:45 CDT

Original text of this message

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