Insert into
Insert into
От:
azwa@nc.com.my
Дата:
Hi,
i've structure table like below and want to load data from temp table into table below :
dwnc=> \d cust_lo_dim
Table "biosadm.cust_lo_dim"
Column | Type | Modifiers
-----------+-----------------------+------------------------------------------
lo_key | integer | not null default nextval('clo_seq'::text)
lo_no | character varying(25) | not null
lo_date | date |
rcvdate | date |
lo_status | character varying(15) |
Indexes: cust_lo_dim_pkey primary key btree (lo_key)
my temp table as below:
dwnc=> \d custlo_temp;
Table "biosadm.custlo_temp"
Column | Type | Modifiers
----------+---------------+-----------
lono | text |
lodate | text |
rcvdate | text |
loamount | numeric(10,2) |
custname | text |
status | text |
My SELECT STATEMENT :
dwnc=> insert into cust_lo_dim
dwnc-> (lo_no,lo_date,rcvdate,lo_status)
dwnc-> select c.lono,c.lodate,c.rcvdate,c.status
dwnc-> from custlo_temp c ;
ERROR: column "lo_date" is of type date but expression is of type text
You will need to rewrite or cast the expression
Questions :
1) How to rewrite /cast the expression above ??? same goes to others column .
2) lo_key is the column which values comes from sequence clo_seq. what should i do first b4 insert into cust_lo_dim ????
i appreciate for the help. TQ
Re: Insert into
От:
Gabriel Dovalo Carril <dovalo@terra.es>
Дата:
El lun, 12-01-2004 a las 10:12, azwa@nc.com.my escribió: > > Hi, > ..../.... > > My SELECT STATEMENT : > > dwnc=> insert into cust_lo_dim > dwnc-> (lo_no,lo_date,rcvdate,lo_status) > dwnc-> select c.lono,c.lodate,c.rcvdate,c.status > dwnc-> from custlo_temp c ; > ERROR: column "lo_date" is of type date but expression is of type > text > You will need to rewrite or cast the expression > Questions : > > 1) How to rewrite /cast the expression above ??? same goes to > others column . Insert into cust_lo_dim (lo_no, lo_date, rcvdate, lo_status) select c.lono, c.lodate::date, c.rcvdate::date, c.status from custlo_temp c; > 2) lo_key is the column which values comes from sequence clo_seq. what > should i do first b4 insert into cust_lo_dim ???? ??? Nothing. Are you getting some error? -- Gabriel Dovalo