[EMAIL PROTECTED] wrote:
> 
> Hi i am trying to insert records into a table by selectiog from table 2, i
> want to insert a sequence,, and the distinct values from table 1 but i get
> an error:
> 
> Query used:
>  INSERT INTO  contacts (cont_id,cont_contact_surname)
> (SELECT  seq_cont.nextval,distinct delegated_person
>  FROM      sierras
>  WHERE delegated_person is not null)
> 
> Error;
> 
> select seq_cont.nextval,distinct delegated_person
>                                *
> ORA-00936: missing expression
> 
> How can i modify the query to obtain the correct results
> 
> cheers all.
> 

INSERT INTO  contacts (cont_id,cont_contact_surname)
SELECT  seq_cont.nextval, a.delegated_person
FROM  (select distinct delegated_person
       from  sierras
       WHERE delegated_person is not null) a

should probably work but is ugly (whenever I can get rid of DISTINCT, I
do).

-- 
Regards,

Stephane Faroult
Oriole Ltd
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroult
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to