Re: Syntax error for Function

From: Thom Brown <thom(at)linux(dot)com>
To: Sachin Srivastava <ssr(dot)teleatlas(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org >> PG-General Mailing List" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Syntax error for Function
Date: 2016-01-20 12:35:48
Message-ID: CAA-aLv5TbD9-uU1TpseaUdocxEpsD-amYe5_Kh+SNEDbD3ZQKg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 20 January 2016 at 12:15, Sachin Srivastava <ssr(dot)teleatlas(at)gmail(dot)com> wrote:
> I am unable to find out the syntax error in below code, please suggest?
>
>
>
> ERROR: syntax error at or near "select"
> LINE 44: select Count(0) into sFound from budget_period ...
> ^
> ********** Error **********
> ERROR: syntax error at or near "select"
> SQL state: 42601
> Character: 1190
>
> Code as below:
> -------------------------
>
> select Count(0) into sFound from budget_period t where t.subscriber_id
> =subID
> and t.period_number = period and
> t.language_id=langCursor.Language_Id;
> if(sFound = 0)then
> insert into budget_period (subscriber_id, company_id,
> period_number, period_name,
> period_length_code, first_day, last_day,creation_date,
> creation_user, update_date, update_user, language_id)
> values(subID, compID, period, curMonth, 'MONTH',
> firstDate, lastDate, LOCALTIMESTAMP, 'Admin',LOCALTIMESTAMP,
> 'Admin', langCursor.Language_Id);
> end if;
>
> ------------------------

Well, it says that the problem occurs on line 44, so what's on the
previous lines it's receiving? Are you sending an unterminated query
prior to that?

Thom

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2016-01-20 12:53:39 Re: Postgres and timezones
Previous Message Bill Moran 2016-01-20 12:32:57 Re: JSONB performance enhancement for 9.6