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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Interesting Insert?

Re: Interesting Insert?

From: Paulo Rodrigues <prod16_at_esoterica.pt>
Date: 2000/01/29
Message-ID: <slrn893m38.2nd.prod16@shellcore.esoterica.pt>#1/1

yliu_at_creighton.edu wrote:
>Hi,
>
>I have a SQL command file, in my file, first I create a temp table using
> Create table temp (company_no number(2),
> dept varchar2(4),
> ......)
>then I inserted into this temp table using
> Insert into temp select unique ....
> from my another table,
>then I do reporting based on the temp table.
>While I was watching the command file run, after the insert, it told me
>that 52 rows created. However, when I select count(*) from temp table,
>there are 104 rows in there. I was puzzled, so I tried this three time,
>every time using different selection criteria in my where clause in the
>INSERT statement above, every time the temp table seem to have twice as
>many rows as the rows said being created by the insert statement. And the
>rows in the temp table are dupped up! I was wondering if this ever
>happened to some body else. I could not figure out why it does this. Could
>somebody give me some advice?
>
>Thank you very much for your time.
>
>Yongge
>yliu_at_creighton.edu
>

two things: first, keep "create table" scripts separate from "insert into" scripts; second, if you have "insert into ...;" then a / on the last line, sqlplus will execute the insert twice.
good luck
paulo

-- 
Paulo Rodrigues
OGMA SA
prod16_at_esoterica.pt
Received on Sat Jan 29 2000 - 00:00:00 CST

Original text of this message

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