iraSenthil
iraSenthil

Reputation: 11577

PL/SQL Developer: How to find variable references?

In a Oracle package, How can I find out all the references for a variable? Like you would do it in Eclipse or Visual Studio.

Is this feature supported in any Oracle IDEs like TOAD, Sql Developer or PL/SQL Developer? I am using PL/Sql developer?

Upvotes: 2

Views: 6521

Answers (3)

William Robertson
William Robertson

Reputation: 16001

There is PL/Scope, but to be honest it's a bit of a beast and I've never tried it myself.

Of course you can search within the current package and see all occurrences highlighted, but that isn't ideal as a text search doesn't take scope into account and there could be more than one variable with the same name.

PL/SQL Developer's Refactor option can parse variable scope, so I don't see why it couldn't highlight all references in the current package at least. maybe you could propose it on the Allround Automations PL/SQL Developer forum and get one of marco's famous 'I have added this to the list of enhancement requests' answers. (Be sure to remind him about it with a follow-up post every 5 years or so.)

Upvotes: 1

Sireesh Yarlagadda
Sireesh Yarlagadda

Reputation: 13736

Two ways, you can find

1) hit the binoculars button

enter image description here

2) Using Query(Works for Oracle)

select * from ALL_SOURCE where text like '%some string%';

Upvotes: 1

In PL/SQL Developer I'd use the "Find Database Objects" tool (Tools menu, "Find Database Objects", or hit the binoculars button on the browser). Enter the text you want to find (e.g. the name of your variable) in the "Text to find" box, enter the schema name of the object you're interested in in the Owner box, and enter the package name you're interested in in the "Name" box. Select the objects types you want to search (Functions, Procedures, etc) and then click the Search button.

If you're interested in fully-qualified uses of a variable you can just enter something like SCHEMA_NAME.PACKAGE_NAME.VAR_NAME - or try PACKAGE_NAME.VAR_NAME for partially-qualified uses.

Share and enjoy.

Upvotes: 3

Related Questions