Is there a solution for dynamic reports and using Denes' Export to Excel?

Oracle 10.2.0.4.0
Application Express 3.2.1.00.10
Hello all!
I am using Denes Kubicek's Export_Excel_Pkg in my application and I'm having trouble exporting reports based on report regions created using a PL/SQL function body returning SQL query. I realize this is not an Oracle supported package, but was hoping someone here could shed some light on it. When I open up the Excel file, I get an error such as: Report Values Error: ORA-06550: line 22, column 5: PL/SQL: ORA-00907: missing right parenthesis.
I've searched the forum and already have done as others suggested by modifying the REPLACE on the v_sql variable in Export_Excel_Pkg.Get_Usable_SQL, but it did not work. My assumption is that there is an issue with the value being passed to the wwv_flow_utilities.get_binds function. I could not find documentation on this function, but I'm thinking that it cannot extract the bind variables within a PL/SQL block. The report only works when I have just use SQL with bind variables...doesn't work for PL/SQL. Nor does it work for dynamic SQL reports that use a "lexical" parameter (e.g. using WHERE &p_and_condition.) to build the WHERE clause.
Has anyone come up with a work-around to this? I somehow need to be able to extract reports based on dynamic SQL (or PL/SQL) to Excel.
Help is appreciated!
This is my example of a report based on PL/SQL function:
DECLARE
  v_sql VARCHAR2(4000);
