From: "John Dbms" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 20, 2001 7:30 PM
Subject: Re: DB2EUG: Overhead for Dynamic SQL in UDB/AIX?
> Will someone please post an example of what a dynamic
> SQL statement using parameter markers looks like. I
> know they are question marks and the question marks
> are somehow used for substitution, but I'm having a
> hard time visualizing what the statement looks like.
Example, in perl:
#... $dbh is connection to database
$sql = 'update mytable set (myname, thetime) = (?, ?) where id = (?)'
$sth = $dbh->prepare($sql);
$sth->execute('ianbjor', '12:25:31', 3278);
$sth->execute('db2user', '19:30:12', 3279);
$sth->finish();
You prepare the statement once, and then can execute it multiple
times providing the parameters for each execution.
This differs from:
$sql = 'update mytable set (myname, thetime) = ('ianbjor', '12:25:31')
where id = 3278';
$sth = $dbh->prepare($sql);
$sth->execute();
$sth->finish();
# repeat statements with other values
Notice that the primary difference between using parameter markers
and static SQL is the fact that with static SQL, there is no time
required for compiling / optimizing as this is taken care of by
BIND.
Good luck,
ian d. bjorhovde cephalad corporation
[EMAIL PROTECTED] intelligent solutions for
http://cephalad.com systems and data management
=====
To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
For other info (and scripts), see http://people.mn.mediaone.net/scottrmcleod