Re: [GENERAL] Function problem

2008-02-22 Thread [EMAIL PROTECTED]
I solved my problem :) the problem is in the query that calls my function: select * from calcolo_inventario('26','2008-02-22','05') where giacenza > 0 because the resulset has a negative row that doesn't appear on screen Thank you very much to all of you Enrico ---(end

Re: [GENERAL] Function problem

2008-02-22 Thread brian
Enrico wrote: Hi all, I have this piece of code DECLARE minv my_inv; r record; totale numeric(20,5); valore numeric(20,5); BEGIN [.] totale := 0; for r in select * from tminv loop [.] valore := r.prezzo*r.giacenza; totale := totale+valore;

Re: [GENERAL] Function problem

2008-02-22 Thread Enrico
On Fri, 22 Feb 2008 11:51:01 -0500 Tom Lane <[EMAIL PROTECTED]> wrote: > Enrico <[EMAIL PROTECTED]> writes: > > the first record has valore=98 and totale=0 for the first time of > > the loop, but my first result of totale is -298 instead of +98. > > Hmm, that's a bit hard to believe. Yes you ri

Re: [GENERAL] Function problem

2008-02-22 Thread Tom Lane
Enrico <[EMAIL PROTECTED]> writes: > the first record has valore=98 and totale=0 for the first time of > the loop, but my first result of totale is -298 instead of +98. Hmm, that's a bit hard to believe. Could we see the whole example not just a fragment? Usually, when you can't understand the p

[GENERAL] Function problem

2008-02-22 Thread Enrico
Hi all, I have this piece of code DECLARE minv my_inv; r record; totale numeric(20,5); valore numeric(20,5); BEGIN [.] totale := 0; for r in select * from tminv loop [.] valore := r.prezzo*r.giacenza; totale := totale+valore; minv.total

Re: [GENERAL] function problem

2007-06-06 Thread Tom Lane
ABHANG RANE <[EMAIL PROTECTED]> writes: > I have written a function called similarity in postgresql which accepts > real[] as argument. I then call it by saying > select * from similarity('{1.232,5., 5.100, 1}'); > I get this error. > Could not choose a best candidate function. You may

[GENERAL] function problem

2007-06-06 Thread ABHANG RANE
Hi, I have written a function called similarity in postgresql which accepts real[] as argument. I then call it by saying select * from similarity('{1.232,5., 5.100, 1}'); I get this error. Could not choose a best candidate function. You may need to add explicit type casts. Is it th

Re: [GENERAL] Function Problem

2004-12-05 Thread Michael Fuhr
On Mon, Dec 06, 2004 at 10:34:12AM +1100, Jamie Deppeler wrote: > I am trying to store value in a TEMPORARY table and I am getting the > following error > > ERROR: relation with OID 51533 does not exist The FAQ has a question regarding functions and temporary tables. See also past discussion in

[GENERAL] Function Problem

2004-12-05 Thread Jamie Deppeler
Problem I am trying to store value in a TEMPORARY table and I am getting the following error ERROR: relation with OID 51533 does not exist Trigger CREATE TRIGGER "createtemporytable" AFTER INSERT ON "component" FOR EACH ROW EXECUTE PROCEDURE "createtemp"(); Function begin CREATE temporary TABLE

Re: [GENERAL] FUNCTION problem

2004-04-02 Thread Bill Moran
Sky wrote: HI everybody ! I have a problem, but I don't know the solution: CREATE TABLE person( user_id SERIAL NOT NULL, uid CHARACTER(20) NOT NULL, pwd CHARACTER(20) NOT NULL, PRIMARY KEY (user_id) ); OK, That's right... CREATE FUNCTION getuserid (CHARACTER(20),CHARACTER(20)) RETURNS SETOF

Re: [GENERAL] FUNCTION problem

2004-04-02 Thread Greg Stark
Sky <[EMAIL PROTECTED]> writes: > uid CHARACTER(20) NOT NULL, > pwd CHARACTER(20) NOT NULL, Incidentally, are you sure you want character(20) ? The input will be padded out to 20 characters with spaces. Usually people find varchar() more convenient. -- greg ---(en

Re: [GENERAL] FUNCTION problem

2004-04-01 Thread Mike Mascari
Sky wrote: HI everybody ! I have a problem, but I don't know the solution: CREATE TABLE person( user_id SERIAL NOT NULL, uid CHARACTER(20) NOT NULL, pwd CHARACTER(20) NOT NULL, PRIMARY KEY (user_id) ); OK, That's right... CREATE FUNCTION getuserid (CHARACTER(20),CHARACTER(20)) RETURNS SETO

Re: [GENERAL] FUNCTION problem

2004-04-01 Thread Tom Lane
Sky <[EMAIL PROTECTED]> writes: > SELECT user_id FROM person WHERE uid=$1 AND pwd=$2; > ERROR: Unable to identify an operator '=$' for types 'character' and > 'integer You need spaces: SELECT user_id FROM person WHERE uid= $1 AND pwd= $2; This is fixed as of PG 7.4, IIRC. Prior to that it's

[GENERAL] FUNCTION problem

2004-04-01 Thread Sky
HI everybody ! I have a problem, but I don't know the solution: CREATE TABLE person( user_id SERIAL NOT NULL, uid CHARACTER(20) NOT NULL, pwd CHARACTER(20) NOT NULL, PRIMARY KEY (user_id) ); OK, That's right... CREATE FUNCTION getuserid (CHARACTER(20),CHARACTER(20)) RETURNS SETOF INTEGER AS