pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: azwa@nc.com.my
To: pgsql-sql@postgresql.org
Subject: Insert into
Date: Mon, 12 Jan 2004 17:12:11 +0800
Message-ID: <OF1A293121.E2FF931B-ONFFFFFF47.004D9A11@nc.com.my> (raw)

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

view thread (13+ messages)  latest in thread

Message-ID: <OF1A293121.E2FF931B-ONFFFFFF47.004D9A11@nc.com.my>
Permalink:  ../OF1A293121.E2FF931B-ONFFFFFF47.004D9A11@nc.com.my/
Also on:    postgresql.org/message-id/OF1A293121.E2FF931B-ONFFFFFF47.004D9A11@nc.com.my

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: azwa@nc.com.my
  Subject: Re: Insert into
  In-Reply-To: <OF1A293121.E2FF931B-ONFFFFFF47.004D9A11@nc.com.my>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox