Search Postgresql Archives

Syntax error for Function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;

------------------------

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux