Re: Scroll Cursor for Update
Posted in 1997
steve53@earthlink.net wrote: > > Hi, > > I'm in the process of rewriting the database access library for one of > our applications. The original database was proprietary and the new > database will be Informix-SE. Currently we have v5.x. V7.x is on > order. > > It appears that v5's dynamic ESQL C does not allow me to open a SCROLL > CURSOR against a SELECT statment defined as FOR UPDATE. > > Does v7 relax this restriction? Steve, this is not a version-related restriction. It is a misunderstandng of the definition of a scroll cursor. A scroll cursor is designed for browsing only. To support this, it uses a temp table/file (I never really found out which). Every row you fetch froma scroll cursor is taken from the temp table, after being copied from the original table to the temp. In light of this, allowing an update through that cursor would make no sense, since [if it were permitted] it would operate on the temp table. The 4GL and ESQL classes cover this issue quite extensively. The preferred recommendation is another [non-scrolling] cursor designated "FOR UPDATE". When your scroll cursor has fetched a row you want to update, fetch it again through the update cursor; then execute your UPDATE statement with the WHERE clause: WHERE CURRENT OF update_cursor_name. I have just condensed 3 hours of class work into a single paragraph. I am merely pointing you to subjects to read up on (as well as plugging my favorite alma mater ;-) -- -- Jake (In pursuit of undomesticated aquatic avians) +---------------------------------------------------------------+ |Insofar as manifestations of functional deficiencies are agreed| |by any and all concerned parties to be imperceivable, and are | |so stipulated, it is incumbent upon said heretofore mentioned | |parties to exercise the deferment of otherwise pertinent | |maintenance procedures. | +------------------- A Legal Minded Engineer (hardyharhar.com) -+