ba6.us - Dave's Database Related Stuff

  • home
  • blog
  • notes
  • projects
  • recent
  • about
  • !
Home › Blogs › dmann's blog

Tag Cloud

apex data development export funnies Hint HTML import linux monitoring oem oracle performance perl pl/sql reporting rman scripting solaris sql sqlplus tuning unix windows
more tags

Search

RSS Feed

Blog Posts :

Navigation

  • Feed aggregator

User login

  • Request new password

Using PL/SQL region in Oracle Application Express

dmann — Thu, 10/02/2008 - 13: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:
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('
'); htp.p(mystring); htp.p('
'); END LOOP; END;
If you want to get fancy and say ...highlight a search term... pass in a Page Item called P_SEARCH_TEXT:
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('
'); htp.p(mystring); htp.p('
'); END LOOP; END;
Application Development Guide - Generating HTML Output with PL/SQL : here
Oracle® Database PL/SQL Packages and Types Reference - HTP : here
  • apex
  • oracle
  • dmann's blog


Cornify
  • home
  • blog
  • notes
  • projects
  • recent
  • about
  • !

Content Copyright 2006-2010. Links are copyright of respective owners.