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.

Similar Messages

  • 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

  • Dynamic SQL report  on Oracle apex4.0

    Hi Everyone,
    I have two reports in one page.One is the Interactive and other is Sql report. Based on the selection of the row(using checkbox) in the interactive report, the sql report has to display the selected columns.
    Note :The report has to be loaded whenever a row is selected and without submitting a button
    Can anyone please suggest?
    I am using oracle Apex4.0
    Regards
    Raj

    I believe you store the values in the checkboxes. For example, your Interactive Report query looks like:
    SELECT '<input type=checkbox value='||OBJID||' />' AS CHECKBOX, T.*
    FROM SOME_TABLE T
    and in "Report Atributes" the CHECKBOX is displayed as "Standard Report Column".
    *1.Create a hidden check list input field.*
    It will store a list values of selected checkboxes. make it long enough, eg. 1000.
    Let's say the input name is: P000_X_CHECK_LIST
    *2. Create Dynamic Action*
    This dynamic action is supposed to fill in the P000_X_CHECK_LIST with a list of values, separated by ":" character.
    These values will be an input for the SQL report.
    Name: Update Check List
    Event: Change
    Selection Type: jQuery Selector
    jQuery Selector: input:checkbox
    Action: Set Value
    Set Type: JavaScript Expression
    function check_list() {
    var n = "";
    $(":checked").each( function () {
    n = n + (n === "" ? "" : ":") + $(this).val();
    return n;
    check_list();
    Selection Type: Item(s) - P000_X_CHECK_LIST
    *3. Adjust the "SQL report" query with this magic formula*
    AND SEARCHED_ITEM IN (
    SELECT item
    FROM (SELECT REGEXP_SUBSTR (str, '[^:]+', 1, LEVEL) item
    FROM (SELECT :P000_X_CHECK_LIST str
    FROM DUAL)
    CONNECT BY LEVEL <= length (regexp_replace (str, '[^:]+')) + 1)
    for example:
    SELECT O.*
    FROM SOME_OTHER_TABLE O
    WHERE SEARCHED_ITEM IN (
    SELECT item
    FROM (SELECT REGEXP_SUBSTR (str, '[^:]+', 1, LEVEL) item
    FROM (SELECT *:P000_X_CHECK_LIST* str
    FROM DUAL)
    CONNECT BY LEVEL <= length (regexp_replace (str, '[^:]+')) + 1)
    *4. Adjust the Dynamic Action:*
    Advanced: Event Scope: "live"
    *5. Add one more True action to the Dynamic Action:*
    Action: Refresh
    Selection type: Region
    Region: The region of the "SQL report".
    Volia!
    Best regards,
    Krzysztof

  • Dynamic SQL Report

    Hi everybody
    I want to build a dynamqi sql query to use in a report. What is dynamic is the name of the table I want to request. I have a nice item named P8-ECHELLE, a select List with a LOV returning a part of the name.
    For example the select list returns "E034". I want to add this part of the name to the beginning of the name of the table which is "EVV_" in order to get the name of the table which would be "EVV_E034'.
    The select would like this : SELECT * FROM SIVOA.EVV_E034
    This is the code :
    DECLARE
    x VARCHAR2 (4000);
    BEGIN
    x := 'SELECT * FROM SIVOA.EVV_' || :P8_ECHELLE ;
    RETURN (x);
    END;
    I get an error : "failed to parse SQL query: ORA-00942: table or view does not exist"
    Coudl you help ?
    Christian
    PS : thank to D. Kubicek for his example !

    This is the code.
    DECLARE
    x VARCHAR2 (4000);
    BEGIN
    x :=
    'SELECT * '
    || 'FROM EMP '
    || 'WHERE 1=1 '
    || CASE
    WHEN :p184_ename IS NOT NULL
    THEN 'AND UPPER(ename) LIKE '''
    || UPPER (:p184_ename)
    || '''||''%'' '
    ELSE NULL
    END
    || CASE
    WHEN :p184_deptno IS NOT NULL
    THEN 'AND INSTR('':''||'
    || ''''
    || :p184_deptno
    || ''''
    || '||'':'', '':''||deptno||'':'') &gt; 0'
    ELSE NULL
    END;
    RETURN (x);
    END;

  • PLSQL function body returning an sql report returns ORA-01403 No Data Found

    I am on APEX 3.1.2.00.02 and Oracle 10g.
    I am developing a report with SQL Query (PL/SQL function body returning SQL query) type. But on running the report I am getting
    report error:
    ORA-01403: no data found
    Region Source
    declare
      qry varchar2(32767);
    begin
      --Procedure call
      my_pkg.get_query(qry);
      htp.p(qry);
      return /*select 1 from dual */ qry;
    end;
    Procedure
    PROCEDURE get_query (V_QRY OUT VARCHAR2)
    IS
      qry varchar2(32767);
    begin
      qry := ' select name
         , max(decode(to_char(service_date,''Mon-YY''), ''Jan-09'', value, null)) as "Jan-09"
         , max(decode(to_char(service_date,''Mon-YY''), ''Jan-09'', value, null)) as "Feb-09"
         from MY_TABLE
         group by name ';
      V_QRY := qry;
    end;
    The query will be enhanced later to add more months and year based on user parameters once I am successfull in running report on this.
    I wish to use Query Specific Column names. I have seen this suggestion from Scott in a number of threads to use /*select 1 from dual */ with query but not working in my case.
    Can someone please suggest what can I do to make it working?
    Regards,
    Amir

    Firstly, have you unit tested the procedure (namely, within the SQL Workshop, SQL*Plus, SQL Developer,etc, etc.) to see if it produces the right output in the first place?
    If you have, and the query string generated is valid, try assigning the output to a page item (thus allowing you to view it in the session browser) or even pass the procedure output into the debug window (with the use of the wwv_flow.debug function). This might reveal some state or session change which is causing it not to return.You might find this easier to achieve if you change from a 'procedure and out parameter' combination to a 'function returning string' approach.
    Alternatively, try re-creating the report in a new region - occasionally I've come across weird bugs with report regions which resolved themselves in this manner.

  • Erratic Report Region Behavior with Dynamic SQL Queries

    I'm running HTMLDB v 1.5.1.00.12 and I've noticed some odd behavior with report regions using dynamic SQL queries. Every so often, our testers will run a page containing a dynamic sql report region and get the following error, (despite the fact the query was working only moments ago and no other developer has touched it):
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    or sometimes
    failed to parse SQL query:ORA-01403: no data found
    The only solution I've found so far is to:
    1) Make a copy of the failed report region.
    2) Disable or delete the original failed report region.
    The new copy of the report region runs without issue.
    My search of the forums turned up the following two threads, but neither provided me with a clear explanation of the cause, and how to avoid it:
    ORA-06502:PL/SQL: numeric or value error: character string buffer too small
    Re: Import Export Error (ORA-06502)
    The columns being returned are below the 4000 character limit, and the rows being returned are far less than 32k in size.
    Could this have anything to do with the way HTMLDB is internally storing the PL/SQL used to generate the dynamic SQL Query? Is there any known issue related to this with that version of HTMLDB?
    This problem occurs without any discernable pattern or consistency, making it hard to determine where I should focus my efforts in tracking down the cause.

    Hi all,
    My report seems to be behaving correctly once i set it to "Use Generic Column Names (parse query at runtime only)" :)
    Cheers,
    Joel

  • SQL Report Region

    Hi,
    I am using apex 4.0.1 and I have a page with several SQL Report regions. The user can edit the data in the report regions by clicking a column that uses a href link to open a DML page in a modal window. The user can then amend some data in the modal window, press save which closes the modal window and uses the partial page refresh process to refresh the SQL report region. (Using apex.event.trigger('#SOME_REGION'),'apexrefresh')).
    If I navigate through the report to show rows 31-45 and then click on a href to edit a record. On pressing save, the report is refreshed but the rows displayed goes back to 1-15.
    How can I get the report to stay showing the rows 31-45?
    Cheers
    Paul.

    I believe this answers my question
    http://monkeyonoracle.blogspot.com/2010/11/refresh-report-region-and-pagination.html
    Edited by: pjturley on Jan 10, 2012 1:14 PM

  • Multiple Parameter Dynamic Query/Report

    I'm very much a newbie to both APEX and SQL. I want to create a page with two regions, one used to hold parameters (LOV Select Lists), and one to reflect a dynamic SQL report including filtering the results using the values of the items in the select lists.
    I can do this with one Parameter/LOV select list - but am not clear on how to code for multiple parameters.
    Can someone give me an example on how to code the query, to include multiple parameters (P1_Empl, P1_AssetNo, P1_AssetType, etc)? The query with 'null' parameters/filters gives you all records; with any or many parameters acting as filters the query and resulting report would reflect the value of the filters.
    In addition, is there a specific type of region that needs to be used for the report region?
    Implied is the question - how do you handle the initial page view, so no error messages are seen - I'd like to get all records as a default.
    Thanks
    Rich

    sbkenned,
    The referenced sql for that report gives me problems.
    [ P3_Department_ID is the LOV of departments ]
    [ Null allowed and null return value is -1 ]
    <code>
    SELECT e.EMPLOYEE_ID,
    e.FIRST_NAME,
    e.LAST_NAME,
    e.HIRE_DATE,
    e.SALARY,
    e.COMMISSION_PCT,
    calc_remuneration(salary, commission_pct) REMUNERATION,
    e.DEPARTMENT_ID,
    d.DEPARTMENT_NAME
    FROM OEHR_EMPLOYEES e,
    OEHR_DEPARTMENTS d
    WHERE e.DEPARTMENT_ID = d.DEPARTMENT_ID(+) AND
    (e.DEPARTMENT_ID = :P3_DEPARTMENT_ID or
    (e.DEPARTMENT_ID is null and nvl(:P3_DEPARTMENT_ID,'-1') = '-1'))
    </code>
    The where clause: I'm guessing it is checking e.deptno = d.deptno
    but then what is (+)?
    can I use the '(+) and' to add on sections for each select list/parameter?
    In the paran part of the where clause, I get the first part and the use of 'or' - but I'm not sure what the last statement is doing.
    e.deptno is null AND ?? if there is a null value in P3_Department_ID return -1 otherwise return -1 ??
    I'm lost at that point as I clearly don't understand the syntax.
    Would you suggest multiple clauses in a where statement in order to add multiple filter values, and how do I handle nulls so those filters are not used/relfected?
    I am not using a self submitting LOV select list - I am using a button to refresh the query region manually
    I am comfortable with using an interactive report, but that interface is not what I need to present.
    As I indicated - I'm weak in the SQL area and need an example on how to code this type of query.
    Thanks.
    Rich

  • Weird behavior: PLSQL-generated SQL Report Region

    I am trying to tune my PLSQL-generated SQL Report Region. I put in some code to write the resulting query to a table. I turn it on, run the page, and then turn it off and look at the SQL. Instead of getting one query for each time I load the page, I get five. Trying to find out a bit more about why, I concatenate :APP_USER and to_char(sysdate, 'hh:mi:ss') to the resulting SQL. What I find is that four of the entries in the table have my ApEx dev username, and all of these writes are 3 seconds before the SQL generated under the app username is written!
    It probably goes without saying, but in all of the writes under my dev username, there are no session values and so any PLSQL if statements that depend on a session value act as if the session values are null. Also, any place I have :APP_ID show up as 4000 in those writes instead of the app number that shows up under my app username.
    Do you follow this?
    Well, on a hunch I copied the whole region back on to the page and disabled the original. This time, no writes with the dev username, only one select statement as originally expected.
    Is that wierd or what?
    Bill

    Scott, Your last comment - that was it. I should've paid more attention to the time. The minutes must have been off. I made sure to log out of the dev environment before I ran the page, but the writes under my dev login were occurring when I saved the region. I still don't see why that process causes four identical writes, but it's not that important.
    Thanks! Now I can to working on the real problem - improving my SQL.
    Bill

  • Converting SQL Report Region to PLSQL Function Body Returning SQL Query

    All:
    I want to convert my SQL Report Region to a PLSQL-generated SQL Report Region so that I can eliminate where clauses dynamically and speed up my app, and also so that I can provide additional sorting options.
    <br><br>
    My problem is that I have lots of embedded single quotes that already are coded as 3 single quotes in the SQL Report Region. I am not sure at all how to code them within the PLSQL.
    <br><br>
    As example, here is one column from my query:
    <br><br>
    select decode(nvl(g.date_sub_1,g.date_rec_1), null, decode(g.article, 0, 'E', 1, 'U'), '< a href="javascript:unElevate( ' ' ' || g.grid || ' ' ',' ' ' || g.natca || ' ' ')">' || decode(g.article, 0, 'E', 1, 'U') || '< /a>') "Reverse" from g_table g
    <br><br>
    (Note that I added spaces within the code so it would display properly in the browser.)
    <br><br>
    To clarify, that's a double quote before javascript, and then 3 single quotes before the first concatenation group, then 3 single quotes after the second concatenation group, then 3 single quotes before the third, 3 single quotes after the fourth followed by an end-paren followed by a double quote etc.
    <br><br>
    My question is, what do I do with these triple-single quotes within PLSQL? Probably a no-brainer for the experienced folks, but I am thinking like a mobius strip at this point.
    <br><br>
    Bill
    Message was edited by:
    [email protected]
    Message was edited by:
    [email protected]
    Message was edited by:
    [email protected]

    Scott,
    I think that feature was made for my situation! I keep getting
    Function returning SQL query: Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the generic columns checkbox below the region source to proceed without parsing.
    (ORA-20001: Unable to bind :43 verify length of item is 30 bytes or less. Use v() syntax to reference items longer than 30 bytes. ORA-01006: bind variable does not exist)
    I did chop the query up into little bits, i.e.
    p_sql := p_sql || q'! ... !';
    p_sql := p_sql || q'! ... !';
    p_sql := p_sql || q'! ... !';
    return p_sql;
    But I'm not sure what I'm supposed to do here.
    Thank you.
    Bill

  • Can we use Dynamic SQL in Oracle Reports ?

    Hi ,
    Can we use Dynamic SQL in Oracle Reports ?
    If yes please give some examples .
    Thanx
    srini

    I believe the built-in package SRW.Do_Sql is what you are looking for
    Example from the document:
    /* Suppose you want to create a "table of contents" by getting the
    ** first character of a columns value, and page number on which its
    ** field fires to print. Assume that you want to put the "table of
    contents"
    ** into a table named SHIP. You could write the following construct:
    DECLARE
    PAGE_NO NUMBER;
    PAGE_FOR INDEX NUMBER;
    SORT_CHAR CHAR(1);
    CMD_LINE CHAR(200);
    BEGIN
    SORT_CHAR := :SORT_NAME ;
    IF :CALLED = Y THEN
         SRW.GET_PAGE_NUM(PAGE_FOR_INDEX);
         SRW.USER_EXIT(RWECOP PAGE_FOR_INDEX
         P_START_PAGENO);
         SRW.MESSAGE(2,TO_CHAR(:P_START_PAGENO));
    END IF;
    SRW.GET_PAGE_NUM(PAGE_NO);
    CMD_LINE := INSERT INTO SHIP VALUES
                          (||SORT_CHAR||,||TO_CHAR(PAGE_NO)||);
    SRW.MESSAGE(2,CMD_LINE);
    SRW.DO_SQL(CMD_LINE);
    COMMIT;
    EXCEPTION
      WHEN DUP_VAL_ON_INDEX THEN
            NULL;
      WHEN SRW.DO_SQL_FAILURE THEN
            SRW.MESSAGE(1,FAILED TO INSERT ROW INTO SHIP TABLE);
      WHEN OTHERS THEN
           COMMIT;
    END;

  • Report using ref cursor or dynamic Sql

    Hi,
    I never create a report using a ref cursor or a dynamic sql. Could any one help me to solve the below issue.
    I have 2 tables.
    1. Student_Record
    2. Student_csv_help
    Student_Record the main table where the data is stored.
    Student_csv_help will contain the all the column names of the Student_record.
    CREATE TABLE Student_CSV_HELP
    ENTRY_ID NUMBER,
    RAW_NAME VARCHAR2(40 BYTE),
    DESC_NAME VARCHAR2(1000 BYTE),
    IN_OUTPUT_LIST VARCHAR2(1 BYTE)
    SET DEFINE OFF;
    Insert into TOA_CSV_HELP
    (ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
    Values
    (1, 'S_ID', 'Student ID', 'Y');
    Insert into TOA_CSV_HELP
    (ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
    Values
    (2, 'S_Name', 'Student Name', 'Y');
    Insert into TOA_CSV_HELP
    (ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
    Values
    (3, 'S_Join_date', 'Joining Date', 'Y');
    Insert into TOA_CSV_HELP
    (ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
    Values
    (4, 'S_Address', 'Address', 'Y');
    Insert into TOA_CSV_HELP
    (ENTRY_ID, RAW_NAME, DESC_NAME, IN_OUTPUT_LIST)
    Values
    (5, 'S_Fee', 'Tution Fee', 'N');
    commit;
    CREATE TABLE Student_record
    S_ID NUMBER,
    S_Name VARCHAR2(100 BYTE),
    S_Join_date date,
    S_Address VARCHAR2(360 BYTE),
    S_Fee Number
    Insert into Student_record
    (S_ID, S_Name, S_Join_date, S_Address,S_Fee)
    Values
    (101, 'john', TO_DATE('12/17/2009 08:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CA-94777', 2000);
    Insert into Student_record
    (S_ID, S_Name, S_Join_date, S_Address,S_Fee)
    Values
    (102, 'arif', TO_DATE('12/18/2009 08:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CA-94444', 3000);
    Insert into Student_record
    (S_ID, S_Name, S_Join_date, S_Address,S_Fee)
    Values
    (103, 'raj', TO_DATE('12/19/2009 08:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CA-94555', 2500);
    Insert into Student_record
    (S_ID, S_Name, S_Join_date, S_Address,S_Fee)
    Values
    (104, 'singh', TO_DATE('12/20/2009 08:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CA-94666', 2000);
    Commit;
    Now my requirement is:
    I have a form with Student_record data block. When i Click on print Button on this form. It will open another window which has Student_CSV_HELP.DESC_NAME and a check box before this.
    The window look like as below:
    check_box       DESC_NAME+
    X                   S_ID+
    --                   S_Name+
    X                   S_Join_date+
    X                   S_Address+
    --                  S_Fee+
    X  means check box checked.+
    --  means check box Unchecked.+
    After i selected these check boxes i will send 2 parameters to the report server
    1. a string parameter to the report server which has the value 'S_ID,S_Join_date,S_Address' (p_column_name := 'S_ID,S_Join_date,S_Address');
    2. the s_id value from the student_record block (p_S_id := '101');
    Now my requirement is when i click on run. I need a report like as below:
    Student ID : 101+
    Joining Date : 12/17/2009 08:00:00+
    Address : CA-94777+
    This is nothing but the ref cursor should run like as below:
    Select S_id from student_record block S_id = :p_S_id;
    Select S_Join_date from student_record block S_id = :p_S_id;
    Select S_Address from student_record block S_id = :p_S_id;
    So, according to my understanding i have to select the columns at the run time. I dont have much knowledge in creating reports using ref cursor or dynamic sql.
    So please help me to solve this issue.
    Thanks in advance.

    Plain sql should satisfy your need. Try ....
    Select S_id, S_Join_date, S_Address
    from student_record
    where S_id = :p_S_id

  • Applying a Template to a Dynamic PL/SQL Report

    I have an application in which there are several reports, all based on the wizard and using standard templates.
    One of my reports, however is a Dynamic PL/SQL Report, using htp.print statements to create the output.
    I'm not quite sure, how I can specify that I want to use the same template as the rest of my reports, so as to maintain the look and feel of the whole application.
    Can someone tell me how this is done, or where I can read about it?
    Thank you.

    Sergio,
    I have a table with two columns I want to display. The columns aren't wide but there are 15 or 20 rows. What I would like is that after 10 rows the report starts another set of colums beside the first ones. The standard report continues on down so you have to scroll down to see the bottom. I'm not sure if my explanation is clear so instead of:
    1 info1
    2 info2
    3 info3
    4 info4
    5 info5
    6 info6
    I want:
    1 info1 4 info4
    2 info2 5 info5
    3 info3 6 info6
    Not being too picky, it could also be:
    1 info1 2 info2
    3 info3 4 info4
    5 info5 6 info6
    I don't see a way of doing this with standard reporting so a PL/SQL report seems to be the way to go (which works fine except for the formatting). Sorry if I've just missed it in the options. I'd prefer to do it using standard HTMLDB
    Thanks.
    Paul

  • Is there any way to hook into the SQL report pagination process?

    I have a SQL report (based on EMP) with a radiogroup row selector.
    The scenario 1 and 2 are in place
    1) When the employee row radio group is clicked the P900007_JOB the text item is populated with the JOB for the employee.
    2) When the page is initially displayed or submitted via the button the first row’s radio group is programmatically clicked and therefore populates the additional job information in P900007_JOB
    Info (radio Group) Employee No Name
    (+) 7369 SMITH
    () 7499 ALLEN
    () 7521 WARD
    P900007_JOB CLERK
    1-3 Next>
    Once the report has been displayed and the next or previous pagination is used then none of the radio groups will be selected and the data in the P900007_JOB text item will still display the job of the last selected employee row.
    What I require is on pagination some sort of mechanism to either
    a) Call the page_init() that should then set the first row as selected and populate the text item via the programmatic click. (preferred option)
    b) OR blank out the additional text item P900007_JOB.
    Is there any way to hook into the pagination process?
    I have a work around – Set the ‘Enable Partial Page Refresh’ to ‘No’ but this means a full refresh every time the pagination is used.
    Details of my page
    Report Region (Based on EMP table) – radio group as a row selector
    select     APEX_ITEM.RADIOGROUP(1,EMPNO,'X21',null) CHECKRG, EMPNO,
         ENAME,
         JOB
    from     EMP
    Report Attributes -
    Report template :- P900007_ROWTEMPLATE (custom template see later)
    Report Attributes Substitution :- id="emp_report" (used in page_init see later)
    Enable Partial Page Refresh :- Yes
    Columns – All columns are selected as show but job is left out of the template below.
    P900007_JOB - Text item in report region (disabled does not save state). Populated with the employees job when the radio group is clicked.
    Control region :- HTML region that just holds a button <GO> just to submit the page and redirect back to the same page.
    P900007_ROWTEMPLATE (named column row template)
    Row template 1
    <tr style="cursor: hand; cursor: pointer;" onmouseover="row_mouse_over(this, 1)" onmouseout="row_mouse_out(this, 1)" #HIGHLIGHT_ROW# ">
    <td class="t15data" onclick="selectRow('#JOB#');">#CHECKRG# </td>
    <td class="t15data">#EMPNO# </td>
    <td class="t15data">#ENAME# </td>
    </tr>
    Before rows
    <table class="t15standard" summary="" #REPORT_ATTRIBUTES# id="report_#REGION_STATIC_ID#" >
    <th class="t15header" #ALIGNMENT# >Info</th>
    <th class="t15header" #ALIGNMENT# >Employee Number</th>
    <th class="t15header" #ALIGNMENT# >Name</th>
    After Rows
    <tr>
    <td colspan="99" class="t15afterrows">
    <span class="left">#EXTERNAL_LINK##CSV_LINK#</span>
    <table style="float:right;text-align:right;" summary="pagination">
    #PAGINATION#</table>
    </td>
    </tr>
    </table>
    *Javascript in page Header*
    <script src="#WORKSPACE_IMAGES#apex_show_hide_region.js" type="text/javascript"></script>
    <script language="JavaScript" type="text/javascript">
    <!--
    function selectRow(pJob)
    /* console.log('pete got here!'+pJob)*/
    $x('P900007_JOB').value =pJob;
    /* Start Page init*/
    function *page_init*()
    /* Used to set radio groups on reports */
    /*console.log('START pete got here!');*/
    var is_checked = false;
    var l_check = $x_FormItems($x('emp_report'), 'radio');
    /*Loop and set flag if checked*/
    for(var i=0,len=l_check.length;i<len;i++)
    if(l_check.checked){
    is_checked = true;
    /*end loop*/
    /*If none checked force a click*/
    if(!is_checked){
    /*no longer need as doing click below*/
    l_check[0].checked=true;
    /*Force a click on the first radio group - extra details should then be
    populated*/
    var l_click = l_check[0].click();
    /* console.log('END pete got here!');*/
    /*END page_init*/
    // -->
    </script>
    *Application shared component.* – This fires a DB packaged procedure when the page is loaded.
    P330_PART_NO_HIST
    Process Point On load after Body region
    Process Text show_hide_memory.part_no_history_details();
    *Packaged Procedure* – This kicks off the page_init javascript in the header (earlier) to click on the radio group in the first row.
    PROCEDURE part_no_history_details AS
    BEGIN
    htp.prn('<script type="text/javascript">' || CHR(10));
    htp.prn('<!--' || CHR(10));
    htp.prn('page_init();'|| CHR(10));
    htp.prn('//-->' || CHR(10));
    htp.prn('</script>' || CHR(10));
    END part_no_history_details;
    Thanks Pete
    Edited by: Pete @ LSC on 26-Jan-2010 06:56

    Anybody any ideas? Should I be looking down the route of using my own pagination buttons and adding my code to this?
    There seems to be a routine $a_report that I can use for the pagination but I am finding it difficult to get the current first and last record values that I would need to pass. I've seen references to below in the form but when I'm using partial refresh they do not seem to change.
    wwv_flow.g_flow_current_min_row
    wwv_flow.g_flow_current_max_rows
    wwv_flow.g_flow_current_rows_fetched
    wwv_flow.g_request
    Thanks Pete

  • Problem returning variables from dynamic SQL/PLSQL

    Hi, I have a problem I am trying to solve using a very short piece of dynamic SQL or PLSQL but I am having problems getting the variable values out of the dynamic block.
    I have 16 counters whose names are made up of three variable parts - 'scheme', 'contributory category' and 'employment category'
    The 'scheme' can be either 'no1', 'no2', 'off', 'cg' or 'amc'
    The 'contributory category' can be either 'cont' or 'noncont'
    The 'employment category' can be either 'ft' or 'pt'
    (There are only 16 because only 16 combinations are possible)
    For example the total counter name could be 'v_cg_noncont_ft_count'
    I have created a variable by concatenating the various elements called v_incr_count_name which holds the name of the counter I want to increment.
    I am running this whole thing within an anonymous PLSQL block so I cannot use global variables meaning that my variables are not visible within a dynamic PLSQL block.
    I believe this means that either I need to bind the variables within a PLSQL block or use a SELECT FROM INTO SQL block.
    I have tried a few solutions with no luck such as the following PLSQL:
    v_incr_count := 'v_'||v_scheme||'_'||v_cont_cat||'_'||v_emp_cat||'_count';
    sql_stmt := 'BEGIN :a := :a + 1; END;';
    EXECUTE IMMEDIATE sql_stmt USING v_incr_count_name;
    Unfortunately I am getting the 'IN bind variable bound to an OUT position' error which I believe is because it is trying to return a value into v_incr_count_name which has been defined by default as an IN variable. The problem is that I need to store the returned value into the variable whose name is stored in v_incr_count_name.
    Another solution I tried is:
    v_incr_count_name := 'v_'||v_scheme||'_'||v_cont_cat||'_'||v_emp_cat||'_count';
    sql_stmt := 'SELECT '||v_incr_count_name||' + 1 FROM DUAL';
    EXECUTE IMMEDIATE sql_stmt INTO v_return;
    This solution gives me an 'Invalid colum error'
    Any help would be greatly appreciated
    Cheers, Dan

    Repost:
    Problem with variables in dynamic SQL/PLSQL

Maybe you are looking for

  • G5 dual 2 Ghz freezing up with Leopard

    I have had a problem with this mac freezing up, applications that are launching cannot be quit and often even a three finger quit yeilds no dialogue box. The only way out after 7 or 8 minutes of nothing is to power down using the front fascia switch,

  • How to design a framework for implementing rules in JSF/Spring Application

    We use JSF 1.2 (MyFaces 1.2.2) in the presentation layer, Spring 2.5.3 in the service layer and Hibernate3.2 as persistence layer. The java application we are building is mostly CRUD but involves tons of business rules which needs to be implemented a

  • Portfolio inside a portfolio

    Is it possible to insert an entire pdf portfolio on a page of another pdf porfolio?

  • Upgrade of SOA  2 nodes 10.1.3.3 and patch failure

    During upgrade of SOA 10.1.3.3 two node clusters, the first node is made successfully, however, when continue on 2nd node, during the configuration assistant stage, it hangs at BPEL CA : [java] 09/09/23 09:57:37 Notification ==>Binding web applicatio

  • Redirecting traffic on SunOne 6.1 SP4

    hi all, i've got a web server running SunOne 6.1 SP4, and im trying to figure how to redirect traffic from 2 different locations. the web server is accessed both thru the LAN and the Internet. how is it possible to re-direct traffic coming from an in