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

Re: BUG #3590: Error while in Plpgsql :

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Abdus Samad Ansari" <abdus(dot)samad(dot)ansari(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3590: Error while in Plpgsql :
Date: 2007-08-31 14:00:17
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
"Abdus Samad Ansari" <abdus(dot)samad(dot)ansari(at)gmail(dot)com> writes:
> I am using a plpgsql function and in this I am issuing a insert as :
> Insert into pis.hrt_emp_leave_bin
> (emp_no,leave_cd,curr_dt,bin_sl_no,cal_yr,tran_typ,open_bal,ytd_availed,avai
> led) values (EmployeeNumber, LeaveCode, CurrentDate,
> Bin_Serial_No,to_number(to_char(CurrentDate,''YYYY''),''9999''),''CM'',
> OpenBal,YtdAvailed+LeaveVal,LeaveVal);

> This insert statement while run give an error message :
> ERROR:  syntax error at or near "$1" at character 35

This probably means that one of the field names in the statement (if I
counted characters right, probably "emp_no") is the same as the name of
one of the plpgsql variables in the function.  You need to change the
variables to not conflict with any of the table or field names you need
to reference in the queries of that function, because plpgsql is not
very bright about telling when it should substitute and when it should

			regards, tom lane

In response to

pgsql-bugs by date

Next:From: Ben KimDate: 2007-08-31 20:13:01
Subject: BUG #3591: autovacuum crash
Previous:From: Josh TolleyDate: 2007-08-31 13:35:28
Subject: Re: to_date gives odd results

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