Re: Prepared SQL in 4GL
Posted in 1995
ryeardly@eurobrok.co.uk wrote: : I hope someone can help. In a 4GL program is it quicker to prepare : a piece of SQL and then execute it, rather than just embedd the SQL : statement directly in the code. I know that if you need to use variables : and place holders then you have to prepare the SQL, but for example, : a select for use with a cursor. : Is it quicker to declare the cursor directly : from embedded SQL or by using a prepared SQL statment? Generally, it is best to prepare and execute statements that get executed multiple times. Perfect example is something that is deep inside a program loop that executes many times. The savings can be dramatic if you do a prepare outside the loop and execute inside. I'm not sure exactly where the break-point is....if it executes 5 times is it a candidate?....who knows? If it executes 500 times it is definitely a candidate. Actually, it doesn't really matter on the low end. If something executes once or twice, optimizing with prepare/ execute wouldn't gain you enough time to really notice. Joe -- --------------------------------------------------------------------------- Joe Lumbley(jlumbley@netcom.com) Dallas, Texas ----------------------------------------------------------------------------