Stored Procedures and Cursors
Posted in 1999
Topics: Stored Procedures & SPL
Hi Could anybody overthere help me sending a complete stroed procedure code in Informix using Cursors. My task is to read all records from one table in a database and transfer all the records into another table. I want to write a stored procedure with cursors as I do it in oracle by reading all record into cursor and then transfer one by one into another table. I need this ver badly and as soon as possible. I would appreciate if you can send answers to my personal email rmadduluri@stantec.com Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.
ruku@my-deja.com wrote:
>
> Hi
>
> Could anybody overthere help me sending a complete stroed procedure
> code in Informix using Cursors. My task is to read all records from one
> table in a database and transfer all the records into another table. I
> want to write a stored procedure with cursors as I do it in oracle by
> reading all record into cursor and then transfer one by one into
> another table. I need this ver badly and as soon as possible. I would
> appreciate if you can send answers to my personal email
You cannot do this the way you want to. Informix SPL does not have the
features you would need. If the copy is simple you can use the SQL
syntax:
INSERT INTO target_table
SELECT * FROM source_table;
For more speed or if you do this often you may want to get my dbcopy.ec
program which is about 3x faster that this syntax though INSERT INTO...
SELECT FROM... is pretty darn fast actually. Dbcopy.ec is contained in
the package utils2_ak which I submitted to the IIUG Software Repository.
BTW either of these methods will be faster than ANY stored procedure
could be! The SQL syntax does all of the work in the engine and dbcopy
uses IDS larger buffers and the Array Fetch feature with minimal data
manipulation to get the job done as fast as possible. Any store
procedure code is interpreted p-code at best.
Art S. Kagel
Sent example to: >rmadduluri@stantec.com > > >Sent via Deja.com http://www.deja.com/ >Share what you know. Learn what you don't.