Insert into an existing table that has an existing sequence
545199Apr 20 2007 — edited Apr 23 2007Hi. I am a relative newb to SQL scripting so this is probably going to be easy.
Scenario:
Table: wc_routing
Columns: WC_ROUTING_SID
SEQ_NO
DESCRIPTION
MECH_SIGNOFF
INSP_SIGNOFF
RII_SIGNOFF
ARCHIVE
WORK_CARD_MASTER_SID
CREATED_BY
CREATION_DATE
MODIFIED_BY
MODIFICATION_DATE
The wc_routing table already has 2450 rows of data in it. I am going to append approximately 2000 more rows to this table.
The column WC_ROUTING_SID is the sequence number. This is confusing I know because there is a column called SEQ_NO but that means something else and is always '5'.
The final value for WC_ROUTING_SID is: 3544
See this just gets more confusing so I will try and explain it a bit better:
There are going to be 2 tables used to create this insert:
WC_ROUTING wr
WORK_CARD_MASTER wcm
WC_ROUTING is missing WORK_CARD_MASTER_SID information that pertains to CRJ-200's
So if I select * from WORK_CARD_MASTER where MODEL_NO = 'CRJ-200' I get back 2622 rows of data.
All of those WORK_CARD_MASTER_SID's need to be inserted into the WC_ROUTING table.
WC_ROUTING is using a SEQUENCE on the WC_ROUTING_SID column and the final value for that column is: 3544
So when I write my insert statement how do I encorporate starting the first inserted row at 3545 and incrementing it by 1 for each subsequent insert?
Thanks in advance!
Cheers,
Travis