Insert into - Mailing list pgsql-sql
From | azwa@nc.com.my |
---|---|
Subject | Insert into |
Date | |
Msg-id | OF1A293121.E2FF931B-ONFFFFFF47.004D9A11@nc.com.my Whole thread Raw |
Responses |
Re: Insert into
|
List | pgsql-sql |
<br /><br /><font face="Times New Roman" size="2">Hi,</font><br /><br /><font face="Times New Roman" size="2"> i've structuretable like below and want to load data from temp table into table below :</font><br /><br /><br /><font face="TimesNew Roman" size="2"> dwnc=> \d cust_lo_dim</font><br /><font face="Times New Roman" size="2"> Table "biosadm.cust_lo_dim"</font><br /><font face="Times New Roman" size="2"> Column | Type | Modifiers</font><br /><font face="Times New Roman" size="2">-----------+-----------------------+------------------------------------------</font><br/><font face="Times NewRoman" size="2"> lo_key | integer | not null default nextval('clo_seq'::text)</font><br /><font face="TimesNew Roman" size="2"> lo_no | character varying(25) | not null</font><br /><font face="Times New Roman" size="2"> lo_date | date |</font><br /><font face="Times New Roman" size="2"> rcvdate | date |</font><br /><font face="Times New Roman" size="2"> lo_status | character varying(15) |</font><br /><font face="TimesNew Roman" size="2">Indexes: cust_lo_dim_pkey primary key btree (lo_key)</font><br /><br /><br /><font face="TimesNew Roman" size="2">my temp table as below:</font><br /><br /><font face="Times New Roman" size="2"> dwnc=>\d custlo_temp;</font><br /><font face="Times New Roman" size="2"> Table "biosadm.custlo_temp"</font><br /><fontface="Times New Roman" size="2"> Column | Type | Modifiers</font><br /><font face="Times New Roman" size="2">----------+---------------+-----------</font><br/><font face="Times New Roman" size="2"> lono | text |</font><br /><font face="Times New Roman" size="2"> lodate | text |</font><br /><font face="Times New Roman"size="2"> rcvdate | text |</font><br /><font face="Times New Roman" size="2"> loamount | numeric(10,2) |</font><br/><font face="Times New Roman" size="2"> custname | text |</font><br /><font face="Times New Roman" size="2"> status | text |</font><br /><br /><br /><font face="Times New Roman" size="2">My SELECT STATEMENT : </font><br/><br /><font face="Times New Roman" size="2"> dwnc=> insert into cust_lo_dim</font><br /><font face="TimesNew Roman" size="2">dwnc-> (lo_no,lo_date,rcvdate,lo_status)</font><br /><font face="Times New Roman" size="2">dwnc->select c.lono,c.lodate,c.rcvdate,c.status</font><br /><font face="Times New Roman" size="2">dwnc-> fromcustlo_temp c ;</font><br /><font face="Times New Roman" size="2">ERROR: column "lo_date" is of type date but expressionis of type text</font><br /><font face="Times New Roman" size="2"> You will need to rewrite or cast theexpression</font><br /><font face="Times New Roman" size="2">Questions :</font><br /><br /><font face="Times New Roman"size="2"> 1) How to rewrite /cast the expression above ??? same goes to others column .</font><br /><font face="TimesNew Roman" size="2">2) lo_key is the column which values comes from sequence clo_seq. what should i do first b4insert into cust_lo_dim ????</font><br /><br /><br /><font face="Times New Roman" size="2">i appreciate for the help.TQ</font>