Skip site navigation (1) Skip section navigation (2)

Re: [INSERT]Insert blank values

From: "Oliveiros Cristina" <oliveiros(dot)cristina(at)marktest(dot)pt>
To: Leví Teodoro da Silva <tlevisilva(at)gmail(dot)com>,<pgsql-novice(at)postgresql(dot)org>
Subject: Re: [INSERT]Insert blank values
Date: 2008-10-24 12:05:44
Message-ID: 00e601c935d0$d7fafe30$ec5a3d0a@marktestcr.marktest.pt (view raw or flat)
Thread:
Lists: pgsql-novice
At first glance,
I think it might be easy to send to back-end the first INSERT statement if you get a blank for the form
and the second one if you don't get a blank...  With an if statement , for ex

Why can't you do that?
Maybe I am misunderstanding your situation.

Best,
Oliveiros
  ----- Original Message ----- 
  From: Leví Teodoro da Silva 
  To: pgsql-novice(at)postgresql(dot)org 
  Sent: Friday, October 24, 2008 12:59 PM
  Subject: [NOVICE] [INSERT]Insert blank values


  Hi guys, 

  I have a little problem.
  I want to insert a blank on a varchar field. When i do the follow :
    INSERT INTO "Seller"("name", "id")VALUES ( null ,'1'); it works perfectly !!!
  But if i try :
    INSERT INTO "Seller"("name", "id")VALUES ( '','1'); The postgres insert in my database the value '', and i dont want it.

  The first way, is the only way for insert blank values !? Because it is not good for me, because i received a lot of fields from a form and i don't want to put null if the value is blank, and don't if it is not blank.


  Regards,
  Levi

In response to

pgsql-novice by date

Next:From: G. J. WalshDate: 2008-10-26 01:02:39
Subject: combining tables
Previous:From: Leví Teodoro da SilvaDate: 2008-10-24 12:04:28
Subject: Re: [INSERT]Insert blank values

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group