BEGIN
  v_sql := q'[SELECT UPPER(t1.olo_name) agency_title,
       t1.class_code,
       UPPER(t1.class_title) class_title,
       t1.pay_plan,
       t1.pay_grade_code,
       COUNT(t1.appt_fte) total_employees,
       SUM(t1.appt_fte) filled_fte,
       AVG(DECODE(t2.pay_cycle_code,
                  'UB',((t1.wage_type1_amt_for_pay * 26)/t1.appt_fte),
                  'UM',((t1.wage_type1_amt_for_pay * 12)/t1.appt_fte),
                   0)) avg_annual_rate
   FROM my_schema.table1 t1,
            my_schema.table2 t2,
            my_schema.table3 pro
  WHERE t1.pos_wk = t2.pos_wk
    AND t2.pos_rate_active_flag = 'Y'
    AND t1.ops_ind = 'N'
    AND t1.employee_type IN ('1','2')
    AND pro.ROLE_CODE = :F101_DW_ROLE
    AND pro.pos_role_orgs_active_flag = 'Y']';
  IF :P_MULTI_OLO IS NOT NULL THEN
    v_sql := v_sql || q'[ AND INSTR(':'||']' || v('P_MULTI_OLO') || q'['||':', ':'||t1.olo_code||':') > 0]';     
  END IF;
  v_sql := v_sql || q'[GROUP BY UPPER(t1.olo_name), t1.class_code, UPPER(t1.class_title), t1.pay_plan, t1.pay_grade_code ORDER BY t1.class_code ASC, avg_annual_rate]';
  RETURN v_sql;
END;This is my example using a SQL statement with a lexical parameter:
SELECT UPPER(t1.olo_name) agency_title,
       t1.class_code,
       UPPER(t1.class_title) class_title,
       t1.pay_plan,
       t1.pay_grade_code,
       COUNT(t1.appt_fte) total_employees,
       SUM(t1.appt_fte) filled_fte,
       AVG(DECODE(t2.pay_cycle_code,
                  'UB',((t1.wage_type1_amt_for_pay * 26)/t1.appt_fte),
                  'UM',((t1.wage_type1_amt_for_pay * 12)/t1.appt_fte),
                   0)) avg_annual_rate
   FROM my_schema.table1 t1,
            my_schema.table2 t2,
            my_schema.table3 pro
  WHERE t1.pos_wk = t2.pos_wk
    AND t2.pos_rate_active_flag = 'Y'
    AND t1.ops_ind = 'N'
    AND t1.employee_type IN ('1','2')
    AND pro.ROLE_CODE = :F101_DW_ROLE
    AND pro.pos_role_orgs_active_flag = 'Y'
    &P63_AND_CONDITION.
  GROUP BY UPPER(t1.olo_name),
           t1.class_code,
           UPPER(t1.class_title),
           t1.pay_plan,
           t1.pay_grade_code   
ORDER BY t1.class_code ASC, avg_annual_rateThe *&P63_AND_CONDITION.* value is populated based on a "Before Header" computation under Page Rendering, using the logic below. It is then used by the SQL query defined in the reports region at run time.
DECLARE
  v_sql VARCHAR2(4000) := NULL;
BEGIN
  v_sql := ' ';
  IF :P_MULTI_OLO IS NOT NULL THEN
    v_sql := v_sql || q'[ AND INSTR(':'||']' || v('P_MULTI_OLO') || q'['||':', ':' || t1.olo_code || ':') > 0]';     
  END IF;
  RETURN v_sql;
END;

Did you get an answer for this?

Similar Messages

  • Is there a solution for Digital Persona and Windows 10 and Edge or Google

    I upgarded to windows 10 and now my digital persona does not work.  Is there a solution for Microsoft Edge?  If not is there a solution for google?  I can make google my defult browser but it does not work there either?  

    We upgraded one laptop at home and I wasn't very surprised to find out that the backup / imaging program we were using on Windows 7 (Backup Exec System Recovery) stopped working.  It's a nice program that I've been using for years - creates a base image then incrementals on a schedule.  Allows for simple full bare metal recovery or for file recovery by mounting an image inside the program.
    Have any of you tested anything similar in Windows 10?
    This topic first appeared in the Spiceworks Community

  • Is there a solution for my "files in use" installation problem with Adobe Reader XI?

    I have tried repeatedly to download Adobe Reader XI (11.0.07), but I keep getting a "files in use" message that indicates my current version, Adobe Reader 8.1, is using files that need to be updated by the download's set up. The message directs me to close my Adobe Reader 8.1 and then continue, but when I receive it my Adobe Reader 8.1 is always closed. I am tempted to uninstall my Reader 8.1 and then try downloading Reader XI, but I am afraid I could be inviting even more trouble. I should mention the reason I am trying to download Reader XI is a notification I received in my computer's status box that indicates my Reader 8.1 is not working properly and suggests I download the latest version. I discovered the notification after I was unable to open a GIF file attachment. Does anyone have a solution for this problem?

    Thanks for your reply.
    I tried to uninstall my Adobe Reader 8.1 in safe mode, as suggested above, but received a message which indicated that Windows installer could not be accessed. That was a strange message, because I have not had problems uninstalling programs in the past, and, after receiving the message, I tried uninstalling a different program in safe mode and had no problem doing so. I am now going to try your suggestion.
    Honestly, these types of technical issues always leave me so frustrated. I do not have a high technology acumen, and because my laptop is six years old, I cannot get professional help without paying a hefty fee. Thank goodness for this forum. If the solutions suggested here do not work, I guess I will keep my laptop until my Adobe 8.1 gives out completely.
    Thanks again for your assistance. I will let you know if it works.

  • Is there a solution for allowing them to use Apple TV without logging them in with my own Apple ID?

    I often have clients in during edit sessions and when there is downtime they enjoy using Apple TV to watch content on my laptop. We were wondering if there's a way to have them connect their laptops to Apple TV without having to use my account to login.

    yeah appletv can access all shared libs on the network

  • HT204406 I purchased the additional Icloud storage for my ipod touch.  Since it removes all my music from the touch and stores it in Icloud, I find that when I am not at my wifi location or another one,I can't access my music.Is there a solution for that?

    I purchasedhe additional Icloud storage for my ipod touch.  That removes all my music from the ipod and putsd it in Icloud.  I find that when I am away from my wifi connection, like when walking or working out, I can't access my music. Is there a solution for this?

    Download the music to your ipod when you are in a wi-fi area.
    It will be stored on your ipod.

  • TS4436 hi, when zooming in to capture still images, the image is really blurred and out of focus. is this a hardware issue and is there any solution for this?? or is my device faulty?

    hi, when zooming in to capture still images, the image is really blurred and out of focus. is this a hardware issue and is there any solution for this?? or is my device faulty?

    If you are using the iPhone camera zoom then remember that this is a digital zoom not an optical zoom. The zoomed in area will have fewer pixels and not appear as clear. The more you zoom the worse it gets. It's like cropping a picture after it has been taken.

  • HT4484 i used to have an app store and lost it and i created a new one and i can not update the iphoto app because it was updated with the old account, is there a solution for this problem?

    i used to have an app store and lost it and i created a new one and i can not update the iphoto app on my macbook pro because it was updated with the old account, is there a solution for this problem?

    Content and Apple IDs -
    Content is forever tied to the Apple ID that bought it. Apple does not transfer content from one Apple ID to another. Apple does not merge Apple IDs. You will never be able to access your content bought with one Apple ID with a new Apple ID.

  • All of suden I can't open email in my mail box...When I get new mail , I click to open that email and mail software quit...is there any solutions for this

    I having problem with emails on my I mac...A few days ago I got email and when I tried to opet to read it mail quit...And from then it is happening all the times...i can't open email in mail ,, anymore...Is there any solutions for this

    See:
    *https://support.mozilla.org/kb/Changing+the+e-mail+program+used+by+Firefox
    You can look at the network.protocol-handler.external.mailto prefs on the about:config page.
    *http://kb.mozillazine.org/about:config
    If network.protocol-handler.external.mailto prefs are user set (bold) then right-click and Reset them to the default value.<br />
    You can also try to change the network.protocol-handler.warn-external.mailto pref to true.

  • I transfered a picture folder to my tc and now it occupies space on the tc but I can't open it. I there a solution for this?

    I transfered a picture folder to my Time Capsule (3Gbit) from a external USB, drive thru my Macbook Pro, and now it occupies space on the Time Capsule  but I can't open it. Is there a solution for this?

    This is super fun with Yosemite.. that cannot open files on network drives..
    Have you got the drive mounted in Finder?
    Try and change the permissions of the folder in TC.. but I am not sure you are going to find this easy.
    I think the best way to fix this is to copy the whole lot back to the external USB via the terminal using a full root login.
    So open terminal.. type sudo su
    Type in your main administrator password.
    Then you can use any of the command line copy tools.. I have just done this with rsync..
    The command is rsync -av /source/* /destination/
    You should mount both the source and destination in finder.. and you can then drag the folder into the command line.. it will then copy the exact source and destination you want.

  • I have an Early 2011 and a 3rd Gen Apple TV, and I don't have the airplay icon on my desktop.  Is there a solution for this?

    I have an Early 2011 and a 3rd Gen Apple TV, and I don't have the airplay icon on my desktop.  Is there a solution for this? 

    I have an Early 2011 MacBook Pro and a 3rd Gen Apple TV.  I thought that it should work.  That is what all the web help has said.

  • I see my emails come in and then they disappear from my ipad2.  Is there a solution for this?

    I see my emails come in and then they disappear from my ipad2.  Is there a solution for this?

    Do you leave the email client on your computer launched and running actively checking the account for new messages and downloading new messages while the iPad's Mail app is doing the same?
    If so stop, and see if there is any difference.
    More than likely there will be. Although it is possible to access a POP account with more than one email client, a POP account is designed to be accessed with a single email client only and there are some limitations.
    No such problem or limitations with an IMAP account.

  • If I switch to iCloud, Outlook for Mac is not synchronizing with iCal and iCloud anymore. Is there a solution for this problem?

    I normally use Outlook for Mac as the standard email and calendar programm. When I use the USB cable fro synchronising contacts and calendars with my iPhone 4s ther is not problem at all. iCal, Mail and Oulook for Mac are synchronising perfectly.
    When I switch to iCloud, Oulook is completely empty and Calendar and Contacts are not synchronised anymore.
    Is this a known problem, and is there a solution for it?

    I have the same keyboard and do not have battery issues.
    It may have something to do with using rechargeable batteries.
    You can also try removing the keyboard then re-pairing it. Maybe a bad bluetooth connection is draining the battery.
    System Preferences > Bluetooth > right-click (control-click) on the keyboard > Remove > Remove
    Wait for it to show in the bluetooth list then Pair > enter the number sequence & return as displyed on the screen.

  • An SAP Solution for capital planning and Budgeting of Capital Assets?

    Is there an SAP Solution for the Planning and Budgeting of Capital Assets?
    A solution that provides planning, budgeting, and tracking for capital assets through the entire life cycle of each asset, from the initial request through the final disposal.
    The solution needs to be able to run “scenarios.” A scenario contains equipment that may potentially be purchased. Scenario items are used to help determine cost, capacity, and cash flow feasibility.

    Hi
    What you suggested is the ideal approach...
    However, if they say that the budget allocated to capital purposes (70%) applies to both capital projects and expenses and they would like to control it together, but have reports separately, it is not possible with standard SAP...
    If they want to have just one IO for both cap and exp, You can suggest them a work around to capture CAPITAL or EXPENSE in a ref field (XREF1 in BSEG) and you can run KOB1 with XREF1 displayed in it....
    In standard KOB1, XREF1 is not displayed, you have to use Exit COOMEP01 to include the fields you want... Add XREF1 to the Structure CI_RKPOS and write your code in the include ZXKAEPU01 of EXIT_SAPLKAEP_001
    Without an identifier @ the time of booking the transaction in the system (Either by way of IO or a ref field), you wont be able to generate reports later on
    Regards
    Ajay M

  • Is there any solution for convert document spreadsheet presentation to images with Office Web Apps?

    Hi there!
    Is there any solutions for convert document spreadsheet presentation to images with Office Web Apps?

    Hi,
    As far as I know, there is no build-in feature that convert Office file to image format in Office web app yet.
    I'll collect the information, and submit it with internal ways. Then, we could also submit the feedback here:
    http://office.microsoft.com/suggestions.aspx
    Regards,
    George Zhao
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • When converting tables in a MS Word 2010 or 2007 to PDF the table borders do not retain the correct thickness as identified in the word document.  Is there a solution for this issue?

    When converting tables in a MS Word 2010 or 2007 to PDF the table borders do not retain the correct thickness as identified in the word document.  Is there a solution for this issue?

    Please try with latest version of MS Word and Acrobat.
    Regards,
    Anoop

Maybe you are looking for