"Prepared SQL statements"
Posted: Mon Oct 15, 2001 4:55 am
Hi,
I am coding a controlling job, and I need to run an sql statement several times depending on the list of values returned in a previous sql call.
eg. Select Variable1
from TableA
where status = PASS
I should receive a list of values back from the above command, for each row returned I would like to run the same sql:
eg.
For each returned value:
Select Variable2
from TableB
where Variable3 = TableA.Variable1
And I want to keep the two as separate sqls!
Does anyone know have an example of how a prepared sql statement works, and whether it would be appropriate to use it in this example?
Thanks
Wendy Voon
Consultant
Black Diamond
T e c h n o l o g i e s
Level 1, 6 Riverside Quay,
Southbank, Victoria, 3006.
E-mail: wendy.voon@bdt.com.au
Telephone: (03) 9698 - 7600
Facsimile: (03) 9698 - 7666
Web: http://www.bdt.com.au/
-------INTERNET E-MAIL CONFIDENTIALITY/DISCLAIMER--------
Privileged and confidential information may be contained in this e-mail. If you are not the intended recipient of this communication please delete and destroy all copies and kindly notify the sender by return e-mail. Recipients of this e-mail must not use, disclose or forward any information or attachments without express permission from Black Diamond Technologies.
Any views expressed in this communication are those of the individual sender except where the sender specifically states them to be the views of Black Diamond Technologies. Except as required at law, we do not represent warrant and/or guarantee that the integrity of this communication has been maintained or that it is free of errors, viruses, interception or interference.
I am coding a controlling job, and I need to run an sql statement several times depending on the list of values returned in a previous sql call.
eg. Select Variable1
from TableA
where status = PASS
I should receive a list of values back from the above command, for each row returned I would like to run the same sql:
eg.
For each returned value:
Select Variable2
from TableB
where Variable3 = TableA.Variable1
And I want to keep the two as separate sqls!
Does anyone know have an example of how a prepared sql statement works, and whether it would be appropriate to use it in this example?
Thanks
Wendy Voon
Consultant
Black Diamond
T e c h n o l o g i e s
Level 1, 6 Riverside Quay,
Southbank, Victoria, 3006.
E-mail: wendy.voon@bdt.com.au
Telephone: (03) 9698 - 7600
Facsimile: (03) 9698 - 7666
Web: http://www.bdt.com.au/
-------INTERNET E-MAIL CONFIDENTIALITY/DISCLAIMER--------
Privileged and confidential information may be contained in this e-mail. If you are not the intended recipient of this communication please delete and destroy all copies and kindly notify the sender by return e-mail. Recipients of this e-mail must not use, disclose or forward any information or attachments without express permission from Black Diamond Technologies.
Any views expressed in this communication are those of the individual sender except where the sender specifically states them to be the views of Black Diamond Technologies. Except as required at law, we do not represent warrant and/or guarantee that the integrity of this communication has been maintained or that it is free of errors, viruses, interception or interference.