Eureka!

Sitting in a meeting this evening, listening to the conversations whilst the brain was free-wheeling, the solution to an old problem that occasionally flopped on to my memory banks occurred.

Problem:
select app_refno as “Application Reference”
, initcap( app_corr_name ) as “Application Name”
, initcap( rli_description ) as “List”
, initcap( lst_description ) as “List Status”
, initcap( par_per_title ) as “Title”
, initcap( par_per_forename ) as “Forename”
, initcap( par_per_surname ) as “Surname”
, par_per_date_of_birth as “DOB”
, trunc( months_between( sysdate, par_per_date_of_birth ) / 12 ) as “Age”
, Q.lar_description as “Area_Choice”
from applications
, applic_list_entries
, rehousing_lists
, involved_parties
, parties
, list_statuses l
, (
select distinct laa_app_refno
, a2.lar_code
, a2.lar_description
from lettings_area_answers
, lettings_areas a1
, lettings_areas a2
where laa_lar_code = a1.lar_code
and a1.lar_lar_code = a2.lar_code
) Q
where app_refno = ale_app_refno
–and app_refno in (38, 23)
and ale_rli_code = rli_code
and rli_current_ind = ‘N’
and rli_code in (‘HR’, ‘TR’)
and ipa_app_refno = app_refno
and ipa_par_refno = par_refno
and ale_lst_code = lst_code
and ale_lst_code in (‘LIVE’)
and ipa_main_applicant_ind = ‘Y’
and trunc( months_between( sysdate, par_per_date_of_birth ) / 12 ) >= 60
and app_refno = Q.laa_app_refno (+)
order by app_refno
, Q.lar_code

Solution?
Right there in Line 30 ‘N’ should be ‘Y’.

Der.

At least my brain didn’t wake me at 03.00 to tell me, it did it while I was still conscious. Yay for brain. Boo for brain for even thinking about this stuff though.

I mean, it’s hardly important. 🙂

B.

3 thoughts on “Eureka!

  1. Speaking as an IT numpty, I can only say that that must have been the Mother of all boring meetings for you to be able to seek joyous escape amongst that quagmire of numbers.

    Personally in similar situations my mind tends to wander to Ancient Rome where I imagine myself to be sprawled on a Zebra hide whilst semi-naked Carthaginian virgins feed me grapes and blancmange whilst the person currently whittering on in said meeting is having angry army ants rammed down his toga.

  2. SG: It’s the PL/SQL that should have (but failed to) generate the answer to a particular question I wanted to ask. I didn’t have the time to sit down and debug it properly; it was a housekeeping exercise not a performance request.

    Harry: I’m loving your version of dreamland. The meeting was awful. Necessary but awful; non-business people, though well-intentioned, shouldn’t try to run things.

Comments are closed.