PL/SQL Report Headings

Bug:
I created a dynamic report using, Function returning PL/SQL and set "Use Generic Column Names" and "Maximum number of generic report columns" > 100.
When I go into the Report Attributes and select a report heading type of PLSQL, the PLSQL edit text field does not appear. However, if I reduce the number of generic columns to <=100, the PLSQL field returns.
Jon
Apex Version=4.0.1

Because I have written a dynamic query as a cross reference table, I cannot guarantee the number of columns, therefore I am likely to need up to 200+. I also need a drill-down on the intersection values and that means I need to store the underlying reference IDs as columns.
Being able to write these dynamic style queries is a really good feature of Apex, however, I really would like to specify a lot more columns.
Jon

Similar Messages

  • PL/SQL Report Headings Type question

    Hi,
    If I set a report to use a Heading Type of "PL/SQL", is there a way to get the region id of the report from within the PL/SQL function that I provide in the "Function returning colon delimited headings" section?
    #REGION_ID# (available in a report template) doesn't seem to work.
    Thanks,
    Eric

    Report region ids are not accessible to developers for use in the App Builder. You have to run the page, see what the generated region id is and then go back and hardcode it whereever you need.
    I understand that this is going to be improved in the next release, the region id is going to be a user-defined attribute.

  • How to rename C00n generic column names in a Dynamic SQL report

    I have a an interface whereby the user can select 1 to 60 (upper limit) columns out of 90 possible columns (using a shuttle) from one table before running a report.
    To construct the SQL that will eventually execute, I'm using a "PLSQL function body returning SQL query" with dynamic SQL. The only problem is that I have to use "Generic Column Names" option to be able to compile the code and end up with c001 to c060 as the column names.
    How can I use the names of the selected columns as the report headings rather than c001, C002... etc?
    I do not know beforehand which columns, or how many columns or the order of the selected columns.
    I know Denes K has a demo called Pick Columns but I can't access his code. I have a hunch though that he may be just using conditions to hide/show the apropriate columns.
    thanks in advance
    PaulP

    Hi Paul
    I would change the Heading Type in the Report Details screen to PLSQL and use the shuttle item to return the column values. e.g.
    RETURN :p1_shuttle;
    I'm assuming the shuttle already has a colon separated list of the column headings in the correct order?
    I hope that helps
    Shunt

  • How to remove spaces in the output of an PL/SQL report

    Hi,
    The requirement is to develop a SQL report.
    The sample code is like this
    Select 'Order Number Header Id' from dual; ( This is the heading in the output of the report.)
    Select order_number , header_id from oe_order_headers_all;
    The output is displaying as follows
    =======================
    'Order Number Header Id'
    1234 101
    2222 102
    3333 103
    =======================
    Now I am opening the report in excel, and there is a space appearing after the headings.
    So, how can I remove the additional blank line between the headings and the data.
    Thanks in advance
    Mani

    Mani B wrote:
    Hi,
    The requirement is to develop a SQL report.From which tool ur getting this report...? From oracle forms report..?
    >
    The sample code is like this
    Select 'Order Number Header Id' from dual; ( This is the heading in the output of the report.)
    Select order_number , header_id from oe_order_headers_all;
    The output is displaying as follows
    =======================
    'Order Number Header Id'
    1234 101
    2222 102
    3333 103
    =======================
    Now I am opening the report in excel, and there is a space appearing after the headings. if u use any third party tool like pl/sql developer or sql developer then u can export the data into xcel file.
    Sen

  • PLSQL processing of a dynamic sql report

    Hi there,
    I have a problem processing a dynamic sql report, specifically in referencing the PL/SQL column headings I have.
    Basically I have a report that generates one row for each project a person belongs to, and then using htmldb_item.text creates one field for each day of the week (sysdate - sysdate+6) so that people can enter their hours worked. The idea is they then press a submit button and the hours are entered into a project table something like (date_worked, project_id, hours_worked), one row for each entry.
    So I have:
    for i in 1..HTMLDB_APPLICATION.G_F01.count
    loop
    ... err... here I want to insert into the table the values(column_header, project_id, HTMLDB_APPLICATION.G_F01(i)).. but I don't know how to access that column_header value.
    Is this possible and if so, how?
    Many thanks,
    Tosh.

    that gives me the values of the text fields, but what
    I'd like to insert is the value of the column
    header... so for example:Yes, I understood what you meant. I did have a differect project_id for each INSERT in my SQL above. I guess that should have been day_id
    Since you are generating the tabular form SQL manually, you know which htmldb_item.text index corresponds to which column (which represents day_id in your case). So, use this to write 6 INSERT statements, one for each day. day_id would be a number going from 0 thru 6 where 0 represents Sunday and 6 represents Saturday.
    Bottom line: This is like generating/updating a calendar, your column headings are always fixed (Sun thru Saturday), just the date they represent would change.

  • Create Simple Printable SQL Reports in APEX 3.2 Without a Print Server

    Oracle Apex 3.2
    Oracle 11g
    OHS
    I thought I'd post an answer on how to get a printable SQL report in Oracle Apex without having to configure a print server. I'm sure that similar things have been posted in various other places, but I found the documentation for using custom row templates (to create a printable report) to be incomplete at best. For my needs, I was not looking for an awe inspiring report printout, but rather simple directory information printouts. For example, if you wanted a printable report to look like this:
    =================================
    CURRENT ACTIVE EMPLOYEES REPORT
    =================================
    First Name: Bob                  Employee ID: 0000000000
    Last Name: Swarts              Company Credit Card Number: 0000-0000-0000-0000
    Middle Initial: F                  Social Security Number: 000-00-0000
    First Name: Sue                  Employee ID: 1111111111
    Last Name: Johnson           Company Credit Card Number: 1111-1111-1111-1111
    Middle Initial: G                 Social Security Number: 111-11-1111
    etc.....In MS Access, doing this is very easy. From what I understand, this is also very easy to do this using PDF software with a print server. However, if you are like me, you don't want to waste time and money by obtaining and configuring a print server (even if it is free). However, never fear because you can create simple reports like this with relatively minimalistic effort; and you can do so without having to configure a print server.
    1.) Create a new page
    2.) Create a new sql query report region on the page
    3.) Make your query just as you would normally.
    For this example the query would be:
    select first_name, employee_id, last_name, company_credit_card_number, middle_initial, social_security_number from employee_table4.) Go to "Shared Components"
    5.) Under "User Interface" click on "Templates"
    6.) Click on the "Create" button
    7.) Select "Report"
    8.) Select "From Scratch"
    9.) For the "Template Class," choose one of the "custom" classes. For the "Template Type," choose "Named Column"
    10.) Click the "Create" button
    11.) Now that you created a custom row template, go back to "Shared Components" and then to "Templates"
    12.) Find your custom template and click on it
    CUSTOM TEMPLATE HOW TO
    1.) In the "Row Template 1" textbox, you are going to create some custom css that will display the data on the page. The css to make the report look like the report above would be:
    <div style = text-align: justify">
    <table>
    <tr>
    <td style = "width: 200px"><b>First Name: #1#</b></td>
    <td style = "width: 225px">&nbsp</td>
    <td style = "width: 215px"><b>Employee Id: #2#</b></td>
    <tr>
    <td style = "width: 200px">Last Name: #3#</td>
    <td style = "width: 225px">&nbsp</td>
    <td style = "width: 215px">Company Credit Card Number: #4#</td>
    <tr>
    <td style = "width: 200px">MI: #5#</td>
    <td style = "width: 225px">&nbsp</td>
    <td style = "width: 215px">Social Security Number: <b>#6#</b></td>
    </tr>
    </table>
    <p style = "page-break-after: always">----------------------------------------------------------------</p>
    </div>
    {code}
    As you probably figured out, the numbers between the two pound signs ("#") are substitution strings for the variables in your select query in the SQL report.  As you have also probably noticed, the "page-break-after: always" line will always make it so that only one report is shown on a page.  To fix this, we will need to use logic and row template 2.
    2.)  For the "Row Template 1 Condition," select "Use Based on PL/SQL Expression" from the select list.
    3.)  In the textbox for the row template 1 expression enter in the following:  {code}substr('#rownum#',-1) = 0 or substr('#rownum#',-1) = 5{code}
    ***** This condition will make sure that this template is applied when the last digit in the row number is either a "0" or a "5."  So, only 5 reports will be displayed per page.
    4.)  Now go down to "Row Template 2" and enter in the following in the textbox:
    {code}
    <div style = text-align: justify">
    <table>
    <tr>
    <td style = "width: 200px"><b>First Name: #1#</b></td>
    <td style = "width: 225px">&nbsp</td>
    <td style = "width: 215px"><b>Employee Id: #2#</b></td>
    <tr>
    <td style = "width: 200px">Last Name: #3#</td>
    <td style = "width: 225px">&nbsp</td>
    <td style = "width: 215px">Company Credit Card Number: #4#</td>
    <tr>
    <td style = "width: 200px">MI: #5#</td>
    <td style = "width: 225px">&nbsp</td>
    <td style = "width: 215px">Social Security Number: <b>#6#</b></td>
    </tr>
    </table>
    <p>----------------------------------------------------------------</p>
    </div>look familiar? that is because it exactly the same code as above, except without the page-break-after piece.
    5.) For the "Row Template 2 Condition," select "Use Based on PL/SQL Expression" from the select list.
    6.) In the textbox for the row template 2 expression enter in the following: substr('#rownum#',-1) != 0 or substr('#rownum#',-1) != 5***** This condition will make sure that this template is applied when the last digit in the row number IS NOT a "0" or a "5."
    7.) Scroll down to column headings and enter this in the textbox for the "Column Heading Template": OMIT
    8.) Click the "Apply Changes" button
    9.) Now go back to your application and the page you want to apply the custom report to
    10.) On the report, click on the report tab
    11.) Scroll down to "Layout and Pagination"
    12.) Click on the "Report Template" select list
    13.) Select your custom template
    14.) Click the "Apply Changes" button and run the page
    Try printing the report, if it does not print correctly, try it in Opera, Safari, Internet Explorer, Firefox, and Google Chrome. Please note that it is my understanding that only Firefox does not understand the css "page-break-after: always"
    If needed, add some css to the page to hide tabs and other items when you print.
    ~Andrew Schulltz

    DOH. Too much copy/paste.
    In my code, I was setting an application variable to contain the email address I was retrieving from AD. Once commented out, it worked fine.
              IF l_attr_name = 'mail' THEN
                 APEX_UTIL.SET_SESSION_STATE('F111_USER_EMAIL',l_vals(i));
              END IF;

  • Report headings based on Items: values not substituted in BI Publisher

    That is, custom column headings such as "&P7_HEADING_X.".
    They show up fine as the item values in the browser report, but as the literal ("&P7_HEADING_X.") in BI Publisher output to Excel, Word, etc.
    I've noticed that PL/SQL based headings pass through all right. I can probably use this as a work-around. Is there a way to get BI Publisher to do the item value substitutions ?
    I am working with Application Express 3.1.0.00.32 on apex.oraclecorp.com.
    I've just been introduced to BI Publisher (like today). All I know about it is that you get to it through the Print Attributes panel.

    Mike said: "I am assuming that you are just using the default download and I use the "&." notation in the column headings so it should pass over to word, or excel."
    Yes, this is it. But, when the column headers pass through BI Publisher, they are not substituting (like you said, they "should" but they don't). I wind up with an Excel (or Word, or PDF) file where the column headings are all '&P7_HEADING_01.', '&P7_HEADING_02.', etc.
    Again though, all I know about BIP is that it hooks into APEX by way of the Report "Print Attributes" panel. And, I'm not even so sure about that; there's no indication what's doing the "print" serving behind the scenes.

  • Standard Report Headings,  JAVA script usage,and  Report field fixed width

    My company has purchased Crystal Reports 2008 and I'm in the process of determining if the product will do everything we need and not become a maintenance nitemare. 
    We would like to setup some standard report headings to be used in all reports.  I've setup on already as a SUBREPORT and it works fine. We pass optional parameters that may be blank.
    We have several questions:
    1) Subreport...Once a SUBREPORT is setup as a standard heading and included in multiple reports, we are concerned about what is required if the standard heading subreport changes.  Will each report that uses this need to be opened or handled in any way to pickup the subreport changes?  Any suggestions how to handle this?
    2) Subreport....In order to get the "PAGE N of M" to work in the subreport we've setup the subreport to accept parameters that are passed from the main report and this works fine.  But this requires every report using the standard heading to setup the parameters in order to work.  Is there any other way that would minimize the setup needed for a standard heading?
    3) JAVA...  Can we call a Javascript function? If so, any hints/tips on how/where to do this?
    4) Standard Report... Creating the report is difficult with guessing the width to define to the field.  Is there a way that the report can know and display the exact size of the field being used?  A fixed field defininiton of some sort would make it MUCH easier in the layout of the report.
    5) Standard Report...We are currently testing with a stored procedure for the SQL query result data but because of the application we will need to build the query dynamically for every report.  Is there a way to bind the data and specify the field lengths? 
    6) Standard Report...When using a defined file structure I needed to add another field.  At the time it seemed like I had to start from scratch as the fields that were on the report were now gone.  Is there a update method that can be done import the changes and not loose existing fields on a report? 
    That all for now.  Sorry there are so many questions.  We are trying to clear up as many issues as we can before starting the 100+ reports needed.
    Thanks in advance.

    Hi Vitaly Izmaylov,
    I've taken your advice and split out questions 2-6 into seperate questions.  Anyone else please respond only to question 1 here. 
    I see the Re-Import subreport option....and I guess I can only assume that this means that any change to a report heading file (subreport) must be manually re-imported into every report it is used in.  There are no behind the scenes files or table that maintain a usage of these reports and can automate the population of the changes.
    I was hoping that maybe the subreports would be accessed when called for an pickup any new changes.  So if I create 100 reports with standard heading subreport, I would need to manually open and re-import that file in each report to update a report heading change.
    Does not sound real fun.
    Is all this true?
    Thanks,
    Tim

  • Tree upsets SQL report on same page

    I have placed a tree on the same page as an SQL report and every time I collapse or expand a tree branch the report comes back with :-
      failed to parse SQL query:
      ORA-06502: PL/SQL: numeric or value error: NULL index table key value
    The URL given when a tree action is taken looks like this "f?p=139:10:7279140003773292621:CONTRACT,1"
    I have removed the tree and found that if I call the page ( now without a tree at all, just an SQL report ) with the URL above the report still fails. Here is the SQL for my report -
     select E.EMP_ID,   E.LAST_NAME||', '||E.FIRST_NAME Name, E.MOD_AGS, E.AVAILABLE4RECALL, M.FIRST_NAME||' '||M.LAST_NAME MANAGER_ID, E.ENABLED, '(' || S.ABBREVIATION || ')' Abbreviation
     from EMPLOYEES E, EMPLOYEES M, STATES S
     where E.MANAGER_ID = M.EMP_ID and E.STATE_ID = S.STATE_ID
    nothing too fancy there? Can I have a tree on the same page as an SQL report???
    I have tried re-creating the page again from scratch and the same thing happens.

    I'm having a similar problem.
    I have a tree on the same page as an Easy Report. When I expand or collapse the tree I get:
    failed to parse SQL query:
    ORA-06502: PL/SQL: numeric or value error: NULL index table key value
    in the Report Region.
    If I don't set a Sort on any column in the Report Attributes, then I don't get the error.
    The report uses a bind variable. Here's the debug:
    0.13: show report 5
    0.13: set report template: user defined template
    0.13: determine column headings
    0.13: activate sort
    0.13: is numeric ?
    0.13: parse query
    0.13: binding: ":APP_CURR_LOC_ID"="APP_CURR_LOC_ID" value="14"
    failed to parse SQL query:
    ORA-06502: PL/SQL: numeric or value error: NULL index table key value
    I'm using version 1.4.4.00.33.
    Anyone got any ideas?
    BTW, debug switches off when you exapand and collapse the tree.

  • SQL Report Writing blank lines or Formfeeds

    I have a SQL Report that prints the data out correctly. My problem is there are several formfeeds or blank lines written at the top of the spool file. The report prompts users for information, does several calls to the database to create headings, creates 3 temp tables. The temp tables are:
    TEMP1 - gathers information that is summed in TEMP2
    TEMP2 - stores data from temp1 that has been summed
    TEMP3 - creates the report using data from TEMP2 and other tables
    A command file calls the sql file. Inside of the command file is the call to the spool file. Overview of code:
    set trimspool on When these are on I get formfeeds. When they
    set trimout on are off, it prints blank lines.
    set heading off
    set echo off
    set feedback off
    set verify off
    set newpage 1
    set space 0
    set pagesize 60
    set linesize 160
    clear columns
    prompt user for information
    create headings and titles by quering various tables
    create and insert data into TEMP1
    create and insert data into TEMP2
    create, insert, and update data into TEMP3
    BEGIN report with TTITLE
    SELECT * from TEMP3
    end of report.
    When I run the report in sql without using the command file, I get the same results.
    Any suggestions as to what is creating this or how to get rid of it?
    Thanks for your help,
    Penny

    Yes I have a suggestion.
    Please move your spool line to just before the SELECT statement.
    [not_meaning_to_be_sarcastic__really]
    I have another suggestion. Please move your spool line to just before the SELECT statement.
    Maybe if I say it enough times - you might actually take and try the suggestion. I find it useful when I ask people questions, to listen to them.
    [not_meaning_to_be_sarcastic__really]
    I mean no offense - but I gave you that answer days ago and it doesn't seem like you have tried it yet. TTITLE will be fired off when the SELECT is called, there is no need to have the 'spool' before the TTITLE.
    It will take you maybe - tops - 10 minutes to give it a try - what'do'ya say - give'her'a'spin?
    -- all your junk that creates form feeds or line feeds
    SPOOL file_name_to_spool_to
    SELECT * from TEMP3;
    SPOOL OFF
    -- etc.

  • Can a process update report Headings?

    Does anyone know how to use a process to directly update Report Headings, perhaps using the HTMLDB API? I need dynamic headings determined at run time, but I cannot use the PL/SQL Headings Type because I have too many columns in the report (the delimited headings string exceeds HTMLDB's length limit).

    500 columns!
    I thought there was a limit of 60 columns on report regions.
    In any case, there is also a limit on the total size of each row returned (regardless of number of columns). Are you not running into that limitation?
    See the discussion at Re: Report with Tabs - Enhancement Request? , that might help you. Basically, break the 500 columns into groups that make sense and put each set of columns in a tab and flip between them using the techniques in that thread.
    This way, each report has a more manageable number of columns and you can stay under the varchar2(4000) limit.
    [Carl's example page is at http://htmldb.oracle.com/pls/otn/f?p=11933:55]
    Hope this helps.

  • Pop up text on clicking link on a sql report

    Hi
    I'm using apex 3.2
    I've a sql report like below
    taskId(edit) Task_details Notes owner .....
    What I want to do is if I click on taskId which is edit link ,pop up text box should open where I can add notes to that row.
    How can I achive this?
    Thanks in advance

    Hi,
    Take a look at the following blog posts and see if they can help you get what you are looking for (there are sample applications in them showing the functionality):
    http://monkeyonoracle.blogspot.com/2010/07/modal-pop-up-with-dynamic-actions.html
    http://www.danielmcghan.us/2008/12/popup-in-report.html
    Hope that's useful for you.
    Regards,
    Sergio

  • Dublicate Value In HTML PL/SQL Report

    hi,
    i have to enter item name and item Price iinto transaction_details by using a form and labour Work, labour amount into LAB_WORK_DTL table using a form .
    Now Problem is when i fetch these value in to PL/SQL Report then it's shows me double value like My Total Amount is 100 Then It show Me 200 and if there is two Values eg A , B then in report it's shows me A ,B , A, B, these two Value Shows Me in four Rows .How can i remove Dublicate Values .Why it does show me that double value . My code is below
    How can i remove this problem .
    declare
    SA NUMBER;
    tot number;
    TH NUMBER;
    va number;
    am number;
    lst number;
    tst number;
    st NUMBER;
    cursor c2 is select
    T.VAT,
    SUM(T.AMOUNT) AMOUNT,
    SUM(T.VAT_AMOUNT) VAT_AMOUNT
    from transaction_details T FULL JOIN LAB_WORK_DTL L
    ON T.BILL_NO = L.BILL_NO
    WHERE T.BILL_NO = :P27_BILL_NO
    GROUP BY T.bill_no,t.vat, T.bill_date, T.vehicle_no, T.PARTY_NAME;
    BEGIN
    FOR x IN(SELECT t.item_name, t.qty,t.rate, t.bill_no
    FROM transaction_details t,LAB_WORK_DTL l where t.bill_no=l.bill_no(+) and t.bill_no=:p27_bill_no
    LOOP
    HTP.P('<tr>
    <td width="2%"> </td>
    <td width="55%" align="left"> '|| HTF.escape_sc (x.item_name)||'</td>
    <td width="15%" ALIGN="right">'|| HTF.escape_sc (x.qty)||'</td>
    <td width="15%" ALIGN="right">'|| HTF.escape_sc (x.rate)||'</td>
    <td width="25%" ALIGN="right">'|| HTF.escape_sc (x.qty)* HTF.escape_sc (x.rate)||'
    </td>
    </tr>');
    END LOOP;
    tot:=0;
    bc:=0;
    KA:=0;
    open c2;
    loop
    FETCH c2 INTO va,am,vat_am;
    exit when c2%notfound;
    tot:=nvl(tot+am,0);
    bc:=nvl(bc+vat_am,0);
    end loop;
    close c2;
    HTP.P('<tr>
    <td width="38">  </td>
    <td width="29"> </td>
    <td width="447"> </td>
    <td>  </td>
    <td width="173">
    <p align="Right">-------------------</td>
    </tr>
    <tr>
    <td width="38"> </td>
    <td width="447"> TOTAL</td>
    <td> </td>
    <td width="95"></td>
    <td width="172">
    <p align="right">'
    || nvl(HTF.escape_sc (tot),0)
    ||'</td>
    </tr>');
    </table></body>
    </html>');
    END;
    Thanks
    Manoj Kaushik
    Edited by: Manoj Kaushik on Apr 8, 2010 11:01 PM

    hi,
    this is my Complete Code But I facing Dublicate Value Error .
    In that Code In Total Amount Of All Item Price Show me Jus Double.
    How Can I remove it.
    declare
    a number;
    bd date;
    b varchar2(20);
    c varchar2(50);
    d varchar2(50);
    e varchar2(50);
    f varchar2(50);
    g varchar2(50);
    h varchar2(4000);
    la NUMBER;
    p NUMBER;
    SA NUMBER;
    K NUMBER;
    FA NUMBER;
    HA NUMBER;
    KA NUMBER;
    KH NUMBER;
    MA NUMBER;
    cnt NUMBER;
    tot number;
    l number;
    TH NUMBER;
    FS NUMBER;
    va number;
    am number;
    vat_am number;
    bc NUMBER;
    lst number;
    tst number;
    st NUMBER;
    c_tra number;
    c_lab number;
    cursor c1 is select T.bill_no,T.bill_date,T.vehicle_no,T.PARTY_NAME
           from  transaction_details T FULL JOIN LAB_WORK_DTL L
    ON    T.BILL_NO = L.BILL_NO
    WHERE T.BILL_NO = :P27_BILL_NO
    GROUP BY T.bill_no, T.bill_date, T.vehicle_no, T.PARTY_NAME;
    cursor c2 is select
           T.VAT,
           SUM(T.AMOUNT) AMOUNT,
           SUM(T.VAT_AMOUNT) VAT_AMOUNT
    from  transaction_details T FULL JOIN LAB_WORK_DTL L
    ON    T.BILL_NO = L.BILL_NO
    WHERE T.BILL_NO = :P27_BILL_NO
    GROUP BY T.bill_no,t.vat, T.bill_date, T.vehicle_no, T.PARTY_NAME;
    cursor c3 is select L.service_tax,SUM(L.LABOUR_AMT) LABOUR_AMT,
           SUM(L.SERVICE_TAX_AMT) SERVICE_TAX_AMT
    from  transaction_details T FULL JOIN LAB_WORK_DTL L
    ON    T.BILL_NO = L.BILL_NO
    WHERE T.BILL_NO = :P27_BILL_NO
    GROUP BY T.bill_no,L.service_tax, T.bill_date, T.vehicle_no, T.PARTY_NAME;
    cursor c4 is select
           T.VAT,
           SUM(T.AMOUNT) AMOUNT,
           SUM(T.VAT_AMOUNT) VAT_AMOUNT
    from  transaction_details T FULL JOIN LAB_WORK_DTL L
    ON    T.BILL_NO = L.BILL_NO
    WHERE T.BILL_NO = :P27_BILL_NO
    GROUP BY T.bill_no,t.vat, T.bill_date, T.vehicle_no, T.PARTY_NAME;
    cursor c5 is select L.service_tax,SUM(L.LABOUR_AMT) LABOUR_AMT,
           SUM(L.SERVICE_TAX_AMT) SERVICE_TAX_AMT
    from  transaction_details T FULL JOIN LAB_WORK_DTL L
    ON    T.BILL_NO = L.BILL_NO
    WHERE T.BILL_NO = :P27_BILL_NO
    GROUP BY T.bill_no,L.service_tax, T.bill_date, T.vehicle_no, T.PARTY_NAME;
    BEGIN
    select chasis_no,ENGINE_NO,MAKE,MILEAGE into c,d,e,f from VEHICLE_DETAILS where vehicle_no =:P27_VEHICLE_NO;
    select ADDRESS into h from PARTY_DETAILS where PARTY_NAME =:p27_PARTY_NAME;
    open c1;
    FETCH c1 INTO a,bd,b,g;
    htp.p('<html>
    <body leftmargin="0" rightmargin="0">
    <table border="1" width="100%" bordercolorlight="#003366" cellspacing="0" bordercolordark="#003366" id="table1">
         <tr>
              <td colspan="2">
              <table border="1" width="100%" cellspacing="0" cellpadding="0" id="table3">
                   <tr>
                        <td width="50"> </td>
                        <td width="21"> </td>
                        <td> </td>
                   </tr>
    <tr>
    <td width="50"><b>
    </b></td>
    <td width="21"><b></b></td>
    <td align ="left">
    <font size="4" face="Arial Black">'||HTF.escape_sc(g)||'</font></td>
                   </tr>
                   <tr>
                        <td width="50"> </td>
                        <td width="21"> </td>
                        <td> </td>
                   </tr>
                   <tr>
         <td width="50"><b>
         </b></td>
                   <td width="60"><b></b></td>
    <td rowspan="4">
    <font size="4" face="Arial Black">'||HTF.escape_sc(h)||'</font></td>
                   </tr>
                   <tr>
                        <td width="50"> </td>
                        <td width="21"> </td>
                   </tr>
                   <tr>
                        <td width="50"> </td>
                        <td width="21"> </td>
                   </tr>
                   <tr>
                        <td width="50"> </td>
                        <td width="21"> </td>
                   </tr>
              </table>
              </td>
              <td width="44%" colspan="3">
              <table border="1" width="100%" cellspacing="0" cellpadding="0" id="table4">
                   <tr>
                        <td width="53"> </td>
                        <td width="104"><b></b></td>
                        <td width="10"></td>
                        <td ><font size="5" face="Arial Black">     ' || HTF.escape_sc(a) ||'</font> </td>
                   </tr>
                   <tr>
                        <td width="53"> </td>
                        <td width="104"><b></b></td>
                        <td width="10"></td>
         <td ><font size="5" face="Arial Black">     ' || HTF.escape_sc(bd) ||'</font></td>
                   </tr>
                   <tr>
                        <td width="53"> </td>
                        <td width="104"><b>
                        </b></td>
                        <td width="10"></td>
              <td ><font size="5" face="Arial Black">     '|| HTF.escape_sc(b) ||'</font> </td>
                   </tr>');
    CLOSE c1;
                   htp.p('<tr>
                        <td width="53"> </td>
                        <td width="104"><b>
                        </b></td>
                        <td width="10"></td>
         <td ><font size="5" face="Arial Black">     ' || HTF.escape_sc (c) ||'</font></td>
                   </tr>
                   <tr>
                        <td width="53"> </td>
                        <td width="104"><b>
                        </b></td>
                        <td width="10"><b></b></td>
                        <td ><font size="5" face="Arial Black">     ' || HTF.escape_sc (d) ||'</font></td>
                   </tr>
                   <tr>
                        <td width="53"> </td>
                        <td width="104"><b>
                        </b></td>
                        <td width="10"><b></b></td>
                        <td ><font size="5" face="Arial Black">     ' || HTF.escape_sc (e) ||'</font></td>
                   </tr>
                   <tr>
                        <td width="53"> </td>
                        <td width="104"><b>
                        </b></td>
                        <td width="10"><b></b></td>
                        <td ><font size="5" face="Arial Black">     ' || HTF.escape_sc (f) ||'</font></td>
                   </tr>
              </TABLE>
              </td>
         </tr>
    <tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
    <tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
    <tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
    <tr><td><br></td><td><br></td><td><br></td><td><br></td><td><br></td></tr>
    select count(*) into c_tra from transaction_details  where bill_no=:p27_bill_no;
    select count(*) into c_lab from lab_work_dtl  where bill_no=:p27_bill_no;
    if c_tra>0 and c_lab=NULL then
    FOR x IN(SELECT distinct t.item_name, t.qty,t.rate, t.bill_no
    FROM transaction_details t,LAB_WORK_DTL l  where t.bill_no=l.bill_no(+) and t.bill_no=:p27_bill_no
    LOOP
         HTP.P('<tr>
              <td width="2%"> </td>
              <td width="55%"  align="left"> '|| HTF.escape_sc (x.item_name)||'</td>
              <td width="15%" ALIGN="right">'|| HTF.escape_sc (x.qty)||'</td>
              <td width="15%" ALIGN="right">'|| HTF.escape_sc (x.rate)||'</td>
              <td width="25%" ALIGN="right">'|| HTF.escape_sc (x.qty)* HTF.escape_sc (x.rate)||'
              </td>
         </tr>');
    END LOOP;
    tot:=0;
    bc:=0;
    KA:=0;
    open c2;
    loop
    FETCH c2 INTO va,am,vat_am;
    exit when c2%notfound;
    tot:=nvl(tot+am,0);
    bc:=nvl(bc+vat_am,0);
    end loop;
    close c2;
    KA :=nvl(tot+bc,0);
    HTP.P('<tr>
    <td width="38">  </td>
    <td width="29"> </td>
    <td width="447"> </td>
    <td>  </td>
    <td width="173">
    <p align="Right">-------------------</td>
    </tr>
    <tr>
    <td width="38"> </td>
    <td width="447"> TOTAL</td>
    <td> </td>
    <td width="95"></td>
    <td width="172">
    <p align="right">'
    || nvl(HTF.escape_sc (tot),0)
    ||'</td>
    </tr>');
    open c4;
    loop
    FETCH c4 INTO va,am,vat_am;
    exit when c4%notfound;
    HTP.P('<tr>
    <td width="38">  </td>
    <td width="446"> VAT  '||nvl(HTF.escape_sc (va),0)||'% OF Rs.'||nvl(HTF.escape_sc (am),0)||'</td>
    <td width="116"> </td>
    <td></td>
    <td width="172">
    <p align="right">'
    || nvl(HTF.escape_sc (vat_am),0)
    ||'</td>
    </tr>');
    end loop;
    CLOSE c4;
    HTP.P('<tr>
    <td>  </td>
    <td width="30">  </td>
    <td width="118">  </td>
    <td width="95"> </td>
    <td width="173">
    <p align="Right">------------------</td>
    </tr>
    <tr>
    <td>  </td>
    <td width="446" align="left"> TOTAL</td>
    <td width="118"> </td>
    <td width="95"></td>
    <td width="173">
    <p align="right">'
    || nvl(HTF.escape_sc (KA),0)
    ||'</td>
    </tr>
    <tr>
    <td>  </td>
    <td width="446" align="left"> LABOUR CHARGES :-</td>
    <td width="118"> </td>
    <td width="95"></td>
    <TD width="173"></td>
    </tr>');
    elsif c_lab>0 and c_tra=NULL THEN
    FOR Y IN(SELECT l.WORK_DETAIL,l.LABOUR_AMT
    FROM transaction_details t,LAB_WORK_DTL l WHERE t.bill_no(+) =l.bill_no and l.bill_no =:P27_BILL_NO
    LOOP
         HTP.P('<tr>
    <td>  </td>
    <td width="446" align="left"> '||nvl(HTF.escape_sc (Y.WORK_DETAIL),0)||'</td>
    <td width="118"> </td>
    <td width="95"></td>
    <td width="173">
    <p align="right">'|| nvl(HTF.escape_sc(Y.LABOUR_AMT),0)||'</td>
    </tr>');
    END LOOP;
    HTP.P('
    <TR>
    <td>  </td>
    <td width="30"> </td>
    <td width="118"> </td>
    <td width="95"></td>
    <td width="173">  </td>
    </tr>');
    HTP.p ( '<tr>
    <td width="36">  </td>
    <td width="445"> </td>
    <td>  </td>
    <td width="97"> </td>
    <td width="172">
    <p align="Right">------------------</td>
    </tr>');
    sa:=0;
    lst:=0;
    open c3;
    loop
    FETCH c3 INTO st,la,p;
    exit when c3%notfound;
    sa:=nvl(sa+la,0);
    lst:=nvl(lst+p,0);
    end loop;
    close c3;
    TH:=nvl(sa+lst,0);
    FS:=KA+TH;
         htp.p('<tr>
    <td width="36">  </td>
    <td width="445"> TOTAL</td>
    <td> </td>
    <td width="97"></td>
    <td width="172">
    <p align="right">'
    ||nvl(ROUND(HTF.escape_sc (sa),2),0)
    ||'</td>
    </tr>');
    open c5;
    loop
    FETCH c5 INTO st,la,p;
    exit when c5%notfound;
    htp.p('<tr>
    <td width="36">  </td>
    <td width="445"> SERVICE TAX '||nvl(HTF.escape_sc (st),0)||' OF Rs.'||nvl(ROUND(HTF.escape_sc (la),2),0)||'</td>
    <td> </td>
    <td width="97"></td>
    <td width="172">
    <p align="right">'
    || nvl(ROUND(HTF.escape_sc(p),2),0)
    ||'</td>
    </tr>');
    end loop;
    close c5;
    htp.p('<tr>
    <td width="36">  </td>
    <td width="445"> </td>
    <td>  </td>
    <td width="97"> </td>
    <td width="172">
    <p align="Right">------------------</td>
    </tr>');
    htp.p('<tr>
    <td width="36">  </td>
    <td width="445" align="left"> BILL AMOUNT</td>
    <td> </td>
    <td width="97"></td>
    <td width="172" align="right">
    <p >'||ROUND(HTF.escape_sc (FS),2)||'</td>
    </tr>
    <tr>
    <td width="36">  </td>
    <td width="445">
    <p align="left"> '|| f_words(HTF.escape_sc (FS))||'</td>
    <td>  </td>
    <td width="97"> </td>
    <td width="172">
    <p align="Right">------------------</td>
    </tr>');
    ELSE
    FOR x IN(SELECT t.item_name, t.qty,t.rate, t.bill_no
    FROM transaction_details t where t.bill_no=:p27_bill_no
    LOOP
         HTP.P('<tr>
              <td width="2%"> </td>
              <td width="55%"  align="left"> '|| HTF.escape_sc (x.item_name)||'</td>
              <td width="15%" ALIGN="right">'|| HTF.escape_sc (x.qty)||'</td>
              <td width="15%" ALIGN="right">'|| HTF.escape_sc (x.rate)||'</td>
              <td width="25%" ALIGN="right">'|| HTF.escape_sc (x.qty)* HTF.escape_sc (x.rate)||'
              </td>
         </tr>');
    END LOOP;
    tot:=0;
    bc:=0;
    KA:=0;
    open c2;
    loop
    FETCH c2 INTO va,am,vat_am;
    exit when c2%notfound;
    tot:=nvl(tot+am,0);
    bc:=nvl(bc+vat_am,0);
    end loop;
    close c2;
    KA :=nvl(tot+bc,0);
    HTP.P('<tr>
    <td width="38">  </td>
    <td width="29"> </td>
    <td width="447"> </td>
    <td>  </td>
    <td width="173">
    <p align="Right">-------------------</td>
    </tr>
    <tr>
    <td width="38"> </td>
    <td width="447"> TOTAL</td>
    <td> </td>
    <td width="95"></td>
    <td width="172">
    <p align="right">'
    || nvl(HTF.escape_sc (tot),0)
    ||'</td>
    </tr>');
    open c4;
    loop
    FETCH c4 INTO va,am,vat_am;
    exit when c4%notfound;
    HTP.P('<tr>
    <td width="38">  </td>
    <td width="446"> VAT  '||nvl(HTF.escape_sc (va),0)||'% OF Rs.'||nvl(HTF.escape_sc (am),0)||'</td>
    <td width="116"> </td>
    <td></td>
    <td width="172">
    <p align="right">'
    || nvl(HTF.escape_sc (vat_am),0)
    ||'</td>
    </tr>');
    end loop;
    CLOSE c4;
    HTP.P('<tr>
    <td>  </td>
    <td width="30">  </td>
    <td width="118">  </td>
    <td width="95"> </td>
    <td width="173">
    <p align="Right">------------------</td>
    </tr>
    <tr>
    <td>  </td>
    <td width="446" align="left"> TOTAL</td>
    <td width="118"> </td>
    <td width="95"></td>
    <td width="173">
    <p align="right">'
    || nvl(HTF.escape_sc (KA),0)
    ||'</td>
    </tr>
    <tr>
    <td>  </td>
    <td width="446" align="left"> LABOUR CHARGES :-</td>
    <td width="118"> </td>
    <td width="95"></td>
    <TD width="173"></td>
    </tr>');
    FOR Y IN(SELECT l.WORK_DETAIL,l.LABOUR_AMT
    FROM LAB_WORK_DTL l where l.bill_no =:P27_BILL_NO
    LOOP
         HTP.P('<tr>
    <td>  </td>
    <td width="446" align="left"> '||nvl(HTF.escape_sc (Y.WORK_DETAIL),0)||'</td>
    <td width="118"> </td>
    <td width="95"></td>
    <td width="173">
    <p align="right">'|| nvl(HTF.escape_sc(Y.LABOUR_AMT),0)||'</td>
    </tr>');
    END LOOP;
    HTP.P('
    <TR>
    <td>  </td>
    <td width="30"> </td>
    <td width="118"> </td>
    <td width="95"></td>
    <td width="173">  </td>
    </tr>');
    HTP.p ( '<tr>
    <td width="36">  </td>
    <td width="445"> </td>
    <td>  </td>
    <td width="97"> </td>
    <td width="172">
    <p align="Right">------------------</td>
    </tr>');
    sa:=0;
    lst:=0;
    open c3;
    loop
    FETCH c3 INTO st,la,p;
    exit when c3%notfound;
    sa:=nvl(sa+la,0);
    lst:=nvl(lst+p,0);
    end loop;
    close c3;
    TH:=nvl(sa+lst,0);
    FS:=KA+TH;
         htp.p('<tr>
    <td width="36">  </td>
    <td width="445"> TOTAL</td>
    <td> </td>
    <td width="97"></td>
    <td width="172">
    <p align="right">'
    ||nvl(ROUND(HTF.escape_sc (sa),2),0)
    ||'</td>
    </tr>');
    open c5;
    loop
    FETCH c5 INTO st,la,p;
    exit when c5%notfound;
    htp.p('<tr>
    <td width="36">  </td>
    <td width="445"> SERVICE TAX '||nvl(HTF.escape_sc (st),0)||' OF Rs.'||nvl(ROUND(HTF.escape_sc (la),2),0)||'</td>
    <td> </td>
    <td width="97"></td>
    <td width="172">
    <p align="right">'
    || nvl(ROUND(HTF.escape_sc(p),2),0)
    ||'</td>
    </tr>');
    end loop;
    close c5;
    htp.p('<tr>
    <td width="36">  </td>
    <td width="445"> </td>
    <td>  </td>
    <td width="97"> </td>
    <td width="172">
    <p align="Right">------------------</td>
    </tr>
    <tr>
    <td width="36">  </td>
    <td width="445" align="left"> BILL AMOUNT</td>
    <td> </td>
    <td width="97"></td>
    <td width="172" align="right">
    <p >'||ROUND(HTF.escape_sc (FS),2)||'</td>
    </tr>
    <tr>
    <td width="36">  </td>
    <td width="445">
    <p align="left"> '|| f_words(HTF.escape_sc (FS))||'</td>
    <td>  </td>
    <td width="97"> </td>
    <td width="172">
    <p align="Right">------------------</td>
    </tr>');
    END IF;
    HTP.P('</table>
    </body>
    </html>');
    END;                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

  • Add Image column in classic sql report to open a pop page

    I have sql report I want to add a new column which will have image to click, Once user clicks the image a popup page should open.

    Hi Vikram,
    Sorry to bother you, I am very new to apex. Here is my sql query for sql report. Can you please help me.
    <xmp>select
    case
    when ISUPPORT_NUMBER is null or ISUPPORT_NUMBER = 'N/A' then '<a href="javascript:myFunc3(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">Enter SR Number</p></a>'
    else '<span style="background-color:red;font-weight:bold">'
    || ISUPPORT_NUMBER
    || '</span>'
    end ISUPPORT_NUMBER,
    case
    when ISUPPORT_NUMBER is not null and ISUPPORT_NUMBER != 'N/A' then '<a href="javascript:myFunc4(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#FF0000;font-size:14px;">'|| MACHINE_NAME ||'</p></a>'
    else '<a href="javascript:myFunc4(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:14px;">'|| MACHINE_NAME ||'</p></a>'
    end MACHINE_NAME,
    FUNCTION,
    VERSION,
    VENDOR_CLUSTER,
    case when used_by is null then '<a href="javascript:myFunc2(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">Avaliable</p></a>'
    when upper(used_by)=v('APP_USER') then '<a href="javascript:myFunc5(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:blue;font-size:12px;">' || used_by || '</p></a>'
    else used_by
    end used_by,
    case
    when loaned_to is null and ( upper(used_by)=v('APP_USER') or used_by is null) then '<a href="javascript:myFunc(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">Avaliable</p></a>'
    when upper(used_by)=v('APP_USER') then '<a href="javascript:myFunc6(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:blue;font-size:12px;">' || loaned_to || '</p></a>'
    else loaned_to
    end loaned_to,
    LOANED_TO_EXPIRY_DATE,
    LOAN_INFO,
    decode(SCAN_NAME,null,'<a href="javascript:myFunc3(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">More Details</p></a>','<a href="javascript:myFunc3(''' || MACHINE_NAME || ''')"><p style="font-weight:bold;color:#04B404;font-size:12px;">More Details</p></a>') SCAN_NAME,
    USERNAME,
    VNC_PASSWORD,
    LAST_UPDATED_BY , </xmp>
    <b>Here I want to add a image column where I can give a link like above to open popup </b>
    from install_dbqa_machines
    Edited by: Sivaramaraju on Jun 19, 2012 9:06 AM
    Edited by: Sivaramaraju on Jun 19, 2012 9:07 AM
    Edited by: Sivaramaraju on Jun 19, 2012 9:08 AM

  • [Interface] - Passing variety parameters/input to PL/SQL report

    Hi,
    I've the PL/SQL report which can allow passing in the parameter, i use '&'.
    the report is given to the end user who do not have the IDE for PL/SQL. the machanism of the report is generated into the spool file and import into excel format.
    now i am wondering how to create a tool using SQL or PL/SQL to allow the end user to choose the parameter(s) dynamically and passing into the PL/SQL to generate the report based on the input selected.
    the parameters like below:
    package code :
    week no :
    year :
    department :
    all the above parameters, the data would be selected from the existing lookup table. the user is allow to select more than 1 input for specified parameter for instance i want to spool report for week 1 until week 5.
    pls advise any solution on this topic. thanks

    hi scoot,
    thank for reply.
    yep, i'm using sql*plus and also sql navigator 4.0 .
    the user don't have the software to interact. i'm thinking of build an simple interface using VB and passing in the parameter then initiate the sql*plus to run the program in background mode.
    but if you have any other solution which not need to use other software to wirte such program , pls let me know immediately. thank

Maybe you are looking for