Ctrl_Click on a constant in a case statement doesn't work in a SQL Window

Roeland

Member³
Package:

Code:
create or replace package TEST_CONS is

  MY_CONSTANT constant number := 0;

end TEST_CONS;
/
create or replace package body TEST_CONS is

end TEST_CONS;
/

SQL Window/Explain Plan Window:

Code:
select (case p_In
          when Test_Cons.MY_CONSTANT then 'Ok'
        end)
from Dual t;

select Test_Cons.MY_CONSTANT into Dummy
from Dual t;

Ctrl_Click on the first Test_Cons.MY_CONSTANT doesn't work, but doing the same on the second does work.

PL/SQL Developer 9.0.6.1665
PL/SQL Developer 10.0.0.1687 (Beta6)

PS: Note that both will not run, but I was changing constants.
PPS: By the way, what is the easiest way to replace constants when copying code from packages?
 
SQL Window/Explain Plan Window:

Code:
select Test_Cons.MY_CONSTANT,
  (case p_In
     when Test_Cons.MY_CONSTANT then 'Ok'
   end),
  Test_Cons.MY_CONSTANT
from Dual t;

select Test_Cons.MY_CONSTANT into Dummy
from Dual t;

It's even a bit stranger. Notice that only the fourth occurence works when you Ctrl_Click the constants. When the constant is inside a case statement, it seems that it blocks the others to work.

Ctrl_Click works inside a package though.
 
Ctrl_Click on the first Test_Cons.MY_CONSTANT doesn't work, but doing the same on the second does work.
We'll fix it.

PPS: By the way, what is the easiest way to replace constants when copying code from packages?
What exactly do you mean by "replace constants"?
 
What exactly do you mean by "replace constants"?

When I have a piece of SQL that was copied from a package into a SQL Window, there are a lot of constants defined in it, but this SQL won't execute until all the constants are replaced by there numerical value.

For example:
Code:
select Test_Cons.MY_CONSTANT,
  (case p_In
     when Test_Cons.MY_CONSTANT then 'Ok'
   end),
  Test_Cons.MY_CONSTANT
from Dual t;

should be replaced to
Code:
select 0,--Test_Cons.MY_CONSTANT,
  (case p_In
     when 0 then 'Ok'--Test_Cons.MY_CONSTANT then 'Ok'
   end),
  0--Test_Cons.MY_CONSTANT
from Dual t;

I see 2 options:
- There is some way to automatically replace all constants with there numerical value
- or, even better, you allow the use of constants in a SQL Window, and replace/resolve them when executing the SQL

What do you think? Does this makes sense?
 
Back
Top