X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3C18ED1BA81 for ; Mon, 12 Jan 2004 09:33:56 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 20668-01 for ; Mon, 12 Jan 2004 05:33:27 -0400 (AST) Received: from domino.nc.com.my (domino.nc.com.my [202.185.214.131]) by svr1.postgresql.org (Postfix) with ESMTP id 78B01D1B432 for ; Mon, 12 Jan 2004 05:33:24 -0400 (AST) Subject: Insert into To: pgsql-sql@postgresql.org X-Mailer: Lotus Notes Release 5.0 (Intl) 30 March 1999 Message-ID: From: azwa@nc.com.my Date: Mon, 12 Jan 2004 17:12:11 +0800 X-MIMETrack: Serialize by Router on domino/ANSI(Release 5.0.5 |September 22, 2000) at 01/12/2004 05:12:13 PM, Serialize complete at 01/12/2004 05:12:13 PM MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_alternative 0034AF1C48256E19_=" X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.9 tagged_above=0.0 required=5.0 tests=BAYES_30, HTML_40_50, NO_REAL_NAME X-Spam-Level: X-Archive-Number: 200401/90 X-Sequence-Number: 16483 This is a multipart message in MIME format. --=_alternative 0034AF1C48256E19_= Content-Type: text/plain; charset="us-ascii" 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 --=_alternative 0034AF1C48256E19_= Content-Type: text/html; charset="us-ascii"

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 --=_alternative 0034AF1C48256E19_=--