[SQL] INSERT only under certain conditions (SELECT)

2002-07-07 Thread Joachim Trinkwitz
Hi, I want to insert a row only under condition that there isn't already another row with similar values -- something like a INSERT INTO ... WHERE NOT EXISTS (SELECT ...)? Hoping for help, joachim ---(end of broadcast)--- TIP 3: if posting/readi

Re: [SQL] Bad SUM result

2002-07-07 Thread Stephan Szabo
On Sun, 7 Jul 2002, Roy Souther wrote: > I have an invoice database that has two tables one for invoices and one for > payments. I want to get the account balance for a client by subtracting the > sum of all payments from the sum off all invoices for that client. > > Here is the SQL that I though

[SQL] Bad SUM result

2002-07-07 Thread Roy Souther
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have an invoice database that has two tables one for invoices and one for payments. I want to get the account balance for a client by subtracting the sum of all payments from the sum off all invoices for that client. Here is the SQL that I though

Re: [SQL] Is Dropping a column "CHECK" constraint possible?

2002-07-07 Thread Rajesh Kumar Mallah.
Hi , i want to enforce that a coulumn 'imp' shud either contain valid data or no data at all. by valid data i mean data having at least one non whitespace character. will this constraint be approprote for accomplishing it? tradein_client=> ALTER TABLE t_a ADD CHECK ( length( btrim(imp) )

Re: [SQL] Can this be done with sql?

2002-07-07 Thread Rajesh Kumar Mallah.
Hi, You cannot easily return datasets from stored procedures. there has been lots of discussion on it. regds mallah. > yes, thank you, that may help but unfortunately there are are few more > problems to face. > > 1. I will need to select groups from anywhere in the table so i cannot > assum

Re: [SQL] bit field changes in 7.2.1

2002-07-07 Thread Peter Eisentraut
Kevin Brannen writes: > EXCEPT that now fails in 7.2.1 (I just upgraded this afternoon). It > forces me to use "b'00'" instead of "b'0'::bit(6)". Which is a problem why? > Searching thru the docs, I find a note that says: > > --- > Note: Prior to PostgreSQL 7.2, BIT type data was zero-pad

Re: [SQL] Localization

2002-07-07 Thread Peter Eisentraut
GRIMOIS Eric writes: > Is there a simple way to localize in foreign language error messages without > modifying and compiling the sources again ? Depends on what compilation options you used to begin with. Obviously, if you didn't include the feature, it's not there. In any case, the current s