Re: select - insert query
From: Anders Altberg (x_pragma_at_telia.com)
Date: Fri, 8 Oct 2004 15:14:08 +0200
It can work. The two tables CONTACBR and schACBR will stay at the same
record while you scan through slbcurs1. If they are ast EOF() a defalt empty
value will be inserted. If these tables are the target of a valid SET
RELATION from Slbcurs1 the will move the recordpointer as you scan through
"Vijay Nayak" <VijayNayak@discussions.microsoft.com> wrote in message
> Hello friends,
> Look at the query:
> SELE * from slbacbr ;
> where ( SLBEFFFM >= m.onavdt and ;
> ( slbeffto <= m.onavdt OR EMPTY(slbeffto))) ;
> and ( m.rslacs betw slbfrom AND slbto) ;
> and SLBUPFRT > 0 ;
> and allt( FUT_SCH) == trim( _schemecod) ;
> and fundcd = _fundcd ;
> orde by slbtype ;
> into curs slbcurs1
> Now, the current work area is SLBCURS1.
> A scan starts which contains in sql - inserts which is as follows:
> INSE into brokproc ( PASHOLD, navdate, BALNAVDT, redmdays, OSUNITS, ;
> fundcd, SCHEME_COD, TYPECD, OPTIONCD, SCHEME_NAM, fut_sch, ;
> slbtype) valu ;
> ( MSLB1YRFQ, CONTACBR.nav_date, CONTACBR.BALNAVDT, 1, CONTACBR.OSUNITS,
> _fundcd, _schemecod, schACBR.fundtyp, schACBR.FUNDOPT,
> slbcurs1.fut_sch, ;
> My Question is that
> 1) The way insert is written is correct ?
> The portion of the query after the 'value' clause contains refrence to
> tables which will be open in other work areas. Two fields in the inserted
> table are being updated from the value of fields in the cursor SLBCURS1
> created by sql - select. Does this stand correct ?
> 2) The table 'BROKPROC', which is the inserted table, will be updated with
> what values ?
> 3) I get an error message 'File is in use'. The main error point isn't
> being pin pointed. Is there any possiblity that due to the usage of sql -
> select and sql - insert mentioned above the error 'File is in use' is
> I request valuable tips. Thanks,
> Vijay Nayak.