Re: 4gl insert cursor - know it?
Posted in 1999
Min Kim wrote: > > When using an insert cursor, is the 'values' clause required? I'm actually > filling in my columns using a select statement. > LET insertSqlString = "insert into ", table_name CLIPPED, " select unique > 0, mydatabase:quote_items.part_number, mydatabase:part_code.category .... > etc etc. > > Am I still eligible for the fast cursor? > > Min > > Min Kim wrote: > > > Hello, > > Does anyone know how to use an insert cursor to insert into a table? I > > heard it's much faster than using the standard "insert into..." > > statement. No you cannot use a cursor for this statement because the data being inserted into the table is coming DIRECTLY from the result set of the SELECT statement and is NEVER returned to your application at all. If you do want to pass the data through the program you can then take advantage of the PUT cursor by opening the SELECT on a separate cursor and FETCHing into the host variables you will be PUTting to the INSERT CURSOR. Keep in mind that a statement like INSERT INTO...SELECT...FROM is still a bit faster than doing it yourself with a PUT cursor and using maximum sized fetch buffers (FET_BUF_SIZE=32767). You can outperform such a statement ONLY by using the ARRAY FETCH feature of the engine and ESQL library to FETCH the data to be inserted (this is what dbcopy.ec does and it flies!), however, you cannot do ARRAY FETCHes in 4GL you will have to code the data FETCHing in ESQL/C. Art S. Kagel