Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> SQL Power !!
Here is what was caught by my co-worker recently.
One of the Developers, of our Preferred Vendor, actually wrote this stuff.
This is invoked by the one of the forms on the intranet Web application. I was told there are quite a few scripts like this one.
Performance issues? No one is complaining (yet) .... so who cares :)
Enjoy...
- Kirti
SELECT DISTINCT CUST1.customer_id, LIST1.finding_name, NVL(LIST1.atn_npa, ' '),
NVL(LIST1.atn_cop, ' '), NVL(LIST1.atn_line_no, ' '), LIST1.lni, NVL(LIST1.listed_tn_npa, ' '), NVL(LIST1. listed_tn_cop, ' '), NVL(LIST1.listed_tn_line_no, ' '), NVL(ADDR1.house_no, ' '), NVL(ADDR1.house_no_suff, ' '), NVL(ADDR1.pre_directional, ' '), NVL(ADDR1.street_name, ' '), NVL(ADDR1.post_directional, ' '), NVL(ADDR1.sub_location, ' '), NVL(ADDR1.Community, ' '), NVL(ADDR1.zip_five, ' '), NVL(ADDR1.state_abbr_override, ' '),LIST1.listing_status, NVL(CUST1.customer_type, ' '), NVL(CUST1.home_data_base, ' '),
NVL(CUST1.default_market_code, ' '), NVL(TELCO.TELCO_CODE, ' '), NVL(TELCO.TELCO_NAME, ' '), NVL(TO_CHAR(LIST1.establish_date,'YYYYMMDD'),' '), NVL((select 'Y' from query q, dir_curr_issuewhere q.customer_id = cust1.customer_id
and q.query_status in (1,3,4) and q.product_code = dir_curr_issue.directory_code and q.product_issue_num >= dir_curr_issue.directory_issue_numand rownum = 1), 'N' ) ,
NVL(CUST1.TELCO_CREDIT_STOP, ' '), NVL(CUST1.BARS_CREDIT_STOP, 0), NVL(CUST1.EAST_CREDIT_STOP, ' '), NVL(CUST1.EARLY_CONT_CUST_IND, ' '), NVL(LIST1.SOHO_LST_IND, ' '), NVL(CUST1.NI_AMOUNT, 0), NVL(CUST1.PI_AMOUNT, 0),HEADING.short_heading_name,
and DIRECTORY_SUMMARY0.product_code = DIR_CURR_ISSUE0.directory_code and DIRECTORY_SUMMARY0.product_issue_num = DIR_CURR_ISSUE0.directory_issue_num and DIRECTORY_SUMMARY0.PRODUCT_CODE = E.DIRECTORY_CODE and DIRECTORY_SUMMARY0.PRODUCT_ISSUE_NUM = e.directory_issue_numand e.directory_del_ind != :1
and DIRECTORY_SUMMARY0.canvass_code = '' and DIRECTORY_SUMMARY0.T_SPLIT_ASSIGN_ID = ASSIGNMENT_T.assignment_id (+) and DIRECTORY_SUMMARY0.current_assign_id = ASSIGNMENT_C.assignment_id (+)AND :2 in (ASSIGNMENT_C.sales_rep,ASSIGNMENT_T.sales_rep)) ,(CASE WHEN EXISTS( SELECT 1
CUST1.customer_id = DS.customer_id AND DS.product_code = DC.directory_code AND DS.PRODUCT_ISSUE_NUM >= DC.DIRECTORY_ISSUE_NUMAND DS.curr_special_flag = 20 and rownum = 1) THEN 'Y'
AND IC.PRODUCT = DIR1.product_code AND IC.issue_number = DIR1.product_issue_num AND IC.DELETE_INDICATOR ='N' )
CUST1.main_main_listing_id = LIST1.listing_id(+) AND LIST1.last_version_ind(+) = :5 AND LIST1.listed_address_id = ADDR1.address_id(+) AND TELCO.TELCO_CODE = LIST1.TELCO_ID AND DIRECTORY_SUMMARY.customer_id = CUST1.customer_id ANDDIRECTORY_SUMMARY.PRODUCT_CODE = DIR_CURR_ISSUE.DIRECTORY_CODE AND DIRECTORY_SUMMARY.PRODUCT_ISSUE_NUM >= DIR_CURR_ISSUE.DIRECTORY_ISSUE_NUM AND ASSIGNMENT.SALES_REP = :6 AND
AND DS.PRODUCT_CODE = DC.DIRECTORY_CODE AND DS.PRODUCT_ISSUE_NUM >= DC.DIRECTORY_ISSUE_NUM AND DS.T_SPLIT_ASSIGN_ID = ASSIGNMENT_T.assignment_id (+) AND DS.current_assign_id = ASSIGNMENT_C.assignment_id (+)AND :7 in (ASSIGNMENT_C.sales_rep,ASSIGNMENT_T.sales_rep) AND DS.RETIREMENT_STATUS!= :8 ) AND
NVL(LIST1.atn_cop, ' '), NVL(LIST1.atn_line_no, ' '), LIST1.lni, NVL(LIST1.listed_tn_npa, ' '), NVL(LIST1. listed_tn_cop, ' '), NVL(LIST1.listed_tn_line_no, ' '), NVL(ADDR1.house_no, ' '), NVL(ADDR1.house_no_suff, ' '), NVL(ADDR1.pre_directional, ' '), NVL(ADDR1.street_name, ' '), NVL(ADDR1.post_directional, ' '), NVL(ADDR1.sub_location, ' '), NVL(ADDR1.Community, ' '), NVL(ADDR1.zip_five, ' '), NVL(ADDR1.state_abbr_override, ' '),LIST1.listing_status, NVL(CUST1.customer_type, ' '), NVL(CUST1.home_data_base, ' '),
NVL(CUST1.default_market_code, ' '), NVL(TELCO.TELCO_CODE, ' '), NVL(TELCO.TELCO_NAME, ' '), NVL(TO_CHAR(LIST1.establish_date,'YYYYMMDD'),' '), NVL((select 'Y' from query q, dir_curr_issuewhere q.customer_id = cust1.customer_id
and q.query_status in (1,3,4) and q.product_code = dir_curr_issue.directory_code and q.product_issue_num >= dir_curr_issue.directory_issue_numand rownum = 1), 'N' ) ,
NVL(CUST1.TELCO_CREDIT_STOP, ' '), NVL(CUST1.BARS_CREDIT_STOP, 0), NVL(CUST1.EAST_CREDIT_STOP, ' '), NVL(CUST1.EARLY_CONT_CUST_IND, ' '), NVL(LIST1.SOHO_LST_IND, ' '), NVL(CUST1.NI_AMOUNT, 0), NVL(CUST1.PI_AMOUNT, 0),HEADING.short_heading_name,
and DIRECTORY_SUMMARY0.product_code = DIR_CURR_ISSUE0.directory_code and DIRECTORY_SUMMARY0.product_issue_num = DIR_CURR_ISSUE0.directory_issue_num and DIRECTORY_SUMMARY0.PRODUCT_CODE = E.DIRECTORY_CODE and DIRECTORY_SUMMARY0.PRODUCT_ISSUE_NUM = e.directory_issue_numand e.directory_del_ind != :13
and DIRECTORY_SUMMARY0.canvass_code = '' and DIRECTORY_SUMMARY0.T_SPLIT_ASSIGN_ID = ASSIGNMENT_T.assignment_id (+) and DIRECTORY_SUMMARY0.current_assign_id = ASSIGNMENT_C.assignment_id (+)AND :14 in (ASSIGNMENT_C.sales_rep,ASSIGNMENT_T.sales_rep)) ,(CASE WHEN EXISTS( SELECT 1
CUST1.customer_id = DS.customer_id AND DS.product_code = DC.directory_code AND DS.PRODUCT_ISSUE_NUM >= DC.DIRECTORY_ISSUE_NUMAND DS.curr_special_flag = 20 and rownum = 1) THEN 'Y'
AND IC.PRODUCT = DIR1.product_code AND IC.issue_number = DIR1.product_issue_num AND IC.DELETE_INDICATOR ='N' )
CUST1.main_main_listing_id = LIST1.listing_id(+) AND LIST1.last_version_ind(+) = :17 AND LIST1.listed_address_id = ADDR1.address_id(+) AND TELCO.TELCO_CODE = LIST1.TELCO_ID AND DIRECTORY_SUMMARY.customer_id = CUST1.customer_id ANDDIRECTORY_SUMMARY.PRODUCT_CODE = DIR_CURR_ISSUE.DIRECTORY_CODE AND DIRECTORY_SUMMARY.PRODUCT_ISSUE_NUM >= DIR_CURR_ISSUE.DIRECTORY_ISSUE_NUM AND ASSIGNMENT.SALES_REP = :18 AND
AND DS.PRODUCT_CODE = DC.DIRECTORY_CODE AND DS.PRODUCT_ISSUE_NUM >= DC.DIRECTORY_ISSUE_NUM AND DS.T_SPLIT_ASSIGN_ID = ASSIGNMENT_T.assignment_id (+) AND DS.current_assign_id = ASSIGNMENT_C.assignment_id (+)AND :19 in (ASSIGNMENT_C.sales_rep,ASSIGNMENT_T.sales_rep) AND DS.RETIREMENT_STATUS!= :20 ) AND
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Deshpande, Kirti INET: kirti.deshpande_at_verizon.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-LReceived on Fri May 09 2003 - 11:21:44 CDT
(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing).