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 -> sql script to insert data from a file

sql script to insert data from a file

From: LHradowy <laura.hradowy_at_NOSPAM.mts.caaaaa>
Date: Mon, 12 Jan 2004 14:32:53 -0600
Message-ID: <VvDMb.11293$No4.27164@news1.mts.net>


Heres my scenerio,

This is the select statement to show all the table...

select *

from CODE_LOGIN

order by CODE;

CODE TYPE LOGIN_ID PASSWORD ENABLED ASHRM, SWITCH, log, 5555, 1

BCHTM, SWITCH, log, 5555, 1

BDVNM, SWITCH, log, 5555, 1

BNRVM, SWITCH, log, 5555, 1

BRNDM, SWITCH, dev, april, 1

DAPHM, SWITCH, dev, april, 1

FSBRM, SWITCH, log, 5555, 1

GDRPM, SWITCH, log, 5555, 1

GDRVM, SWITCH, log, 5555, 1

(there is alot more, 70)

I then made a script and that would only show the CODE if it matches 'dev'

select CODE

from CODE_LOGIN

where LOGIN_ID = 'DEV'

order by CODE;

BRNDM DAPHM ...

(about 50 entries)

I have this saved to a file. All the CODES that have a login_id of 'dev'

Now the big part...

How do I insert a new record, basically I am adding another login_id to the CODE. But, only if the CODE had the dev login id.

Can I do a for loop to look at the file that I saved, and insert values into table.

SQL> insert into CODE_LOGIN (CODE, TYPE, LOGIN_ID, PASSWORD, ENABLED)

2 values (CODE(??),'SWITCH', 'DEV', 'APRIL', 1);

The ? is where the problem is... How do I get the CODE? There are about 50 entries, but they will have the same user_id and passwd inserted in all 50.

Any help would be appreciated. Received on Mon Jan 12 2004 - 14:32:53 CST

Original text of this message

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