[GENERAL] Setting expire date on insert/modify

2006-01-24 Thread Foster, Stephen
I'm having a problem converting a simple date routing to PLPGSQL. I know the error has to be something stupid but I'm missing it. The error is in the ExpireDate := (date 'StartDate' + integer 'NumOfDays'); line in the procedure below. I didn't understand why I had to convert the date to a

Re: [GENERAL] Setting expire date on insert/modify

2006-01-24 Thread Michael Glaesemann
On Jan 25, 2006, at 9:45 , Foster, Stephen wrote: ERROR: invalid input syntax for type date: StartDate CONTEXT: SQL statement SELECT (date 'StartDate' + integer 'NumOfDays') PL/pgSQL function TF_BannerAd_Ads_InsMod line 8 at assignment Why are you single-quoting StartDate and NumOfDays?

Re: [GENERAL] Setting expire date on insert/modify

2006-01-24 Thread Foster, Stephen
, Stephen Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Setting expire date on insert/modify On Jan 25, 2006, at 9:45 , Foster, Stephen wrote: ERROR: invalid input syntax for type date: StartDate CONTEXT: SQL statement SELECT (date 'StartDate' + integer 'NumOfDays') PL/pgSQL function

Re: [GENERAL] Setting expire date on insert/modify

2006-01-24 Thread Michael Glaesemann
On Jan 25, 2006, at 10:12 , Foster, Stephen wrote: If I try to save without which was what I did in the first place I receive this using ExpireDate := (date StartDate + integer NumOfDays); ERROR: syntax error at or near $1 at character 16 QUERY: SELECT (date $1 + integer $2 )

Re: [GENERAL] Setting expire date on insert/modify

2006-01-24 Thread Stephan Szabo
On Tue, 24 Jan 2006, Foster, Stephen wrote: CREATE OR REPLACE FUNCTION TF_BannerAd_Ads_InsMod() RETURNS trigger AS $BODY$ DECLARE ExpireDate timestamptz; -- Date the Banner Ad will expire. StartDate char(10); -- Date the Banner Ad was created or renewed NumOfDays

Re: [GENERAL] Setting expire date on insert/modify

2006-01-24 Thread Foster, Stephen
:18 PM To: Foster, Stephen Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] Setting expire date on insert/modify On Tue, 24 Jan 2006, Foster, Stephen wrote: CREATE OR REPLACE FUNCTION TF_BannerAd_Ads_InsMod() RETURNS trigger AS $BODY$ DECLARE ExpireDate timestamptz; -- Date

Re: [GENERAL] Setting expire date on insert/modify

2006-01-24 Thread Tom Lane
Foster, Stephen [EMAIL PROTECTED] writes: Michael, I tried that line in the trigger procedure with double quotes, single quotes and without. The only way it would save was with single quotes and that is why you saw it that way. Just for reference, the thing that was tripping you up (or one