Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Inserting Multiple Rows repeats the ID

Inserting Multiple Rows repeats the ID

From: <juneauej_at_gmail.com>
Date: Thu, 14 Jun 2007 07:01:39 -0700
Message-ID: <1181829699.615002.92360@n15g2000prd.googlegroups.com>


Hi, in the statement below I am trying to insert multiple rows into the HAND table. CARDID is the primary key of HAND

INSERT INTO HAND

	(CARDID,
	SUITID,
	RANKID)
SELECT (SELECT MAX(H.CARDID) FROM HAND H) + 1,
	DECK.SUITID,
	DECK.CARDID,

FROM DECK
WHERE ....; The problem is when I run this statement, it repeats the CARDID. It never increments. For example if the max CARDID in HAND was 217. It will insert 10 rows (or however many the WHERE statement allows) all with the CARDID 218. I don't have any nextval, max_sequence_num, or IDENTITY columns in this table. Is there a way to increase the CARDID with each entry that is added in and keep it simple? If there is no solution, would there be a way if I created a temporary table?
This is on Oracle 9i. Received on Thu Jun 14 2007 - 09:01:39 CDT

Original text of this message

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