I have a single SQL Query Worksheet open, and I have on that sheet something like the following:
Now, I'd like to, instead of having that first select statement copy/pasted a zillion times, assign it to a variable or a reference of some sort, so that I can have the query itself only in one place - thus any debugging or modifications of the query only have to be done once.
I would put the sql into a single class if this is all the sql you have. I usually put all sql into separate classes for each object type I need to persist in the database.
Joe, I believe SQL developer supports (nearly all of) the SQL*plus syntax, including the COLUMN command, which can be used to declare a variable:
This at least worked in my SQL Developer (version 3.0)
There may be other ways to define a variable (eg. the DEFINE command), but I'm not very well versed in them.