Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Select User Defined Fuctions Called Multiple Times
Message
 
 
À
09/06/2005 17:27:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01021938
Message ID:
01021952
Vues:
19
Any UDF is called from a query one extra time when VFP determines the size of the fields in the result set. See PRB: SQL SELECT Statement UDF Executes Twice On First Record mskb #133001 for details.

>
>I have a sql select statement that calls user defined functions (either a program procedure or DBC stored procedure) and have noticed that the UDF is called multiple times for each record returned.
>
>In following simplest case, the select statement (table with one record) should produce nSeed = 10, but the output is 20.
>
>
>CLEAR ALL
>PUBLIC pnSeed
>
>pnSeed = 1
>
>SELECT  getnumber() as nSeed FROM appkg!one_record_dummy
>
>PROCEDURE getnumber
>	LOCAL lnRetVal
>	
>	lnRetVal = 10 * pnSeed
>	pnSeed   = pnSeed + 1
>	
>	RETURN lnRetVal
>ENDPROC
>
>
>Does anyone know what's causing this and is there a solution (other than not using UDF's with SQl Select Statements)?
>
>Thanks,
>
>Gary Pike
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform