to_date syntax error

From: "ben sewell" <mosherben(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: to_date syntax error
Date: 2006-08-29 09:08:33
Message-ID: bf6c74d80608290208h2140c915vda7121da1b8d7686@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi guys,
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.

For starters, I am inputing all the parameters as varchar chars and
some of the parameters are optional and Access doesn't like passing
null integers to postgres.

Here's my code:

create or replace function reports (inreport_id varchar,inadviser_id
varchar,inprovider_id varchar,inintroducer_id varchar,
inplangroup_id varchar,inplantype_id varchar,indatespecific_start
varchar,indatespecific_end varchar,inchild24 varchar,inchild26
varchar)
returns record as'

declare myrec record;
declare ireport_id integer;
declare iadviser_id integer;
declare iprovider_id integer;
declare iintroducer_id integer;
declare iplangroup integer;
declare iplantype integer;
declare idatespecific_start date;
declare idatespecific_end date;
declare ichild24 date;
declare ichild26 date;

begin

ireport_d=CAST(inreport_id as integer);
iadviser_id=CAST(inadviser_id as integer);
iprovider_id=CAST(inprovider_id as integer);
iintroducer_id=CAST(iintroducer_id as integer);
iplangroup=CAST(inplangroup as integer);
iplantype=CAST(inplangroup_id as integer);
idate_start=to_date(indatespecific_start,'DD-MM-YYYY');
idate_end=to_date(indatespecific_end,'DD-MM-YYYY');
ichild24=to_date('inchild24','DD-MM-YYYY');
ichild26=to_date('inchild26','DD-MM-YYYY');

I'll be using the variables later in the function so any advice/help
is appreciated.

Cheers,
Ben

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tiger Quimpo 2006-08-29 09:17:07 Re: Shared Objects (Dynamic loading)
Previous Message Shane Ambler 2006-08-29 05:30:04 Re: Difference between char and varchar