Who's Online
0 registered (), 3 Guests and 5 Spiders online.
Key: Admin, Global Mod, Mod
Recent Posts
Update EIT in SSHR
by Sahir
03:45 PM
End of Year Legislation Patch for 11i
by delboy
01:35 PM
Interfacing iRec and external sites
by DanC
11:42 PM
Capturing, Storing, & Paying Banked Overtime
by Paul
08:51 PM
Time and Labour & Oracle Projects
by Paul
07:34 PM
Search Engine Optimizers
by delboy
01:30 PM
Abseces in oracle hrms, super user: how to do I:
by JayTee
07:26 AM
Function for getting retropay-maintained balances
by CT
08/02/12 12:21 PM
Grade End Date
by Chris
03/02/12 10:46 AM
OLM Mandatory Enrolments
by bcooper
01/02/12 12:23 PM
Top Posters (30 Days)
CT 26
delboy 25
bcooper 15
Sahir 5
Gus 5
tovia123 4
Tim Bailey 3
christm 3
SBi 3
Simon_Mc 3
(Views)Popular Topics
Family Pack K issues thread 18216
CREATE_GRADE api returns:PLS-00306: wrong number o 13757
Still trying to locate... 12193
Creating hr jobs ORA-20001: HR_289477_JOB_GROUP_ID 10646
Viewing Output of another user 9131
HR_PF.K RUP4 8841
Review of my Release 12 laptop 8494
Adding a taskflow button to a form 7855
Enhanced Retro & Release 12 7679
Family Pack K 7116
Topic Options
Rate This Topic
#936 - 16/03/05 05:29 PM Janet & John do clever forms queries
CT Online   content
Guru
***

Registered: 11/03/05
Posts: 1080
Loc: Bath
A real rave from the grave this one! Back in 1997 - but note the addendum...

A little reminder that it is possible to enter some quite clever queries via Oracle Forms. There are 3 distinct methods -
1. inequalities method
2. the '#' method
3. the 'substitution' or '&' method.

Note that this is not an Oracle Apps feature; rather it is a Forms feature

Inequalities method

Within a form, say People form: Enter a query. Within a chosen field enter either '>', '<', or '!=' followed by the actual value - meaning 'greater than', 'less than', or 'not equal to' the value. E.g:

In the date of birth field enter >31-DEC-1979 to return all records with a date of birth later than that date

'#' Method

Within a form say People form: Enter a Query and within your chosen field put '#' followed by a simple 'where' clause - although without the word 'WHERE'. E.g:

In the date of birth field enter

#IS NULL

When the query is executed, lo and behold all the records are returned with a null date of birth

Similarly entering

#BETWEEN '<date1>' AND '<date2>'

will return records where the date of birth falls between the 2 entered dates

You can also try using things like #IN ('x', 'y', 'z')

'&' Method

The restriction with the # method is the enter-able field size - if it's short you may not be able to fit the word 'BETWEEN' in there! A more versatile way is to use the '&' method. In query mode choose a field and enter the text '&x', or '&q' or '&dave' which ever suits you really! (what matters is the '&'). Then execute the query. A window entitled 'Query Where...' opens and you may then enter your full sql query before you hit <enter>. Again no 'WHERE' word is needed E.g the query text might read:

date_of_birth IS NULL and current_employee_flag = 'Y'

ADDENDUM

Nowadays this ability to perform '&' queries has by default been restricted. However, it can be turned back on. Get your friendly DBA to set the Unix parameter FORMS60_RESTRICT_ENTER_QUERY to FALSE then bounce the listener at a convenient point and you'll be back in business.


Edited by CT (19/08/10 01:19 PM)
Edit Reason: Make original post more readable
_________________________
L&K
CT

Remember: A dog is for life, not just for Christmas... unless you're in Korea

Top
#5670 - 19/08/10 12:58 AM Re: Janet & John do clever forms queries [Re: CT]
MarinaH Offline
nothin' better to do

Registered: 21/08/05
Posts: 110
Loc: Away with the fairies
Thanks to Janet and John for helping me out this morning!!

I have tried the .#BETWEEN on the birth date in one of the folders and am getting an error that a right parenthesis is missing!

Could it be because I am using a wild card in the dates? e.g. between '01-AUG%' AND '30-AUG%' I have tried using brackets in the query in various places, but the same error is appearing.

Any help would be greatly appreciated.

Top
#5673 - 19/08/10 06:03 AM Re: Janet & John do clever forms queries [Re: MarinaH]
bcooper Offline

Guru
*****

Registered: 11/03/05
Posts: 1095
Loc: Earth, Europe, England, here
Lordy! This must take an award for resurecting the oldest post on the forum!

To the subject at hand....I'm not sure the wildcard would work with date fields, as there is an implicit conversion that takes place to convert the date into the internally stored format in order to execute the query - providing a partial wildcard on the date may cause grief.
Have you tried supplying the whole date as a test?
_________________________
HCM Aces is for sale! Please contact me if you are interested.
Also my random musings courtesy of Twitter

Top
#5674 - 19/08/10 06:23 AM Re: Janet & John do clever forms queries [Re: bcooper]
MarinaH Offline
nothin' better to do

Registered: 21/08/05
Posts: 110
Loc: Away with the fairies
Hi Baz,

Yes apologies, I did dust of a few cobwebs!!

