Toad World® Forums

How do I assign an input variable using a select statement?


#1

I am testing a delete procedure, one of the input parameters is the date the record was created. I was planning on inserting a new record using my insert procedure. Then I would assign the date/time from the record I just inserted for the input variable. (I hope I am being clear).

How would I do this?


#2

Todd,

So…in the initialization section for your test case you will write an insert statement, correct? Then you want to use a value from that row as the input value (I assume this means one of your IN arguments in your program).

OK…there are two ways to do this:

  1. Put the select statement inside a function. This function could be placed in the Declare Programs custom section for the test case, or compiled independently. Then open up the Properties window for that input, check the Evaluate as an expression, and type in the call to that function in the window.

  2. OK, you don’t want to write a function. Fine! Still, open up the Properties window for your input. Notice the name of the variable, such as l_string_in. Put the query in the test case initialization and populate this variable. Example:

select ‘abc’ into i_STRING_IN from dual;

Then save your test case. Final step: from within the Test Editor, drill down to that input and check the Set in Initialization code box. Code Tester will then use the value set by the query in the call to the program.

Yes, it should be easier – and it will be in the commercial release in Feb 2007!

Hope that helps, SF


#3

Got it!

Thanks

Todd


#4

Hi, I had most of my test cases set up according to Bullet # 2. I upgraded to 1.6 today and I find that the “Set in Initialization code box” is no longer there. Please explain what is the way by which I can assign an input variable using a select statement.

Thanks!


#5

We changed the text of that label to identify more explicitly what it is doing. It is now:

“Declare variable and use it in call to program”

SF