Take a row in a table and move it to another table - Need help [message #2327] |
Sat, 06 July 2002 20:33 |
karen
Messages: 19 Registered: January 2002
|
Junior Member |
|
|
Please help. Please give suggestions on how to fix this script. Thanks.
PROMPT This report will prompt for a contact ID.
PROMPT Then it will insert the contact information
PROMPT available into the appropriate fields of
PROMPT the volunteer table.
PROMPT It will take a row in the contact
PROMPT table and move it to the volunteer table.
ACCEPT contact_id PROMPT 'Enter the Contact ID:';
insert into volunteer
(vol_id, first, mi, last)
select vol_id_seq.NEXTVAL, first, mi, last
from contact where contact_id = &contact_id;
update volunteer
set vol_id = vol_id_seq.CURRVAL
where contact_id = &contact_id;
delete from contact
where contact_id = 1;
I get this when I run the SQL*Plus script.
SQL> @c:temp2finally.sql
This report will prompt for a contact ID.
Then it will insert the contact information
available into the appropriate fields of
the volunteer table.
It will take a row in the contact
table and move it to the volunteer table.
Enter the Contact ID:1
old 4: from contact where contact_id = &contact_id
new 4: from contact where contact_id = 1
0 rows created.
old 3: where contact_id = &contact_id
new 3: where contact_id = 1
where contact_id = 1
*
ERROR at line 3:
ORA-00904: invalid column name
0 rows deleted.
|
|
|
Re: Take a row in a table and move it to another table - Need help [message #2338 is a reply to message #2327] |
Mon, 08 July 2002 07:40 |
K.SREENIVASAN
Messages: 110 Registered: January 2001 Location: banglore
|
Senior Member |
|
|
PLEASE GIVE THE ( )IN THE INSERT COMMAND.
Insert into volunteer
(vol_id, first, mi, last)
(select vol_id_seq.NEXTVAL, first, mi, last
from contact where contact_id = &contact_id);
update volunteer
set vol_id = vol_id_seq.CURRVAL
where contact_id = &contact_id;
delete from contact
where contact_id = 1;
K.SREENIVASAN
|
|
|