The query did work when I entered the date as a whole. Thinking more about it, I suppose it was asking alot to use the wildcards in that instance!!

Will try an alternative method for that particular query.

Take care

Top
#5675 - 19/08/10 08:34 AM Re: Janet & John do clever forms queries [Re: MarinaH]
CT Online   content
Guru
***

Registered: 11/03/05
Posts: 1080
Loc: Bath
Blimey, someone open a window, all the dust in here is choking!

If you wanted to find anyone with a DoB in August, then the following seems to work:

#LIKE '%AUG%'

No idea why though!

PS. You don't even need the like bit, as of course that's the condition by default anyway! ie just enter '%AUG%' in the DoB field and execute the query.
_________________________
L&K
CT

Remember: A dog is for life, not just for Christmas... unless you're in Korea

Top
#5679 - 19/08/10 12:04 PM Re: Janet & John do clever forms queries [Re: CT]
PeterP Online   sleepy
hacker
*****

Registered: 08/03/07
Posts: 92
Loc: Manchester, UK
I understood Oracle had disabled this functionality in Apps as a security risk in 11.5 onwards. Certainly, I haven't managed to utilise the "&" functionality in any environment for a long time. There was some indication of a profile option to enable or disable it, but that never seemed to work either. Does the "&" now work again? Or, have I been reliably misinformed in the past?

I was unaware of the "#" option, so this is a handy hint/reminder.

Cheers.


I just read the rest of the first post. DOH!!! Re. the comment about the DBA option, I do remember this now, rather than it being a profile option; but as I mentioned, I have never managed to get this to work.


Edited by PeterP (19/08/10 12:08 PM)

Top
#5681 - 19/08/10 01:01 PM Re: Janet & John do clever forms queries [Re: PeterP]
CT Online   content
Guru
***

Registered: 11/03/05
Posts: 1080
Loc: Bath
Strangely enough, me neither! Although I have seen for myself today that the unix env variable FORMS60_RESTRICT_ENTER_QUERY still exists, albeit set to TRUE.

The '#...' trick does indeed still work, subject to the restrictions of field query size. Also, it does not allow compound 'where' clauses, e.g. #LIKE '%AUG%' AND... the 'AND' bit triggers the same message as that encountered if you try the '&x' query.

Edited to PS: Having just done a search for that parameter, it seems that the switching off was in response to a SQL injection vulnerability:

http://www.red-database-security.com/wp/sql_injection_forms_us.pdf

_________________________
L&K
CT

Remember: A dog is for life, not just for Christmas... unless you're in Korea

Top
#5683 - 19/08/10 01:22 PM Re: Janet & John do clever forms queries [Re: CT]
PeterP Online   sleepy
hacker
*****

Registered: 08/03/07
Posts: 92
Loc: Manchester, UK
I have a VERY vague memory that there is a second env variable involved, but no clue as to what it was. However, even then, it didn't work. I did quite a few tests on this back in the dim distant past, as I used the "&" function all the time, especially to control ordering in forms where Oracle seems to have no sequence at all, and was quite disappointed that it's functionality had disappeared.

If anyone figures out how to get it working again, It would be great to learn how.

Cheers,

Peter.

P.S. I have just used #IS NULL in the Approved Salary field of the Salary Management form, and it didn't work. Although, I did use a #xxx query in another Folders based form and it did work.

Is this a form specific option?


Edited by PeterP (19/08/10 01:25 PM)

Top
#5684 - 19/08/10 01:48 PM Re: Janet & John do clever forms queries [Re: PeterP]
CT Online   content
Guru
***

Registered: 11/03/05
Posts: 1080
Loc: Bath
I agree we lost a significant weapon in our diagnostic armoury with the switching off of this parameter - I think they could have done more to restrict the execution of more damaging stuff like pl/sql, and left the true querying bit.

PS I too have the same problem on that form - having said that, I am having difficulties getting any kind of restriction to work based on criteria entered in the 'Approved Salary' field, so I don't think it's an issue to do with the '#' per se.
_________________________
L&K
CT

Remember: A dog is for life, not just for Christmas... unless you're in Korea

Top
#5688 - 19/08/10 11:45 PM Re: Janet & John do clever forms queries [Re: CT]
MarinaH Offline
nothin' better to do

Registered: 21/08/05
Posts: 110
Loc: Away with the fairies
Yes, apologies, my initial example was a bit rubbish!!

The # function has proved to be a bit tempremental depending on the length of the field that you're using. For example, if you wanted to select some employees from the people folder using the #IN on the employee number field, you're restricted to a certain number of characters so can only query two employee numbers at a time....

Anyway, we've been able to provide the users with the ability to do what they need, so thanks for the help.


Edited by MarinaH (19/08/10 11:49 PM)

Top



Moderator:  CT 
Forum Stats
756 Members
48 Forums
1517 Topics
7286 Posts

Max Online: 63 @ 24/11/10 07:21 AM
Today's Birthdays
No Birthdays
Recent vacancies
Tea boy available 4 basic chores & some! services
by Simon_Mc
19/01/12 03:59 PM
Top Posters
bcooper 1095
CT 1080
delboy 500
Geoff Dixon 369
SBi 344
vkumar 223
kp_rapolu 213
cbrookes 197
Gavin Harris 160
Gus 132
February
Su M Tu W Th F Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29