Re: Informix stored procedure
Posted in 2005
jimbomed said:
>
> Sorry Informix newbie !!!
>
> I need to create a stored procedure, but keep getting a syntax error.
>
> Error message :
> Error: A syntax error has occurred. (State:37000, Native Code: FFFFFF37)
>
> The code is :
> create procedure test()>
> DECLARE lv_tk CHAR(15),
> ln_tk_count INT
>
> declare get_timekeeper CURSOR FOR
> SELECT tkinit
> FROM timekeep
> WHERE tktmdate IS NULL>
> foreach get_timekeeper INTO lv_tk
> SELECT COUNT(*)
> INTO lv_tk_count
> FROM bo_calendar boc
> WHERE NOT EXISTS ( SELECT 1
> FROM timecard tc1
> WHERE tc1.ttk = lv_tk
> AND tc1.tworkdt = boc.date)
> AND boc.date <= today
> AND boc.day_name NOT IN ('Sunday','Saturday')
> AND boc.bank_holiday IS NULL
> AND boc.date > '01-05-'||YEAR(TODAY)>
> INSERT INTO BO_missing_timesheets
> VALUES (tk.tkinit,ln_tk_count)>
> let lv_tk_count = 0
> let lv_tk = NULL
> END foreach
> END PROCEDURE
>
> Can anybody spot what I have done wrong?
Aren't there supposed to be some semi-colons in there?
--
Bye now,
Obnoxio
"C'est pas parce qu'on n'a rien ` dire qu'il faut fermer sa gueule"
- Coluche
did i mention i like nulls? heck, i even go so far as to say that all
columns in a table except the primary key could/should be nullable. this
has certain advantages, for example, if you need to insert a child record
and you don't have a parent row for it, just do an insert into the parent
table with the primary key value (everything else null), and voila,
relational integrity is preserved. but this is, admittedly, a bit
controversial among modellers.
--r937, dbforums.com
sending to informix-list