Re: Prob w/ creating an SP
Posted in 1995
You aren't trying to use ISQL to create the procedures, are you? ISQL does not understand that a single statement (CREATE PROCEDURE) can contain multiple semi-colons, so it sends the text up to the first semi-colon to the engine -- which understandably doesn't think that the statement is complete. Use DB-Access which does understand the syntax of CREATE PROCEDURE. I just tried your toll_id_reseq example on 5.03.UC1 OnLine and DB-Access and got 'procedure created' -- ie no problem. To the best of my recollection, 5.00 had stored procedures and 5.01 added triggers, so you should be OK with any version. The first one fails with '659: INTO TEMP table required for SELECT statement' because the results of the SELECT must go somewhere -- either an INTO clause or an INTO TEMP table clause. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> }From: smorrow@dotrisc.cfr.usf.edu (Steve Morrow) }Date: 19 Apr 1995 19:41:56 GMT }X-Informix-List-Id: <news.13175> } }We're running SE 5.0 over here, and I'd like to start creating some }stored procedures. However, every attempt to do so is giving me an error. } }For example, if I create the following procedure (within an sql command }file): } } CREATE PROCEDURE test () } } SELECT count(*) FROM billing_toll; } } END PROCEDURE; } }I receive the following error: } } 201: A syntax error has occurred. } Error in line 3 } Near character position 33 } }(Char 33 is the "o" in "billing_toll" in this case.) } }Another example that bombs: } } CREATE PROCEDURE toll_id_reseq () } } CREATE TEMP TABLE toll_id_xref (old_id int, new_id serial); } CREATE UNIQUE INDEX tix_idx on toll_id_xref (old_id); } } INSERT INTO toll_id_xref SELECT toll_id, 0 FROM billing_toll; } } END PROCEDURE; } }And this gives me: } } 201: A syntax error has occurred. } Error in line 3 } Near character position 58 } }(Char 58 is the "a" in "serial" above). } }What gives? I'm don't seem to be violating any SP-creation no-no's. }FYI, I'm also doing this as DBA, and I know for a fact that we're running }5.0 (which is the initial version supporting SP's, right?).