Re: to_date syntax error - Mailing list pgsql-novice

From Michael Fuhr
Subject Re: to_date syntax error
Date
Msg-id 20060829100457.GA20181@winnie.fuhr.org
Whole thread Raw
In response to to_date syntax error  ("ben sewell" <mosherben@gmail.com>)
List pgsql-novice
On Tue, Aug 29, 2006 at 10:08:33AM +0100, ben sewell wrote:
> I'm nearly at the end of my postgres migration apart from from this
> small problem so I am hoping somebody can spot what the problem is.

You didn't describe the problem symptoms were but I see a few trouble
spots:

1. Check your variable names.  There are several mismatches between
what's declared and what's used (e.g., casting inplangroup instead
of inplangroup_id, assigning ireport_d instead of ireport_id, and
assigning idate_start and idate_end instead of idatespecific_start
and idatespecific_end).

2. If you use single quotes to quote the function body then you'll
need to escape single quotes within the body as '' or \'.  If you're
using PostgreSQL 8.0 or later then consider using dollar quotes to
quote the function body.

3. Two of the to_date calls quote the first argument ('inchild24'
and 'inchild26') when they shouldn't.

Also, you don't need to repeat "declare" for each declaration.  That
does appear to work but you can write "declare" just once, like this:

declare
  myrec record;
  ireport_id integer;
  iadviser_id integer;
  ...
begin
  ...

--
Michael Fuhr

pgsql-novice by date:

Previous
From: "ben sewell"
Date:
Subject: to_date syntax error
Next
From: Franck Routier
Date:
Subject: Re: Difference between char and varchar