Using PL/SQL region in Oracle Application Express
Submitted by dave on Thu, 10/02/2008 - 14:05
I'm still an Application Express beginner -- I'm used to web development that is closer to the HTML. While I am getting used to Apex's Regions and Templates sometimes you just need to build some HTML on your own. I have found some Apex helper functions that can help you whip up an anonymous PL/SQL block that can generate this.
In Apex, add a "PL/SQL" region. You will get a blank textbox where you can enter some PL/SQL code. If you have the Demo application installed you can try this out:
Oracle® Database PL/SQL Packages and Types Reference - HTP : here
DECLARE mystring VARCHAR2(80); BEGIN FOR c1 in (SELECT CUST_FIRST_NAME || CUST_LAST_NAME as CUSTNAME FROM DEMO_CUSTOMERS ORDER BY 2, 1) LOOP -- Output text for this entry htp.p('If you want to get fancy and say ...highlight a search term... pass in a Page Item called P_SEARCH_TEXT:'); htp.p(mystring); htp.p(''); END LOOP; END;
DECLARE mystring VARCHAR2(80); BEGIN FOR c1 in (SELECT CUST_FIRST_NAME || CUST_LAST_NAME as CUSTNAME FROM DEMO_CUSTOMERS ORDER BY 2, 1) LOOP -- Highlight search term mystring := REPLACE(c1.CUSTNAME, '&P_SEARCH_TEXT.', '<b>&P_SEARCH_TEXT.</b>); -- Output text for this entry htp.p('Application Development Guide - Generating HTML Output with PL/SQL : here'); htp.p(mystring); htp.p(''); END LOOP; END;
Oracle® Database PL/SQL Packages and Types Reference - HTP : here