Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> How do I create a composite sequential child id based upon the parent id?
I want to make detail table line items so they have a composite key
based upon the parentid and the next childid for that parentid.
SQL> describe parent
Name Null? Type ------------------------------- -------- ---- PARENTID NUMBER FIRST VARCHAR2(8) LAST VARCHAR2(8) SEX VARCHAR2(1) SQL> describe children Name Null? Type ------------------------------- -------- ---- CHILDID NUMBER PARENTID NUMBER FIRST VARCHAR2(8) LAST VARCHAR2(8) SEX VARCHAR2(1)
Say I have PARENTID 432 and I have childid 1 and childid 2. How do I create a trigger so when a child is inserted with the parentid it automaitcally inserts the next childid?
Here is the sample data
parent
children
brian
--
Brian E. Lavender
US Army Corps of Engineers -- Programmer / Systems Analyst
Sacramento, CA (916) 557-6623
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
Received on Wed Jun 30 1999 - 18:51:28 CDT