Since i don't have any records yet. I got "0 rows created" which the query is structured correctly. Right? Just want to confirm.
NULL and customerfamilyhistory_id_s
Main Topics
Browse All TopicsINSERT INTO CustomerFamilyHistory (customerfamilyhistory_id_
SELECT customerfamilymemberfirstn
customerfamilymemberage, customerfamilymembersiblin
FROM CustomerFamilyMember;
Insert values into the history record from CustomerFamilyMember. However, CustomerFamilyHistory have a primary key customerfamilyhistoryid which uses sequence. Is the above INSERT INTO structured correctly? What about leavingDate, how can i handle the situation of inserting every CustomerFamilyMember column to the right place in History table?
P.S. discard the naming convention...
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Since i don't have any records yet. I got "0 rows created" which the query is structured correctly. Right? Just want to confirm.
NULL and customerfamilyhistory_id_s
Since you accepted the answer, I assume you already aware of the answers for your questions. However, for reference am answering your questions.
Yes, no error means the query is structured correctly! But you need some data to make sure you getting the desired result. Its a simple query and I don't think there will be any issues
There is no restriction on the number of columns being selected from a table. It will not produce any error
"There is no restriction on the number of columns being selected from a table. It will not produce any error"
If Customer table has firstname and lastname columns only and i did
select firstname, lastname, test_column
from Customer;
I would get an error because test_column not part of Customer. Can you please clarify since i see contradictions in here.
When u are writing a select statement, the columns being selected should be present in the table. In addition to that you can select nextval of sequences, call functions, hard-coded value, etc..
Below are some sample scenarios,
select firstname, lastname, 'Hardcoded column'
from Customer;
In above query the text 'Hardcoded column' will appear for each row
select firstname, lastname, function_mergename(firstna
from Customer;
Here function_mergename could be a function which returns the merged value
This is what I meant. Hope this makes sense now!
Business Accounts
Answer for Membership
by: ravindran_eeePosted on 2009-09-17 at 20:52:53ID: 25362846
You need INSERT with SELECT subquery
/sql/inser t/ select_a nd_subquer y.html
eq.nextval , customerfamilymemberfirstn ame, customerfamilymemberlastna me, customerfamilymemberage, NULL, customerfamilymembersiblin g, cusfamilymembcustomerID
http://www.adp-gmbh.ch/ora
You overall query would be like,
INSERT INTO CustomerFamilyHistory (customerfamilyhistoryID, firstname, lastname, age, leavingDate, sibling, customerid)
(SELECT customerfamilyhistory_id_s
FROM CustomerFamilyMember)
You can select the next value in sequence from the select statement. The date field can be left NULL since default is sysdate.
Try this and let me know if there are any issues