RES: Inserting data in composite types!

From: "Rodrigo Sakai" <rodrigo(dot)sakai(at)zanthus(dot)com(dot)br>
To: "'imad'" <immaad(at)gmail(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: RES: Inserting data in composite types!
Date: 2006-11-13 18:27:17
Message-ID: 000001c70751$5cae7130$4700a8c0@TREEZANTHUS
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thanks, It works! I have tried:

insert into employee (c, nome, sal) values(1, 'emp name', '(1, (01/01/2000,
01/01/2000))' );

And it doesn't work!

-----Mensagem original-----
De: imad [mailto:immaad(at)gmail(dot)com]
Enviada em: segunda-feira, 13 de novembro de 2006 11:10
Para: rodrigo(dot)sakai(at)zanthus(dot)com(dot)br
Cc: pgsql-sql(at)postgresql(dot)org
Assunto: Re: [SQL] Inserting data in composite types!

I am able to do this thing with the following query:

insert into employee (a, name, s) values(1, 'emp name', ((1,
'(01/01/2000, 01/01/2000)')));

--Imad
www.EnterpriseDB.com

On 11/13/06, Rodrigo Sakai <rodrigo(dot)sakai(at)zanthus(dot)com(dot)br> wrote:
>
>
>
>
> Hi, I have a question about how to insert data in composite types!
>
>
>
> Imagine the exemple:
>
>
>
> CREATE TYPE t_time AS (
>
> a date,
>
> b date
>
> );
>
>
>
> CREATE TABLE salary (
>
> salary numeric(10,2),
>
> t_date t_time
>
> );
>
>
>
> I know that if I want to insert data in the table SALARY I just have to do
> like:
>
>
>
> INSERT INTO salary VALUES (1000.00, '(2006/10/10, 2006/12/10)');
>
>
>
> But if I have another table:
>
>
>
> CREATE TABLE employee (
>
> employee_id int,
>
> name varchar(30),
>
> emp_salary salary
>
> )
>
>
>
> How can I insert a single row in this table???
>
>
>
> Thanks in advamce!
>
>

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rodrigo Sakai 2006-11-13 18:33:40 Another question about composite types
Previous Message Erik Jones 2006-11-13 18:16:52 Re: COALESCE and GROUP BY and AGGREGATES