Link to home
Start Free TrialLog in
Avatar of enrique_aeo
enrique_aeo

asked on

oracle: insert row from main table TO client table

Good afternoon, I have a Main table with 225 columns.
 I have another table with 6 columns Client has 17 records.
 I need complete information in the Customer table, this information is in the Main table (also with 6 columns).
 My question is:
 as I can insert into the Customer table records missing?
Avatar of awking00
awking00
Flag of United States of America image

Can you do a describe on the tables?
Avatar of enrique_aeo
enrique_aeo

ASKER

Main table with 225 columns
but i need only this
RazonSocial
NumeroDocumento
CodTipoBanca
CodGrupo
CodCalificacionSBS
CodFeve
Rating
CodSegmentacion
CodEjecutivoNegocios
DesEjecutivoNegocios
LineaCredTienda
to insert in my customers table
Are you looking for a statement like this:

INSERT INTO CUSTOMER
SELECT COL1, COL2, COL3, COL4, COL5, COL6
FROM MAIN
WHERE...

That should do what you want, you just need to supply all the proper column names and where clause.
my customer table already has data, I only need to insert the missing
What exactly is missing, and in which table?
SOLUTION
Avatar of johnsone
johnsone
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
missing = records that are not in my customer table
OK, so which table do they exist in, and which column values do you compare to determine they are missing?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I insert from main table to customer
 customer has less than 20rows. in the main  table there are 325 customers
I believe any of the latest posts will do what you want.  What part of them are you not understanding?
Then the examples from johnsone and slightwv should be very close to what you need.  We just don't know exactly which column(s) of those tables have to be compared to know if the record should be added, or not.