Toad World® Forums

Support for optional parameters?


#1

I was trying to test a function with an optional (defaulted) parameter. For example, the function is defined similar to:

FUNCTION setAttributes(Name IN VARCHAR2,
BeginDate IN DATE default sysdate) …

When I try to set up the test case to only pass in the first parameter, I get an error b/c BeginDate is required and CodeTester explicitly passes in NULL instead of just passing the first value.

Is there a way to exclude a parameter from the call?

Thanks,
Mitch


#2

Mitch, this is not currently possible. I expect to add this capability in 1.9, which will not be out for a while. So for now, you will need to provide that default value explicitly.

My apologies…SF


#3

Well, that’s how it goes in our business …
Thanks for the prompt reply.

BTW, I just installed version 1.8 and am very pleased with the
improvements over the last version we had (1.5). So far, so good.

Thanks,
Mitch


#4

I am glad to hear you like 1.8!

I feel we have come a VERY long way since 1.5…so it’s nice to hear that others agree!

SF


#5

Actually, if you click on Customize… in the Test Builder window, expand the “-- Execute this code instead of the generated execution code” section and add something like this it should work:

q##function_return_value := setAttributes(name => i_p_name);


#6

Great point, Thomas! I love it when users come up with solutions I did not think of.

Now, the only thing you have to watch out for is that once you choose to provide your own execution code, any changes we make in our scripts - or in your parameter list, more to the point, will have to be maintained by YOU!

By the way, I hope to publish a beta of 1.9 with a few weeks that will include the ability to specify “Use default value”.

Regards, SF