pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Fields
4+ messages / 4 participants
[nested] [flat]

* Fields
@ 2006-05-31 19:47  Charles Curi <charles.curi@gmail.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Charles Curi @ 2006-05-31 19:47 UTC (permalink / raw)
  To: pgsql-jdbc

Hi people!!!
I have a table called "orders" with fields "a","b" and "c".
I want to make a INSERT only of fields "a" and "b" by Java and at this
moment c=a*b;
Is it possible?

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Fields
@ 2006-05-31 20:51  Guy Rouillier <guyr@masergy.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Guy Rouillier @ 2006-05-31 20:51 UTC (permalink / raw)
  To: pgsql-jdbc

Charles Curi wrote:
> Hi people!!!
> I have a table called "orders" with fields "a","b" and "c".
> I want to make a INSERT only of fields "a" and "b" by Java and at
> this moment c=a*b; Is it possible?

I think you are saying you want your Java code to insert fields "a" and
"b" and have "c" automatically set to a value derived from "a" and "b".
If so, you can accomplish this with an insert trigger.

-- 
Guy Rouillier



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Fields
@ 2006-05-31 20:56  Mark Lewis <mark.lewis@mir3.com>
  parent: Guy Rouillier <guyr@masergy.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Mark Lewis @ 2006-05-31 20:56 UTC (permalink / raw)
  To: Guy Rouillier <guyr@masergy.com>; +Cc: pgsql-jdbc

On Wed, 2006-05-31 at 15:51 -0500, Guy Rouillier wrote:
> Charles Curi wrote:
> > Hi people!!!
> > I have a table called "orders" with fields "a","b" and "c".
> > I want to make a INSERT only of fields "a" and "b" by Java and at
> > this moment c=a*b; Is it possible?
> 
> I think you are saying you want your Java code to insert fields "a" and
> "b" and have "c" automatically set to a value derived from "a" and "b".
> If so, you can accomplish this with an insert trigger.
> 

Or you could just insert a, b and a*b yourself . . . . or am I missing
something here?

-- Mark



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Fields
@ 2006-06-01 01:14  EBIHARA, Yuichiro <ebihara@iplocks.co.jp>
  parent: Mark Lewis <mark.lewis@mir3.com>
  0 siblings, 0 replies; 4+ messages in thread

From: EBIHARA, Yuichiro @ 2006-06-01 01:14 UTC (permalink / raw)
  To: pgsql-jdbc

Hi,

Another solution may be a view as follows.

create table orders (a int, b int);
create view orders_v as select a, b, a * b as c from orders;

ebi

> -----Original Message-----
> From: pgsql-jdbc-owner@postgresql.org 
> [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Mark Lewis
> Sent: Thursday, June 01, 2006 5:56 AM
> To: Guy Rouillier
> Cc: pgsql-jdbc@postgresql.org
> Subject: Re: [JDBC] Fields
> 
> 
> On Wed, 2006-05-31 at 15:51 -0500, Guy Rouillier wrote:
> > Charles Curi wrote:
> > > Hi people!!!
> > > I have a table called "orders" with fields "a","b" and 
> "c". I want 
> > > to make a INSERT only of fields "a" and "b" by Java and at this 
> > > moment c=a*b; Is it possible?
> > 
> > I think you are saying you want your Java code to insert fields "a" 
> > and "b" and have "c" automatically set to a value derived 
> from "a" and 
> > "b". If so, you can accomplish this with an insert trigger.
> > 
> 
> Or you could just insert a, b and a*b yourself . . . . or am 
> I missing something here?
> 
> -- Mark
> 
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
> 
>                http://www.postgresql.org/docs/faq
> 
> 
> 





^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2006-06-01 01:14 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-05-31 19:47 Fields Charles Curi <charles.curi@gmail.com>
2006-05-31 20:51 Re: Fields Guy Rouillier <guyr@masergy.com>
2006-05-31 20:56 ` Mark Lewis <mark.lewis@mir3.com>
2006-06-01 01:14   ` EBIHARA, Yuichiro <ebihara@iplocks.co.jp>

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