Toad World® Forums

Outcome : QUERY and SINGLEVALUEQUERY


#1

Hi there,

Please share some working sample to understand usage of QUERY and SINGLEVALUEQUERY.

Regards,

Amol


#2

Hi Amol,

you have a working example of SingleValueQuery in your other thread: http://www.toadworld.com/products/Code-Tester/f/71/t/23954.aspx.

Regarding the Query usage, we could guess: From the proposed test types and expected result types, there are several designed usages and the tests could be composed several different ways. If you are interested, I could present one of possible cases.

Let’s create a procedure that is inserting a new record to a table T_FIELD_MOD. The procedure takes the new field values as an input.

PROCEDURE prc_insert (row_values IN T_FIELD_MOD%ROWTYPE)
IS
BEGIN
INSERT INTO T_FIELD_MOD
VALUES (row_values.ID, SYSDATE, row_values.ADDITIONAL_DATA);

  COMMIT;

END;
Then let’s pretend we would like to test, whether a procedure call was successful and the new record is actually present in the table. We need to specify values

Then for the outcome test, we need to specify that no exception was raised and then test a query using the input values and a knowledge what values should be present in the database:

Best regards,

Ferdinand


#3

I would like to add that I can imagine a more complex procedure inserting lots of records from a table to a backup table or a batch insertion… For such purposes I might find useful another comparison using TABLE and QUERY:

table_test.png

Best regards,

Ferdinand