to_date syntax error - Mailing list pgsql-novice

From ben sewell
Subject to_date syntax error
Date
Msg-id bf6c74d80608290208h2140c915vda7121da1b8d7686@mail.gmail.com
Whole thread Raw
Responses Re: to_date syntax error  (Michael Fuhr <mike@fuhr.org>)
List 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

pgsql-novice by date:

Previous
From: Shane Ambler
Date:
Subject: Re: Difference between char and varchar
Next
From: Michael Fuhr
Date:
Subject: Re: to_date syntax error