Dynamic page size

Hi,
I need to run the same RTF template for US and Europe.
The only difference is page size.
US is using "Letter" page size, Europe is using "A4" page size.
I can distinguish the page size by organization.
Is there a way that I can have one template with dynamic page size, or I have to have two different templates?
Thanks,
karmit

When the data is generated, can you determine who it is for (letter-sized or otherwise)? Once you pick off a value that identifies the page size, you can let a variable for lines per page (see the fixed lines per page example on Tim's blog) and base the page break on the paper size.

Similar Messages

  • Change report page size dynamically -URGENt

    Hi,
    I am developing one report for super market, and as per the req. of super market I want to control the page size during the runtime only.
    Pleas help me regarding this.
    Thanns in advance.
    Sharad

    You can't actually change the page size.
    But there are some things may help in this respect.
    In the report layout you can have some frames that include different layouts for the same data and print those frames conditionally.
    Or you may use two different .rdf for two different page sizes.

  • Dynamically set the page size of a pagenated table

    What is the function to change the page size (i.e. number of rows in a page) of a pagenated table?
    Thanks in advance

    sorry, the problem has been solved.
    the method is in tableRowGroup.

  • Issue in customizing ESS Dynamic Page

    Hi All,
    I am working on Customization of ESS portal.
    I am able to build and deploy application successfully .We are able to customize Detail View.
    Problem Here is , I am Supposed to modify in BIzcard Iview which is a dynamic page.
    Can any body help in understanding  how data is fetched in bizcard iview and  where the logic is to  be added to modify the page (in which method).
    Any pointer related to dynamic Customization of ESS portal is appreciated.

    Thank You staurt.
    I also got the SdnTechEd Documnet now. Was going through that.
    It Tells about the creation of Std Package.
    I need quick help  on my first Change . I.e
         for (int i = 0; i < wdContext.nodeSelectedInfotype().size(); i++)
    if(wdContext.nodeSelectedInfotype().getSelectedInfotypeElementAt(i).getBanka()== "1")
    wdContext.nodeSelectedInfotype().getSelectedInfotypeElementAt(i).setZlsch("T");
    wdContext.currentContextElement().setVa_Payment_Enable(false);
    I have requirement.
    If the Bank type is other bank (banka=1) then payment method should be of type T and non editable.
    I have wrote the above logic in Detail view init method of Controller and tried in View init too.It is making Payment method non editable in both the pages.
    Any pointer for above details.

  • In ActiveX(OCX), How to Set "Choose paper source by PDF page size"

    Using Adobe Acrobat Reader ActiveX(ocx) in Delphi 7.
    I want to set "Choose paper source by PDF page size" value, in Source Code dynamically.
    Do you know how to set in Source Code?  Not in Print Dialog Window.
    Please help me. (.net or C# or any language.)

    I have this exact same question. Does anyone know if this is possible?
    Thank you,
    Ryan

  • Using .js file in dynamic page

    In 9.02 i created a portal dynamic page. I would like to include .js file (overlib.js). Can you do this?
    I have tried using the "src=" but it did not work.
    If I try to include the .js code directly in the dynamic page, I get an error. I assume it is a size limitation.
    Help.

    When you say "source=", are you talking about this usage for instance?
    <script type="text/javascript" language="JavaScript1.2"
    src="http://mysite.com/js/myjavascript.js">
    </script>
    Did you get a runtime error after putting that in the dynamic page?

  • Form in Dynamic page not working when checkbox is used.

    I have created a form using dynamic page. The form most have display fields and a checkbox field. When I check a box, it assigns 'Y' value and when unclick, it assign 'N' to the database field.
    When I submit the form, the procedure which is supposed to save the form data never gets executed. Well, at least it says, page not found HTTP 404 error.
    Interestingly if I make this field a text box and manually enter 'Y' or 'N', and then submit the form, the procedure is executed. Data gets saved.
    Is the checkbox not supposed to be used for a database field because checkbox value can be assigned only using javascript and the procedure never get that value ?
    Can you please tell me how to use a checkbox for a database field using dynamic page ?
    thanks,
    Mainak

    Sharmila,
    When I said, the form does not get submitted, I meant that the procedure does not work. The form gets submitted but the procedure does not work. It gives HTTP 404 error. That is what perplexes me. I am unable to understand why the procedure does not work when I click a checkbox.
    May be you can make this work. I am hopeless about this.
    Here is the code for the procedure sumbit_form:
    NOTE: I ADDED TWO FIELDS CALLED PROMOT VARCHAR2(1), PROMOTID NUMBER(4) TO THE EMP TABLE AND CREATED A NEW TABLE CALLED PROMOTEMP. THIS IS A TEST CASE.
    create or replace procedure sumbit_form
    (p_empno IN portal30.wwv_utl_api_types.vc_arr, p_promot IN portal30.wwv_utl_api_types.vc_arr, p_action IN VARCHAR2)
    is
    begin
    if p_action = 'save' then
    for i in 1..p_empno.count LOOP
    update scott.promotemp
    set promot = p_promot(i)
    where empno = p_empno(i);
    END LOOP;
    end if;
    commit;
    htp.p('<b>Saved Successfully</b>');
    htp.p('<table border=1 bordercolor="red">');
    for c1 in (select * from promotemp where promot='Y')
    LOOP
    htp.p('<tr><td>');
    htp.p(c1.ename);
    htp.p('</td><td>');
    htp.p(c1.job);
    htp.p('</td><td>');
    htp.p(c1.mgr);
    htp.p('</td><td>');
    htp.p(c1.sal);
    htp.p('</td><td>');
    htp.p(c1.deptno);
    htp.p('</td></tr>');
    end loop;
    htp.p('</table>');
    EXCEPTION
    when others then
    raise;
    end;
    Here is the code for the dynamic page.
    <HTML>
    <HEAD>
    <TITLE>Promot Emp</TITLE>
    <script language="JavaScript1.1">
    function include(form) {
    var thisform = form;
    for (var i=0; i<thisform.length; i++) {
         if (thisform.elements.type == 'checkbox') {
              if (thisform.elements[i].checked) {
                   thisform.elements[i].value = 'Y'; }
              else { thisform.elements[i].value = 'N'; }
    form.submit();
    function show(form) {
    var thisform = form;
    for (var i=0; i<thisform.length; i++) {
         if (thisform.elements[i].type == 'checkbox') {
              if (thisform.elements[i].value = 'Y') {
                   thisform.elements[i].checked = true; }
              else { thisform.elements[i].checked = false; }
    </script>
    </HEAD>
    <BODY>
    <FORM action="scott.sumbit_form" method="post">
    <table border=1 bordercolor="red">
    <tr>
    <td> </td>
    <td>Name</td>
    <td>Job</td>
    <td>Manager</td>
    <td>Hire Date</td>
    <td>Commission</td>
    <td>Department#</td>
    <td>Include</td>
    </tr>
    <ORACLE>declare
    i number;
    begin
    i := 0;
    for c1 in (select * from scott.promotemp where promotid = :promotid)
    loop
    htp.p('<tr><td>');
    htp.p('<input type="hidden" name="p_empno" value='||c1.empno||'>');
    htp.p('</td><td>');
    htp.p(c1.ename);
    htp.p('</td><td>');
    htp.p(c1.job);
    htp.p('</td><td>');
    htp.p(c1.mgr);
    htp.p('</td><td>');
    htp.p(c1.hiredate);
    htp.p('</td><td>');
    htp.p(c1.comm);
    htp.p('</td><td>');
    htp.p(c1.deptno);
    htp.p('</td><td>');
    if (c1.promot = 'Y') then
    htp.p('<SELECT NAME="p_promot" SIZE="1">
    <OPTION SELECTED VALUE="'||c1.promot||'">Yes
    <OPTION VALUE="N">No
    </SELECT>');
    else
    htp.p('<SELECT NAME="p_promot" SIZE="1">
    <OPTION SELECTED VALUE="'||c1.promot||'">No
    <OPTION VALUE="Y">Yes
    </SELECT>');
    end if;
    htp.p('</td></tr>');
    end loop;
    htp.p('</table>');
    htp.p('<input type="submit" value="save" name="p_action">');
    end;
    </ORACLE>
    </form>
    </BODY>
    </HTML>
    thanks,
    Mainak

  • Pass parameter from dynamic page to form

    I have a report that uses a link to pass a parameter (projno) to a dynamic page. This dynamic page calls a procedure which, using the projno, pulls information from four tables. Depending on who the user is and what phase the project is in, each heading can be a link to a form so that the proper user can update the project. For instance, the projetc manager can update the progress table during phases 2-9. So I want the Progress Heading to be a link to a form so that the project manager can update the progress for a specific project number. I tried to put the link in the procedure like this:
    if iPhase in (2,3,4,5,6,7,8,9) then
              htp.p('<TD><a           href="/pls/portal/PORTAL.wwa_app_module.link?p_arg_names=_moduleid&p_arg_values=6803259033&p_arg_names=projno&p_arg_values='||projno||'&p_arg_names=_projno_cond&p_arg_values=%3D&p_arg_names=_sessionid&p_arg_values=" target="_blank"><FONT FACE="VERDANA" SIZE="2">Progress</FONT></a></TD><TD width="10"></TD>');
         else
              htp.p('<TD><FONT FACE="VERDANA" SIZE="2">Progress</FONT></TD><TD width="10"></TD>');
         end if;
    But it brings up a blank form... no parameters are passed. Help!?

    when I use :projno I get a "bad bind variable" error. But really, I don't think that's the problem. Using the code in my last message, I can mouseover the link and see the correct information:
    http://spring.ous.edu:7778/pls/portal/PORTAL.wwa_app_module.link?p_arg_names=_moduleid&p_arg_values=6803259033&p_arg_names=projno&p_arg_values=14&p_arg_names=_projno_cond&p_arg_values=%3D&p_arg_names=_sessionid&p_arg_values=
    When I actually click on the link however, this is the URL now displayed in the address field:
    http://spring.ous.edu:7778/pls/portal/PORTAL.wwa_app_module.show?p_sessionid=2592
    It strips the url of the projno information.

  • How to achieve dynamic page break in Smart form

    Hi
              1.How to achieve dynamic page breaks in Smart forms.
               2.What are the various table types in Smart forms.
    Regards

    <i>Dynamic page break : </i>
    create a node of type COMMAND and in its attributes check "Go to new page".
    <i>There are Tables and Templates in smart forms :</i>
    Use node type <i>Template</i> to display a table whose layout and size (number of lines and columns) is determined before the runtime of the print program else use <i>Table</i>.
    Take a look at <a href="http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRSF/BCSRVSCRSF.pdf">SAP Smart Forms (BC-SRV-SCR)</a>
    Regards

  • Dynamic pages failing on XP

    Here's the situation, I've got a dynamic page with a form that accepts a value to be passed to another dynamic page. The dynamic pages have worked fine on our Windows 2000 clients (IE6), we've just moved to new Win XP clients (IE6 xpsp1) and now the value gets dropped randomly and sends us to our error page. It will not work the first few times and then start working and then not work, it's on and off, no real pattern. I can't figure out what it is, since it's a simple form post, Win XP IE shouldn't have any problems with it, but it does. The code for the two pages is below. Any help would be appreciated.
    Form:
    <html>
    <head>
    ARCS Query
    </head>
    <body bgcolor="#EEFFEE">
    <p>
    <center>
    <table border="0" cellspacing="0" cellpadding="2">
    <tr bgcolor="ccffcc">
    <th>Requisition #</th>
    </tr>
    <tr bgcolor="ffffcc" align="center">
    <td>
    <form method="post" action="custom_dsdct_app.ctdsd_dyn_arcs_query.show">
    <input name="p_arg_names" type="hidden" value="p_doc_num">
    <input name="p_arg_values" size="16" maxlength="16" value="">
    <input type="submit" value="Query">
    </form>
    </td>
    </tr>
    </table>
    </center>
    </body>
    </html>
    Report (shortened):
    <html>
    <ORACLE>
    declare
    thisnsn varchar2(20);
    dvds integer;
    cnt integer;
    statuscodes varchar2(500);
    crlf varchar2(2) := chr(13) || chr(10);
    begin
    statuscodes := '';
    select count(*) into cnt
    from arcs1@ctwhsdblink
    where doc_nr = upper(:p_doc_num);
    if cnt = 0 then
    htp.p('<META HTTP-EQUIV="Refresh"');
    htp.p(' CONTENT="0;URL=custom_dsdct_app.ctdsd_dyn_ircs_query.show?p_arg_names=p_doc_num&p_arg_values='||:p_doc_num||'">');
    htp.p('</head>');
    htp.p('<body bgcolor="#eeffee">');
    htp.p(:p_doc_num ||' not found; switching to Inactive Requisition file');
    htp.p('</body>');
    htp.p('</html>');
    else
    htp.title( 'ARCS Query ' || substr(upper(:p_doc_num),1,6) || '-' || substr(upper(:p_doc_num),7,4) || '-' || substr(upper(:p_doc_num),11) );
    When it doesn't work, the p_doc_num= <blank>, telling me that the value is getting dropped somewhere.

    Yes.
    I assume you want to SELECT some data from the remote table in order to build the dynamic page? Set up a db link to the remote database and then refer to the table you want by using USER.TABLE@DBLINK.

  • Dynamic Pages In Portal

    I am trying to create a dynamic page based on a stored procedure
    which inserts rows into a table. I am having problems changing
    the value of a parameter text box via the following JavaScript.
    <SCRIPT type="text/javascript">
    <!--
    function change_val()
    var rightnow = new Date ();
    execproc.p_curr_values = rightnow.Date()+rightnow.Month()
    +rightnow.Year();
    //-->
    </SCRIPT>
    As you can see from the code below, all the parameters are given
    the same name value (p_curr_values) by Portal (last line of each
    block). This is what throws the Javascript off.
    <INPUT TYPE="hidden" NAME="p_col_displays" VALUE="1">
    <INPUT TYPE="hidden" NAME="p_data_types" VALUE="VARCHAR2">
    <INPUT TYPE="hidden" NAME="p_col_names" VALUE="P_DATA">
    <INPUT TYPE="hidden" NAME="p_in_out" VALUE="IN">
    <TD COLSPAN="1"><INPUT TYPE="text" NAME="p_curr_values" SIZE="2"
    MAXLENGTH="12"></TD>
    <INPUT TYPE="hidden" NAME="p_col_displays" VALUE="2">
    <INPUT TYPE="hidden" NAME="p_data_types" VALUE="VARCHAR2">
    <INPUT TYPE="hidden" NAME="p_col_names" VALUE="P_SURNAME">
    <INPUT TYPE="hidden" NAME="p_in_out" VALUE="IN">
    <TD COLSPAN="1"><INPUT TYPE="text" NAME="p_curr_values"
    SIZE="30" MAXLENGTH="15"></TD>
    <INPUT TYPE="hidden" NAME="p_col_displays" VALUE="3">
    <INPUT TYPE="hidden" NAME="p_data_types" VALUE="DATE">
    <INPUT TYPE="hidden" NAME="p_col_names" VALUE="P_REG">
    <INPUT TYPE="hidden" NAME="p_in_out" VALUE="IN">
    <TD COLSPAN="1"><INPUT TYPE="text" NAME="p_curr_values"
    SIZE="30" MAXLENGTH="9"></TD>
    I tried to change the HTML of the page so that each of the boxes
    may have different names but it does not work. When I save the
    page and run it, the HTML reverts to the default names.
    Does anybody know how to solve this problem?
    I have spend hours on this one and I would really appreciate
    some help.
    Regards,
    Kostas Paschalis

    Hi Debbianna -
    If you are not already a member of Portal Knowledge Exchange ... sign up now - it is free
    http://portalstudio.oracle.com/servlet/page?_pageid=2112&_dad=ops&_schema=OPSTUDIO&_mode=3
    Once you log in, if you do a search on DHTML you will see some samples for dynamic menus. These allow you to download the code as well so you can check out how others have implemented this and possibly just reuse their portlets.
    Hope this helps,
    Candace

  • Dynamic Pages Error Took exception (WWV-01801)

    I have a dynamic page which I can save (and it runs fine). When I try to edit it, I get the error:
    Took exception (WWV-01801)
    This isn't very descriptive. Where can I start looking?

    It appears to be a bug in Portal.
    If I shrink down the size of my PL/SQL segment in the dynamic page, all is fine.
    This ultimately limits the size of PL/SQL blocks in a dynamic page. It would be nice if Portal should warn you about this.

  • Show ordimages - dynamic page or portal reports

    Hi all.
    I have one table with 2 columns ordimages and 1 varchar2, im use a oracle portal forms to make inserts, its works perfect, but now a need to display this images, i try to use Portal Reports, but when a try display this images just show a small picture a want to display the original image like:
    Name Product: image in full size
    Can i do this in oracle reports or dynamic page , because later,a want to make a search in this product names ?
    tks
    Carlo.

    Please post this question to the Portal applications forum. This forum is for discussion of content area topics.
    Thanks,
    Jerry

  • Dynamic page number

    dynamic page number
    I am trying to print multiple documents in one report, the requirement is to reset page numbers for every document(to start counting from 1)
    I don't have control over the size of the document because it is a flow table
    I am using page conditional break to finish the document and start a new one but I couldn't change the page number.
    Plz help I am really trying to solve this for a week now.
    I am using 7.1 ADL
    thanks
    Edited by: Sami Japr on May 26, 2009 1:59 PM
    Edited by: Sami Japr on May 27, 2009 1:35 PM

    I figured it out thanks any way
    If anyone looking for a solution for the same issue
    he solution is as follows
    create 3 numeric fields in the header of the table
    total
    counter 1
    counter 2
    the total is to count the number of pages of each document
    in initialization event
    total = total + 1 ;
    the counter 1 is to make the counter of the pages from 0 to total (invisible)
    in calculate event
    if ( counter 1 < total ) then
    counter 1 = counter 1 + 1 .
    elseif( counter 1 >= total ) then
    counter 1 = 1
    counter 2 to show the page number of the document
    in layout ready
    counter 2 = 1
    in calculate event
    counter 2 = counter 1 + 1
    Note: this is the logic with little modification create the code
    Regards
    Sam or Muneer

  • Bad performance dynamic page

    Hi.
    Can anybody tell what the bottleneck is in this script? It is a dynamic page (portal 3.0.9). The select statements are not very complicated.
    ANY HELP IS WELCOME!!
    <HTML>
    <BODY BGCOLOR="#FFFFFF" TEXT="#444444">
    <ORACLE>
    declare
    cursor c_runway is select distinct runway from vem_flights where nvl(:v_runway,runway) = runway;
    v_runway vem_flights.runway%type;
    v_select number;
    v_totaal number;
    v_percentage number;
    v_aantal_jaren number;
    v_aantal_maanden number;
    v_aantal_weken number;
    v_aantal_dagen number;
    v_tijd number;
    teller number;
    kopstring varchar2(500);
    selectstring varchar2(500) := '';
    begin
    v_tijd := :v_tijdvak;
    :v_begindate := :v_begindate;
    :v_enddate := :v_enddate;
    if v_tijd = 3 then
    select round(months_between(to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS'),to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'))) into v_aantal_maanden from dual;
    if last_day(to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS')) > add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),v_aantal_maanden) then
    v_aantal_maanden := v_aantal_maanden + 1;
    for teller in 1 .. v_aantal_maanden loop
    if teller = 1 then
    kopstring := '<td><b><i>Baan\Tijdvak </i></b></td>'||'<td colspan="3"><b><i>'||to_char(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),'DD-MM-YYYY')||' t/m '||to_char(add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')-1,teller),'DD-MM-YYYY')||'</i></b></td>';
    elsif teller > 1 and teller < v_aantal_maanden then
    kopstring := kopstring||'<td colspan="3"><b><i>'||to_char(add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),teller-1),'DD-MM-YYYY')||' t/m '||to_char(add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')-1,teller),'DD-MM-YYYY')||'</b></i></td>';
    elsif teller = v_aantal_maanden then
    kopstring := kopstring||'<td colspan="3"><b><i>'||to_char(add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),teller-1),'DD-MM-YYYY')||' t/m '||to_char(to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS'),'DD-MM-YYYY')||'</i></b></td>';
    end if;
    end loop;
    v_aantal_maanden := v_aantal_maanden - 1;
    else
    for teller in 1 .. v_aantal_maanden loop
    if teller = 1 then
    kopstring := '<td><b><i>Baan\Tijdvak </i></b></td>'||'<td colspan="3"><b><i>'||to_char(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),'DD-MM-YYYY')||' t/m '||to_char(add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')-1,teller),'DD-MM-YYYY')||'</i></b></td>';
    elsif teller > 1 and teller < v_aantal_maanden then
    kopstring := kopstring||'<td colspan="3"><b><i>'||to_char(add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),teller-1),'DD-MM-YYYY')||' t/m '||to_char(add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')-1,teller),'DD-MM-YYYY')||'</b></i></td>';
    elsif teller = v_aantal_maanden then
    kopstring := kopstring||'<td colspan="3"><b><i>'||to_char(add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),teller-1),'DD-MM-YYYY')||' t/m '||to_char(to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS'),'DD-MM-YYYY')||'</i></b></td>';     
    end if;
    end loop;
    end if;
    htp.p('<font face = "arial" size="3"><b>Verticale afwijkingen overdag van naderende vliegtuigen buiten de TMA</b></font><p>&nbsp<p>');
    htp.p('<table border="1">');
    htp.p('<tr>'||kopstring||'</tr>');
    open c_runway;
    loop
    fetch c_runway into v_runway;
    exit when c_runway%notfound;
    selectstring := '<td><b><i>'||v_runway||'</i></b>';
    if last_day(to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS')) > add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),v_aantal_maanden) then
    v_aantal_maanden := v_aantal_maanden + 1;
    for teller in 1 .. v_aantal_maanden loop
    if teller = 1 then
    select count(*)
    into v_select
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.gs21      = 'X'
    and vem.runway = v_runway
         and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')
    and add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')-1,teller)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    select count(*)
    into v_totaal
    from vem_flights vem
    where vem.aircrafttype = 'JET'
         and vem.destination = 'EHAM'
         and vem.period = 'DAY'
    and vem.runway = v_runway
         and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')
    and add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')-1,teller)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    if v_totaal != 0 then
    select round((v_select/v_totaal)*100) into v_percentage from dual;
    elsif v_totaal = 0 then
    select 0 into v_percentage from dual;
    end if;
    elsif teller > 1 and teller < v_aantal_maanden then
    select count(*)
    into v_select
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.gs21      = 'X'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),teller-1)
    and add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')-1,teller)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    select count(*)
    into v_totaal
    from vem_flights vem
    where vem.aircrafttype = 'JET'
         and vem.destination = 'EHAM'
         and vem.period = 'DAY'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),teller-1)
    and add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')-1,teller)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    if v_totaal != 0 then
    select round((v_select/v_totaal)*100) into v_percentage from dual;
    elsif v_totaal = 0 then
    select 0 into v_percentage from dual;
    end if;               
    elsif teller = v_aantal_maanden then
    select count(*)
    into v_select
    from vem_flights vem
    where vem.aircrafttype = 'JET'
         and vem.gs21 = 'X'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),teller-1)
    and to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS')
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    select count(*)
    into v_totaal
    from vem_flights vem
    where vem.aircrafttype = 'JET'
         and vem.destination = 'EHAM'
         and vem.period = 'DAY'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),teller-1)
    and to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS')
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    if v_totaal != 0 then
    select round((v_select/v_totaal)*100) into v_percentage from dual;
    elsif v_totaal = 0 then
    select 0 into v_percentage from dual;
    end if;               
    end if;
    if v_percentage > 5 then
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td><font color="red">'||to_char(v_percentage)||'%</font></td>';
    else
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td>'||to_char(v_percentage)||'%</td>';                    
    end if;
    end loop;
    v_aantal_maanden := v_aantal_maanden - 1;
    else
    for teller in 1 .. v_aantal_maanden loop
    if teller = 1 then
    select count(*)
    into v_select
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.gs21      = 'X'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
    and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')
    and add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')-1,teller)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    select count(*)
    into v_totaal
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.destination = 'EHAM'
    and vem.period = 'DAY'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
    and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')
    and add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')-1,teller)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    if v_totaal != 0 then
    select round((v_select/v_totaal)*100) into v_percentage from dual;
    elsif v_totaal = 0 then
    select 0 into v_percentage from dual;
    end if;     
    elsif teller > 1 and teller < v_aantal_maanden then
    select count(*)
    into v_select
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.gs21      = 'X'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
    and vem.date_time between add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),teller-1)
    and add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')-1,teller)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    select count(*)
    into v_totaal
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.destination = 'EHAM'
    and vem.period = 'DAY'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
    and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')
    and add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')-1,teller)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    if v_totaal != 0 then
    select round((v_select/v_totaal)*100) into v_percentage from dual;
    elsif v_totaal = 0 then
    select 0 into v_percentage from dual;
    end if;               
    elsif teller = v_aantal_maanden then
    select count(*)
    into v_select
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.gs21      = 'X'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
    and vem.date_time between add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),teller-1)
    and to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS')
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    select count(*)
    into v_totaal
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.destination = 'EHAM'
    and vem.period = 'DAY'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
    and vem.date_time between add_months(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS'),teller-1)
    and to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS')
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    if v_totaal != 0 then
    select round((v_select/v_totaal)*100) into v_percentage from dual;
    elsif v_totaal = 0 then
    select 0 into v_percentage from dual;
    end if;          
    end if;
    if v_percentage > 5 then
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td><font color="red">'||to_char(v_percentage)||'%</font></td>';
    else
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td>'||to_char(v_percentage)||'%</td>';                    
    end if;
    end loop;
    end if;
    htp.p('<tr>'||selectstring||'</tr>');
    end loop;
    close c_runway;
    htp.p('</table>');
    htp.p('</font>');
    elsif v_tijd = 1 then
    select to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS') - to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') into v_aantal_dagen from dual;
    for teller in 0 .. v_aantal_dagen loop
    kopstring := kopstring||'<td colspan="3"><b><i>'||to_char(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + teller,'DD-MM-YYYY')||'</b></i></td>';
    end loop;
    htp.p('<font face = "arial" size="3"><b>Verticale afwijkingen overdag van naderende vliegtuigen buiten de TMA</b></font><p>&nbsp<p>');
    htp.p('<table border="1">');
    htp.p('<tr>');
    htp.p('<td><b><i>Baan\Tijdvak </i></b></td>'||kopstring);
    htp.p('</tr>');
    open c_runway;
    loop
    fetch c_runway into v_runway;
    exit when c_runway%notfound;
    selectstring := '<td><b><i>'||v_runway||'</i></b>';
    for teller in 0 .. v_aantal_dagen loop
    select count(*)
    into v_select
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.gs21      = 'X'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
    and vem.date_time = to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + teller
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    select count(*)
    into v_totaal
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.destination = 'EHAM'
    and vem.period = 'DAY'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
    and vem.date_time = to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + teller
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    if v_totaal != 0 then
    select round((v_select/v_totaal)*100) into v_percentage from dual;
    elsif v_totaal = 0 then
    select 0 into v_percentage from dual;
    end if;
    if v_percentage > 5 then
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td><font color="red">'||to_char(v_percentage)||'%</font></td>';
    else
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td>'||to_char(v_percentage)||'%</td>';                    
    end if;
    end loop;
    htp.p('<tr>'||selectstring||'</tr>');
    end loop;
    close c_runway;
    htp.p('</table>');
    htp.p('</font>');
    elsif v_tijd = 2 then
    select trunc(to_char(to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS') - to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')) / 7) into v_aantal_weken from dual;
    for teller in 0 .. v_aantal_weken loop
    if teller < v_aantal_weken then
    kopstring := kopstring||'<td colspan="3"><b><i>'||to_char(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*7),'DD-MM-YYYY')||' t/m '||to_char(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + ((teller*14) - 1),'DD-MM-YYYY')||'</b></i></td>';
    elsif teller = v_aantal_weken then
    kopstring := kopstring||'<td colspan="3"><b><i>'||to_char(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*7),'DD-MM-YYYY')||' t/m '||to_char(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + ((teller*14) - 1),'DD-MM-YYYY')||'</b></i></td>';
    kopstring := kopstring||'<td colspan="3"><b><i>'||to_char(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*7),'DD-MM-YYYY')||' t/m '||to_char(to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS'),'DD-MM-YYYY')||'</b></i></td>';                         
    end if;      
    end loop;
    htp.p('<font face = "arial" size="3"><b>Verticale afwijkingen overdag van naderende vliegtuigen buiten de TMA</b></font><p>&nbsp<p>');
    htp.p('<table border="1">');
    htp.p('<tr>');
    htp.p('<td><b><i>Baan\Tijdvak </i></b></td>'||kopstring);
    htp.p('</tr>');
    open c_runway;
    loop
    fetch c_runway into v_runway;
    exit when c_runway%notfound;
    selectstring := '<td><b><i>'||v_runway||'</i></b>';
    for teller in 0 .. v_aantal_weken loop
    if teller < v_aantal_weken then
    select count(*)
    into v_select
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.gs21      = 'X'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*7)
         and to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + ((teller*14) - 1)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);           
    select count(*)
    into v_totaal
    from vem_flights vem
    where vem.aircrafttype = 'JET'
         and vem.destination = 'EHAM'
         and vem.period = 'DAY'
    and vem.runway = v_runway
         and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*7)
         and to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + ((teller*14) - 1)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    if v_totaal != 0 then
    select round((v_select/v_totaal)*100) into v_percentage from dual;
    elsif v_totaal = 0 then
    select 0 into v_percentage from dual;
    end if;
    elsif teller = v_aantal_weken then
    select count(*)
    into v_select
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.gs21      = 'X'
    and vem.runway = v_runway
         and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*7)
         and to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + ((teller*14) - 1)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    select count(*)
    into v_totaal
    from vem_flights vem
    where vem.aircrafttype = 'JET'
         and vem.destination = 'EHAM'
         and vem.period = 'DAY'
    and vem.runway = v_runway
         and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*7)
         and to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + ((teller*14) - 1)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    if v_totaal != 0 then
    select round((v_select/v_totaal)*100) into v_percentage from dual;
    elsif v_totaal = 0 then
    select 0 into v_percentage from dual;
    end if;          
    if v_percentage > 5 then
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td><font color="red">'||to_char(v_percentage)||'%</font></td>';
    else
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td>'||to_char(v_percentage)||'%</td>';                    
    end if;                    
    select count(*)
    into v_select
    from vem_flights vem
    where vem.aircrafttype = 'JET'
         and vem.gs21      = 'X'
    and vem.runway = v_runway
         and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*7)
         and to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS')
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    select count(*)
    into v_totaal
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.destination = 'EHAM'
         and vem.period = 'DAY'
    and vem.runway = v_runway
         and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*7)
         and to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS')
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    if v_totaal != 0 then
    select round((v_select/v_totaal)*100) into v_percentage from dual;
    elsif v_totaal = 0 then
    select 0 into v_percentage from dual;
    end if;
    end if;
    if v_percentage > 5 then
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td><font color="red">'||to_char(v_percentage)||'%</font></td>';
    else
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td>'||to_char(v_percentage)||'%</td>';                    
    end if;
    end loop;
    htp.p('<tr>'||selectstring||'</tr>');
    end loop;
    close c_runway;
    htp.p('</table>');
    htp.p('</font>');
    elsif v_tijd = 4 then
    select trunc(to_char(to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS') - to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS')) / 365) into v_aantal_jaren from dual;
    for teller in 0 .. v_aantal_jaren loop
    if teller < v_aantal_jaren then
    kopstring := kopstring||'<td colspan="3"><b><i>'||to_char(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*365),'DD-MM-YYYY')||' t/m '||to_char(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + ((teller*730) - 1),'DD-MM-YYYY')||'</b></i></td>';
    elsif teller = v_aantal_jaren then
    kopstring := kopstring||'<td colspan="3"><b><i>'||to_char(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*365),'DD-MM-YYYY')||' t/m '||to_char(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + ((teller*730) - 1),'DD-MM-YYYY')||'</b></i></td>';
    kopstring := kopstring||'<td colspan="3"><b><i>'||to_char(to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*7),'DD-MM-YYYY')||' t/m '||to_char(to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS'),'DD-MM-YYYY')||'</b></i></td>';                         
    end if;      
    end loop;
    htp.p('<font face = "arial" size="3"><b>Verticale afwijkingen overdag van naderende vliegtuigen buiten de TMA</b></font><p>&nbsp<p>');
    htp.p('<table border="1">');
    htp.p('<tr>');
    htp.p('<td><b><i>Baan\Tijdvak </i></b></td>'||kopstring);
    htp.p('</tr>');
    open c_runway;
    loop
    fetch c_runway into v_runway;
    exit when c_runway%notfound;
    selectstring := '<td><b><i>'||v_runway||'</i></b>';
    for teller in 0 .. v_aantal_jaren loop
    if teller < v_aantal_jaren then
    select count(*)
    into v_select
    from vem_flights vem
    where vem.aircrafttype = 'JET'
         and vem.gs21      = 'X'
    and vem.runway = v_runway
         and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*365)
         and to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + ((teller*730) - 1)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    select count(*)
    into v_totaal
    from vem_flights vem
    where vem.aircrafttype = 'JET'
         and vem.destination = 'EHAM'
         and vem.period = 'DAY'
    and vem.runway = v_runway
         and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*365)
         and to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + ((teller*730) - 1)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    if v_totaal != 0 then
    select round((v_select/v_totaal)*100) into v_percentage from dual;
    elsif v_totaal = 0 then
    select 0 into v_percentage from dual;
    end if;
    elsif teller = v_aantal_jaren then
    select count(*)
    into v_select
    from vem_flights vem
    where vem.aircrafttype = 'JET'
         and vem.gs21      = 'X'
    and vem.runway = v_runway
         and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*365)
         and to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + ((teller*730) - 1)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    select count(*)
    into v_totaal
    from vem_flights vem
    where vem.aircrafttype = 'JET'
         and vem.destination = 'EHAM'
         and vem.period = 'DAY'
    and vem.runway = v_runway
         and vem.departure NOT IN ('EHLE','EHRD','EHVB')
         and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*365)
         and to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + ((teller*730) - 1)
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    if v_totaal != 0 then
    select round((v_select/v_totaal)*100) into v_percentage from dual;
    elsif v_totaal = 0 then
    select 0 into v_percentage from dual;
    end if;          
    if v_percentage > 5 then
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td><font color="red">'||to_char(v_percentage)||'%</font></td>';
    else
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td>'||to_char(v_percentage)||'%</td>';                    
    end if;                    
    select count(*)
    into v_select
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.gs21      = 'X'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
    and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*365)
    and to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS')
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    select count(*)
    into v_totaal
    from vem_flights vem
    where vem.aircrafttype = 'JET'
    and vem.destination = 'EHAM'
    and vem.period = 'DAY'
    and vem.runway = v_runway
    and vem.departure NOT IN ('EHLE','EHRD','EHVB')
    and vem.date_time between to_date(:v_begindate,'DD-MM-YYYY HH24.MI.SS') + (teller*365)
    and to_date(:v_enddate,'DD-MM-YYYY HH24.MI.SS')
    and (rtrim((to_char(vem.date_time,'HH24'))) >= :v_starthour or :v_starthour = '%')
    and (rtrim((to_char(vem.date_time,'HH24'))) < :v_endhour or :v_endhour = '%')
    and rtrim((to_char(vem.date_time,'DAY'))) IN (:v_day);
    if v_totaal != 0 then
    select round((v_select/v_totaal)*100) into v_percentage from dual;
    elsif v_totaal = 0 then
    select 0 into v_percentage from dual;
    end if;
    end if;
    if v_percentage > 5 then
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td><font color="red">'||to_char(v_percentage)||'%</font></td>';
    else
    selectstring := selectstring||'<td>'||to_char(v_select)||'</td><td>'||to_char(v_totaal)||'</td><td>'||to_char(v_percentage)||'%</td>';                    
    end if;
    end loop;
    htp.p('<tr>'||selectstring||'</tr>');
    end loop;
    close c_runway;
    htp.p('</table>');
    htp.p('</font>');
    end if;
    end;
    </ORACLE>
    </BODY>
    </HTML>

    I set up a helper package to return my reference cursors:
    Package SOME_PKG as type t_RefCur is REF CURSOR;
    I added the appropriate function to return the cursors. Here a simple example:
    FUNCTION get_leads(x in NUMBER, y in NUMBER)
    RETURN t_RefCur IS
    v_ReturnCursor t_RefCur;
    v_SQL VARCHAR2(500);
    BEGIN
    v_SQL:= 'select * from SOME_TABLE_OR_VIEW where account = :n and location = :m';
    OPEN v_ReturnCursor FOR v_SQL using x,y;
    RETURN v_ReturnCursor;
    END get_leads;
    Then I make my call from the portlet which goes something like this:
    <oracle>
    declare
    arow SOME_TABLE_OR_VIEW%ROWTYPE;
    invcursor SOME_PKG.t_RefCur;
    X number;
    Y number;
    begin
    invcursor := SOME_PKG.get_leads(get_account_number(X), get_location(Y));
    /*portlet formatting and looping...
    fetch invcursor into arow;
    htp.p(arow.SOME_ROW_FROM_TABLE);
    end;
    </oracle>
    I have gotten very good performance with reference cursors in Oracle.
    Good luck.

Maybe you are looking for

  • Times in iCal

    Is there a way to list an event without having a time print next to it. I don't want it to show up as an all day event, just to have it on a particular day without a time next to it.

  • Trying to install OS X 10.3 on a new hard disk.

    I inserted a new hard drive into my iMac, as I knew that I needed more hard disk space for Panther then the 6 GB that I had with 9.2.2 (not for the install, which only requires 2 GB, but for general use). I zeroed it and formatted it with Mac OS Exte

  • How to Format Microsoft Excel spreadsheet generated using RFC

    Hi Portal Experts, Currently, I've managed to generate a Microsoft Excel spreadsheet using a customized RFC. The spreadsheet was initiated when submitting data from Portal. But, the data generated in Microsoft Excel was not formatted according to my

  • Iphot 2.0 require newer version....

    hi I currently have iphoto 2, is it possible to download a newer version? thanks sophie

  • REGI configuration path not found in HANA studio

    Dear Experts, I have my HANA studio and HANA client installed. I can see the regi.exe file in the hdbclient folder. I am using studio 1.0.7000. But i am not able to find the suggested path for Regi configuration in the studio. Window - > Preferences