Insert into

From: azwa(at)nc(dot)com(dot)my
To: pgsql-sql(at)postgresql(dot)org
Subject: Insert into
Date: 2004-01-12 09:12:11
Message-ID: OF1A293121.E2FF931B-ONFFFFFF47.004D9A11@nc.com.my
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2004-01-12 09:45:18 Re: Select into
Previous Message Tomasz Myrta 2004-01-12 06:28:09 Re: Problem with NOT IN portion of query.