Dynamic Variable in TOracleScript?

tremors

Member
I am trying to write an SQL query that will update a table based on a dynamic variables value declared in Delphi.

My first question is if there is any other component that allows an SQL update query to be executed and then to commit the changes to the table.

My second question is how would I use a dynamic variables value from Delphi to update a record/s.

I want to execute the TOracleScript SQL based on the value of the dynamic variable from Delphi. What is the correct format to use the dynamic variable from in the script?
 
Originally posted by tremors:
My first question is if there is any other component that allows an SQL update query to be executed and then to commit the changes to the table.
You can execute a PL/SQL Block in a TOracleQuery or TOracleDataSet:
Code:
begin
  update emp set sal = sal * 1.01 where job = 'manager';
  update emp set sal = sal * 1.02 where job != 'manager';
  commit;
end;
Originally posted by tremors:
My second question is how would I use a dynamic variables value from Delphi to update a record/s.

I want to execute the TOracleScript SQL based on the value of the dynamic variable from Delphi. What is the correct format to use the dynamic variable from in the script?
If you are using a TOracleScript you can use substitution variables, and pass the values to the script by using TOracleScript.SetVariable.

If you are using a TOracleQuery or TOracleDataSet you can use bind variables or substitution variables (see the Variables topic in the help file for details).

[This message has been edited by mkalter (edited 05 March 2003).]
 
I have my query working now with TOracleScript but when I set my variables with TOracleScript.SetVariable it takes over a minute to execute the query. When I replace the variable with a value it takes half a second to execute the same query. Why would this be happening? Is there a more effecient way to run the query or am I leaving out part of the code somewhere?

Thank you for the help! I really appreciate your fast response.
 
I ended up using a DataSet to run the query and it worked like a charm. I really appreciate all your help and how fast you respond to the questions.
Thanks Again!
 
Back
Top