Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: ///// HELP HELP. Enter - Query mode \\\\\
Arn Nguyen <s337202_at_student.uq.edu.au> writes:
> Is it possible to be in Enter-Query and then have that field assign to a
> particluar value and then Eexecute it.
>
> What I am trying to do is when you first enter in a particular form
> called from another form, I want it automatically execute a query based
> on the global variable that I brought in. But I can't seem to achieve
> it.
>
> Please email
>
> s337202_at_student.uq.edu.au
>
> -Arn Nguyen
No, that isn't what Enter Query mode is for -- Enter Query presents a QBE (Query-By-Example) framework for entering a value or criterion and asking for all the rows for which the value matches or the criterion evaluates to true.
What you want (correct me if I'm wrong) is to bring in a variable from the outside world (say, as an environment variable passed through a shell script or batch file to a form parameter, or something you computed based on a parameter and stored in a global variable) and use it to modify or constrain the base query executed by a block. Right?
If so, then you could do that by setting up your block query to fetch all possible tuples (rows). If you have additional information you want to use to restrict the rows fetched, you can use the DEFAULT_WHERE block property to add, modify, or delete a WHERE clause to the baseline block query. To do this, you'd call SET_BLOCK_PROPERTY and specify that DEFAULT_WHERE is the property you want to set.
There are two forms (see your help screen or RTFM for more details):
SET_BLOCK_PROPERTY(block_id, property, value);
SET_BLOCK_PROPERTY(block_name, property, value);
In this case the property is DEFAULT_WHERE, and the "value" is your WHERE clause (you need not include the actual word, "WHERE") enclosed in single quotes ('). You can also do this with ORDER_BY as well.
So, you might have something like...
SET_BLOCK_PROPERTY('MYBLOCK', DEFAULT_WHERE, ':GLOBAL.COMMISSION > 1000'); or, if you have a MYBLOCK_ID...
IF NOT ID_NULL(MYBLOCK_ID) THEN
SET_BLOCK_PROPERTY(MYBLOCK_ID, DEFAULT_WHERE, '')
[...]
END IF;
(The above deletes the previously-set WHERE clause.)
Hope this helps.
Karla Johnson * Sr. Software Engineer | #ifdef EMPLOYED Syseca Inc. * Marina del Rey, CA | #include <std_disclaimers.h> kgj_at_syseca-us.com | #endifReceived on Thu Oct 02 1997 - 00:00:00 CDT