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

Re: to_date syntax error

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: ben sewell <mosherben(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: to_date syntax error
Date: 2006-08-29 10:04:57
Message-ID: 20060829100457.GA20181@winnie.fuhr.org (view raw or flat)
Thread:
Lists: 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

In response to

pgsql-novice by date

Next:From: Franck RoutierDate: 2006-08-29 10:22:07
Subject: Re: Difference between char and varchar
Previous:From: Tiger QuimpoDate: 2006-08-29 09:17:07
Subject: Re: Shared Objects (Dynamic loading)

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