I created a report in TOAD but I need to set a variable in the query. I modified my code and it executed fine in the MySQL backend, but when I edit the data section of the report and add the same code, it gives me an error and keeps my set statement and erases all code associated with the select statement that built the report.
I know you can in MySQL:
set @variable = 1;
select * from table
where value = @variable;
all at the same time but not letting me in TOAD report...any help or ideas?
The Data Reports use single SQL statements and not blocks of code where params might be defined.
To use a variable in Toad Data Reports, bind to the variable using a colon. When executing you will be prompted to enter the bind value.
When using a bind var in Automation you will need to use a Set Variable activity and define a variable with the same name as the var you used in your query. I am not sure if you want to automate this report but I thought I would add that.