Toad World® Forums

Comparing records never returns true.


#1

TYPE error_rectype IS RECORD (
sql_code NUMBER,
description NUMBER,
var1 VARCHAR2(500),
var2 VARCHAR2(500),
var3 VARCHAR2(500));

To determine if function has executed succesfully I want to check the error records values.

I have initalized the record in the initialization section:
e_RECORD.sql_code := 0;
e_RECORD.description := 0;
e_RECORD.var1 := null;
e_RECORD.var2 := null;
e_RECORD.var3 := null;

I have also created an are-elements-equal-function with this query (and Generate Code):
select 0 as sql_code, 0 as description, null as var1, null as var2, null as var3 from dual

I have gone through all the generated code and it seems correct.

The last rows in the function are:
error_record.sql_code := 0;
error_record.description := 0;
error_record.var1 := null;
error_record.var2 := null;
error_record.var3 := null;
logger.loginfo(‘Done’);
RETURN error_record;

logger writes to a table, so I know that I get all the way to the end of the function.
Still the test failes with the message “Record from program does not match expected record”, what am I doing wrong??

Big thanks in advance for any help…

What am I missing? I am using the latest Beta version of QCT.

I have a function that returns an error record, defined like this:


#2

First, Kristin (hopefully that is your name!), thanks so much for providing all this information. I was able to quickly construct a program and test definition that seemed to replicate your scenario.

Unfortunately, when I ran my test (on 1.8.3, which just became available on quest.support.com yesterday, by the way), it showed green.

So something else is going on - or this is a bug we fixed in 1.8.3 (though it was nothing we fixed intentionally so far as I know :slight_smile: ).

Next step? Please send a support bundle that includes this program (choose the program name in the SB wizard’s page) to steven.feuerstein@quest.com and hopefully I can sort it out from there.

Many thanks,
Steven


#3

Thanks!

I have now downloaded and upgraded to 1.8.4 and still the same result. There must be something I’m missing or have misunderstood.

I have also emailed a support bundle to you.

Kind Regards,
Kristina


#4

After a lot of testing with strange results we finally figured out what was wrong:

Another member of the team (not using Code Tester) had changed the clock on the server back and forth so the test results in Viewer for the “latest” test were actually for some test run earlier.

I.e. don’t forget to clear old test results if you’re manipulating with the clock at the same time and pay attention to the test timestamp…

A big thanks to Steven for helping me so much!
Kristina


#5

You are welcome, Kristin, though I wish I’d thought of that sooner. I have added an ER to allow you to specify that you only see results recorded by the currently connected user. That might help avoid this issue in the future.

SF