I am trying to speed up a process. Part of this process contains a loop which inserts multiple records into a table. The existing code changes the sql of the query in order to setup parameters.
 
eg.
 
        Clear;
        Add(' insert into fw_programme_cell (');
        Add('     cell_id,programme_hdr_id,treat_length_id,');
        Add('     fw_year,reason_note,');
        Add('     added_on, added_by, chgd_on)');
        Add('   select');
        Add('     ' + IntToStr(LNewCellId) + ',' + IntToStr(PToID) + ',treat_length_id,');
        Add('     fw_year,reason_note,');
        Add('     today, USER, ""');
        Add('   from z_fw_programme_cel');
        Add('   where cell_id = ' + LQuery2.FieldByName('cell_id').AsString);
        ExecSQL;
 
I want to do this is a parameterised query, but I am not sure of how to go about it. I have tried the following with no luck. It doesn't like the parameters for the select fields. I have tried aliasing the parameters.
 
insert into fw_programme_cell(cell_id
 , programme_hdr_id
 , treat_length_id
 , fw_year
 , reason_note
 , added_on
 , added_by
 , chgd_on)
select :p_new_cell_id
 , :p_to_id
 , treat_length_id
 , fw_year
 , reason_note
 , today
 , user
 , ""
from z_fw_programme_cel
where cell_id = :p_cell_id
 
 
I intend this to do something like:
 
select 1, 13, treat_length_id ...
 
which is fine in informix SQL. 
 
Thanks
 
Stacey
 
Stacey Verner             Ph:   +64-9-4154790
Software Developer        Fax:  +64-9-4154791
                          DDI:  +64-9-4154797
CJN Technologies Ltd.     Email: [EMAIL PROTECTED]
PO Box 302-278, North Harbour, Auckland, New Zealand
12 Piermark Drive, North Harbour Estate, Auckland, NZ
Visit our website at http://www.cjntech.co.nz/
 
 

Reply via email to