Unix Technical Forum

Syntax error in stored procedure

This is a discussion on Syntax error in stored procedure within the Informix forums, part of the Database Server Software category; --> Hi, I have problems with one stored procedure that I am trying to develop in my informix database. The ...


Go Back   Unix Technical Forum > Database Server Software > Informix

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 08:40 AM
Unholy
 
Posts: n/a
Default Syntax error in stored procedure

Hi, I have problems with one stored procedure that I am trying to
develop in my informix database.

The procedure is at folloews

create procedure updateFlags(emp LIKE employee.idEmployee,check like
dailycheck.checkdate)
DEFINE selected integer;
FOREACH cursor FOR select first 1 iddailycheck
into selected from dailycheck DC
where DC.idEmployee=emp and DC.checkdate=check
and DC.modificationtype='PLANNED' order by
DC.modificationdate desc;
update dailycheck set lastPlanned=1 where iddailycheck=selected;
end foreach;

end procedure;

I am using dbaccess, what the result is always the same....

Can you help me????

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-20-2008, 08:41 AM
Superboer
 
Posts: n/a
Default Re: Syntax error in stored procedure

loose the ; at
> FOREACH cursor FOR select first 1 iddailycheck
> into selected from dailycheck DC
> where DC.idEmployee=emp and DC.checkdate=check
> and DC.modificationtype='PLANNED' order by
> DC.modificationdate desc;

-------------------------^^---HERE-------

see you

Superboer.


Unholy schreef:
> Hi, I have problems with one stored procedure that I am trying to
> develop in my informix database.
>
> The procedure is at folloews
>
> create procedure updateFlags(emp LIKE employee.idEmployee,check like
> dailycheck.checkdate)
> DEFINE selected integer;
> FOREACH cursor FOR select first 1 iddailycheck
> into selected from dailycheck DC
> where DC.idEmployee=emp and DC.checkdate=check
> and DC.modificationtype='PLANNED' order by
> DC.modificationdate desc;
> update dailycheck set lastPlanned=1 where iddailycheck=selected;
> end foreach;
>
> end procedure;
>
> I am using dbaccess, what the result is always the same....
>
> Can you help me????


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-20-2008, 08:41 AM
Unholy
 
Posts: n/a
Default Re: Syntax error in stored procedure

It need anopther : afeter the first one???

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-20-2008, 08:41 AM
Unholy
 
Posts: n/a
Default Re: Syntax error in stored procedure

It need another ; after the first one???

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-20-2008, 08:42 AM
Superboer
 
Posts: n/a
Default Re: Syntax error in stored procedure

Unholy try this:


create procedure updateFlags(emp LIKE employee.idEmployee,check like
dailycheck.checkdate)
DEFINE selected integer;
DEFINE dummydate like dailycheck.modificationdate;

FOREACH cursor FOR select first 1 iddailycheck, modificationdate
into selected , dummydate from dailycheck DC
where DC.idEmployee=emp and DC.checkdate=check
and DC.modificationtype='PLANNED'
order by DC.modificationdate desc
update dailycheck set lastPlanned=1 where
iddailycheck=selected;
end foreach;

end procedure;

have added dummydate since you order by modificationdate
and just compiled and executed it on 930.

have fun

Superboer.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:11 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com