Can you "resolve constants" in TOAD?

In plsql developer there is a way to replace automatically

select my_package.my_constant from dual.

by this

select 2 /*my_package.my_constant*/ from dual.

This is call resolve contants. does this feature exist in TOAD?

Welcome to the Toad for Oracle community on ToadWorld!

To my knowledge, nothing yet in Toad for Oracle that resolves constants. What is the main use case for this? e.g. Testing? Are "constants" only resolved in the context of SELECTS involving DUAL?

Hello,

I have queries (big queries, not only select from dual) in a package. When the function using a query doesn't return the expected result, I copy the query, replace arguments, and replace the value of the package constant. The last step take a lot of time witout "resolve constant".

This isn't exactly what you are asking for, but one thing you can do to make this easier is select the SQL within your package and do a CTRL+Enter. Toad will comment out the parts from the package and put in variables instead. They'll be easy to spot. You can then replace the variables with literals, or just hit OK and then the variable dialog will appear and you can put values in there. The variable dialog will remember the values that you put in for the next time you run it.

image

When you resolve constants in plsql developer, can you just put in a big query, click the "resolve constants" button and automatically they are all replaced? Or do you select the constant yourself?

-John

Yes. I don't need to select the constant myself

For instance, I have this query:

select packageA.constantA from dual.

--------resolve constant--------->

select 0 /*packageA.constantA */ from dual

It works with big queries that have several constants too.

I see. And I guess these are private constants, declared in the body only? Otherwise, if they are in the spec and available to everyone, there is no need to resolve them, right? Because in that case, you could just use them in SQL w/o resolving.

SQL w/o =?

No theses constant are only in the spec.

If my sql is in a plsql block code. There is no problems.
For instance select package.constant into myvariable from dual;

But if want to make simple sql query. It doesn't work.
The runtime of sql and pl/sql are different.
The package constant are not recognized and the query fails.

oops, you're right. I was thinking that they could be used directly in SQL, I was mistaken.