Using PL/SQL in OMS Reports

I've written a pl/sql block report and I'd like to add it to the OMS reports.
Are there any examples or hints on how to do this ?
Thanks

Cloned canned report Oracle Database Configuration Summary.
Removed all input constraints from query so it reads as follows:
begin
declare
type cursor_type IS REF CURSOR;
result_cursor_out CURSOR_TYPE;
tgt_guid_in MGMT_IP_TGT_GUID_ARRAY;
start_date_in DATE DEFAULT NULL;
end_date_in DATE DEFAULT NULL;
query_string VARCHAR(6000);
begin
result_cursor_out := ?;
tgt_guid_in := ?;
start_date_in := ?;
end_date_in := ?;
query_string :=
'select o.database_name "DATABASE_NAME",
o.characterset "CHARACTERSET",
o.instance_name "INSTANCE_NAME",
o.national_characterset "NATIONAL_CHARACTERSET",
o.global_name "GLOBAL_NAME",
o.log_mode "LOG_MODE",
o.banner "BANNER",
o.default_temp_tablespace "DEFAULT_TEMP_TABLESPACE"
from mgmt$db_dbninstanceinfo o ';
open result_cursor_out for query_string ;
end;
end;
Original report allows target selection from a list of databases, I changed to a blank specific target, since I want an unrestricted listing.
When I try to run, I get this error:
Error rendering element. Exception: Closed Statement
I've tried various ways to get around the error to no avail.
What did I do incorrectly ?
Thanks

Similar Messages

  • 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;

  • Unable to use custom SQL query in report

    Hi all,
    I am newbie to OBIEE
    I try to write a customized sql in one of the report in OBIEE answers.
    No error is thrown when I click on "Set SQL" button.
    But, when I try to click on "Result" tab, I get the below error message,
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 14026] Unable to navigate requested expression: count(AS_SALES_LEADS.STATUS_CODE by [ ] ). Please fix the metadata consistency warnings. (HY000)
    The same query I try running in Toad and it is not throwing any error, but running successfuly.
    Kindly help me on this.
    Regards,
    Shivakumar A

    Thank you very much for your time.
    Below is the query I used,
    SELECT saw_0."1", saw_0."2", saw_0."3"
    FROM (SELECT COUNT (c.status_code) "1", COUNT (a.status) "2",
    COUNT (c.accept_flag) "3"
    FROM table1 c,
    table2 g,
    table3 f,
    as_leads a
    WHERE f.sales_group_id = g.sales_group_id
    AND a.lead_id = c.sales_lead_id
    AND a.customer_id = f.customer_id) saw_0
    Result I get when run in Toad,
    Col1 Col2 Col3
    1234 43534 6787
    But, the same when I put in advanced sql tab, I get the below error message,
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 14026] Unable to navigate requested expression: count(AS_SALES_LEADS.STATUS_CODE by [ ] ). Please fix the metadata consistency warnings. (HY000)
    Please do help me on this.
    Hope the above information is enough for getting an idea what I am stuck up with.
    Edited by: 961805 on 17 Oct, 2012 3:56 AM

  • Enhancement: Using PL/SQL in User reports

    I'ld like to have the following statement as a User report :
    declare
      objlist sys.dbms_stats.objecttab;     
    begin
       sys.dbms_stats.gather_database_stats( cascade    => TRUE,options    => 'LIST STALE',objlist    => objlist);
       for i in 1 .. objlist.count LOOP
          dbms_output.put_line(ObjLIst(i).OwnName||'.'||ObjList(i).ObjName||'[ '||ObjLIst(i).PartName||' ]');
       END LOOP;
    END;
    /but when I test it, there is errors ORA-06550 and PLS-00103.
    It look like that UserReports only accept SQL statements....

    At this time, User Defined Reports only accept SQL but I will enter an enhancement request for our next version (post production).
    -- Sharon

  • PL/SQL Ad-hoc Reporting Implementation Questions

    Recently, I have been put on a development team that is developing a small reporting module for one of our applications.
    I'm trying to mask the underlying structure from the application by having the application run PL/SQL procedures which return REF CURSORS to the client with the requested data. Right now I'm struggling with how to implement the PL/SQL in the best fashion.
    Since this is a reporting tool the user has many combinations of selections. For example at a high level this application has a combination of multiple dropdowns (4-6), radio buttons, and check boxes. As you can see this results in a high amount of possible combinations that have to be sent to the database.
    Basically, the user chooses the following:
    1. Columns to receive (ie different SELECT lists in the PL/SQL)
    2. Specific conditions (ie different WHERE clauses in the PL/SQL)
    3. Aggregate functions (SUMS, TOTALS, AVERAGES based on #1 and #2)
    4. Trends based on #3.
    So... with that said I see two possibilities:
    1. Create a static query for each combination of parameters (in this case that would most likely result in at least 300 queries that would have to be written, possibly 600+).
    The problem I see with this is that I will have to write a significant amount of queries. This is a lot of front end work that, while is tedious, could result in a better performing system because it would be a parse once, execute many scenario which is scalable.
    The downside though is that if any of the underlying structure changes I have to go through and change tens of queries.
    2. Use DBMS_SQL and dynamically generate the queries based on input conditions.
    This approach (possibly) sacrifices performance (parse once, execute once situation), but has increased maintainability because it is more likely that I'll have to make one change vice a number of changes in scenario 1.
    A downside to this is that, it may be harder to debug (and hence maintain) because the SQL is generated on the fly.
    My questions to all is:
    1. Which is the approach that would best manage maintainability / performance?
    2. Is there any other approaches to using PL/SQL as a reporting tool that I am not thinking of?
    The database is 10.2.0.3, and the 'application' is PHP 5.1 running on IIS 6.
    If you need me to provide any additional information please let me know.
    Thanks!

    Ref cursors are an ugly solution (different though in 11g).
    You build a dynamic SQL. It must/should have bind variables. But a ref cursor does not allow you to dynamically bind values to bind variables. You need to code the actual bind variables into the code as part of the open cursor command. And at coding time you have no idea how many bind variables there will be in that dynamic SQL for the ref cursor.
    The proper solution is DBMS_SQL as it allows exactly this. Also one of the reasons why APEX uses this for its report queries.
    The only sensible way to implement this type of thing in PL/SQL is by not trying to make it generic (as one could with DBMS_SQL). Instead use polymorphisms and have each procedure construct the appropriate ref cursor with bind variables.
    E.g.
    SQL> create or replace package query as
    2 procedure Emp( c in out sys_refcursor );
    3 procedure Emp( c in out sys_refcursor, nameLike varchar2 );
    4 procedure EMp( c in out sys_refcursor, deptID number );
    5 end;
    6 /
    Package created.
    SQL>
    SQL> create or replace package body query as
    2
    3 procedure Emp( c in out sys_refcursor ) is
    4 begin
    5 open c for select * from emp order by 1;
    6 end;
    7
    8 procedure Emp( c in out sys_refcursor, nameLike varchar2 ) is
    9 begin
    10 open c for select * from emp where ename like nameLike order by 1;
    11 end;
    12
    13 procedure EMp( c in out sys_refcursor, deptID number ) is
    14 begin
    15 open c for select * from emp where deptno = deptID order by sal;
    16 end;
    17 end;
    18 /
    Package body created.
    SQL>
    SQL> var c refcursor
    SQL> exec query.Emp( :c, 'S%' )
    PL/SQL procedure successfully completed.
    SQL>
    SQL> print c
    EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
    7369 SMITH CLERK 7902 1980-12-17 00:00:00 800 20
    7788 SCOTT ANALYST 7566 1987-04-19 00:00:00 3000 20
    SQL>

  • Pl/sql in oracle reports 6.0

    Hi ,
    I am new to oracle reports, is there any way to use pl/sql in oracle reports.I mean i have to take aggregate data from Oracle and to print/populate the data according to slabs(Say distance slab or time slab).Can u please provide me sample code...
    mail id : [email protected]
    thanks & regards
    Anand M

    you can use ref cursor in your pl/sql stored procedure and then call it in your reports

  • Report using PL\SQL

    Is one able to use PL\SQL code in a report. I would like to have a procedre which runs off a bind variable if possible?
    Thanks

    Unfortunately, if you are on 1.5.0 or 1.5.1 this report style won't work (there is a bug that removes all of the ;s from the PL/SQL code). According to Re: Report style plsql-dbms_output - bug this is fixed in 1.5.3, when that is released.
    theFurryOne

  • Report Using PL/SQL Region

    Hi,
    I have bit experiment create custom reports using PL/SQL region
    http://dbswh.webhop.net/apex/f?p=BLOG:READ:0::::ARTICLE:97800346956448
    I would like have from you tips and ideas how enhance this.
    Because I'm not so good with SQL,
    I really appreciate if you have tips enhance performance for query used for cursor.
        /* Report query */
        l_sql := '
          SELECT * FROM(
            SELECT a.*, row_number() OVER (ORDER BY '
            || l_sort_col
            || ' '
            || l_sort_ord
            || ') rn, COUNT(1) over() mrn
            FROM(' || l_sql || ') a
          ) WHERE rn BETWEEN ' || l_start_row || ' AND ' || l_last_row
        ; Regards,
    Jari

    Hi Jari
    I'm guessing you're trying to do paginated grid data or somewthing similar? You could try something like this...
        l_sql := 'SELECT * '||
               'FROM ('||
                      'SELECT /*+ FIRST_ROWS(n) */ '||
                              'a.*, ROWNUM rnum '||
                       'FROM ('||l_sql||' '||
                              'ORDER BY '||l_sort||' '||l_dir||') a '||
                       'WHERE ROWNUM <= '||l_max_row||') '||
               'WHERE rnum >= '||l_start;The variables would be initialized in the procedure as follows...
        l_max_row := p_start + p_limit;
        l_start   := p_start + 1;
        l_sort    := NVL(p_sort,'1');
        l_dir     := NVL(p_dir, 'ASC');My application process would be called something like follows, to spit out a JSON object...
    BEGIN
      htp.p(wwv_flow.g_widget_num_return||'(');
      munky_extjs.grid_json(p_app_id => wwv_flow.g_x01,
                        p_app_page_id => wwv_flow.g_x02,
                        p_region_id => TO_NUMBER(wwv_flow.g_x03),
                        p_start => NVL(wwv_flow.g_x04,0),
                        p_limit => NVL(wwv_flow.g_x05,10),
                        p_sort => wwv_flow.g_x06,
                        p_dir => wwv_flow.g_x07);
      htp.p(')');
    END;I think your use of analytics in the inner query may be slowing you down if you have a lot of data?
    Cheers
    Ben

  • Can one generate a report in Word document using PL/SQL?

    We have a weekly status report application created in APEX, is there a way to generate a report in MS Word document (including formatting the doc) using PL/SQL by pulling data from Oracle database? Please shed some lights on this and any info and experience would be greatly appreciated.
    We use Oracle11g and apex version 3.1.1.00.09
    Thanks!

    Hi Tony,
    you are right, the NEW format isn't necessarily improved, also the user would need at least Office 2007 or higher.
    Still it is possible to do that ;-)
    And yes, there are other possibilities, but this question is dealing with Word documents (.doc i assume).
    Also my Statement "docx = XML" isn't clear enough. Docx is a zipped file which contains a xml file. Details: http://en.wikipedia.org/wiki/Docx
    sorry for the confusions,
    Peter
    Blog: http://www.oracle-and-apex.com
    ApexLib: http://apexlib.oracleapex.info
    Work: http://www.click-click.at

  • Using a SQL user-defined function in Crystal Reports XI

    Post Author: JoannKarp
    CA Forum: Formula
    Is it possible to use a user defined function in SQL and use this in multiple Crystal reports?
    JoannKarp

    SELECT COALESCE(ufn_GetAddressByBusinessEntityIDandAddressTypeID(table1.BusinessEntityID,712),ufn_GetAddressByBusinessEntityIDandAddressTypeID(table1.BusinessEntityID,712)) AS Zipcode
      FROM table1
    Nope. This is two function calls. coalesce(a, b, c, ...) is just syntatic sugar for
       CASE WHEN a IS NOT NULL THEN a
            WHEN b IS NOT NULL THEN b
            WHEN c IS NOT NULL THEN c
       END
    But if you use isnull it's a different matter. (But isnull() permits two arguments.)
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Use of SQL Reporting Services in BPC (multi-server environment) - concept

    Hello Experts,
    I have the following scenario:
    2 BPC application servers. Lets call them BPCA1 and BPCA2.
    Load Balancer with virtual name BPCA
    SQL 2005 database server BPCDB
    Database server would hold BPC databases and Report Server database - requires 1 SQL Server license.
    Each application server requires SQL Server Integration Services to be installed - 2 SQL Server Standard Edition licenses in my scenario.
    Now, is Reporting Services a required component and needs to be installed on both application servers?
    Because "scale-out" deployment for Reporting Services is only supported in SQL Server Enterprise Edition. Price difference between Standard and Enterprise Editions are quite sufficient.
    So, can I install SQL Server Reporting Services only on BPCA1 and point BPC configuration to BPCA1 for all applications servers?
    What is the use of SQL Server Reporting Services in BPC besides running Admin Reports?
    Thanks in advance,
    Akim

    Hi RS is not required to be installed into db server or app server. It  can be even an external RS server.
    You are right if you will try to install RS in both app server you need Enterprise Edition because is required by Microsoft for RS web farm.
    If you will install RS into database server then you don't need other license for SQL but if you will use SQL Server 2005 you have to install IIS into database server.
    For many companies this broke some security policies and for this reason you have to install RS into appserver.
    If you will use SQL Server 2008 then IIS is not required anymore and this is another plus in favor of SQL 2008.
    Also SAP recomendations is to use SQl Server 2008 for SAP BPC 7.0 SP3 or later becaiuse the performances are better.
    RS is used for:
    Admin reportts. Audit Reports Journal Reports.
    But without RS working you can have issue also with some Admin components not really just with reports.
    Regards
    Sorin Radulescu

  • Date parameter does not work in SharePoint 2010 report using SQL 2008 Server Reporting Service

    Here is the settings:
    SharePoint 2010 with SQL server 2008 reporting services configured
    When create a report for a SP list using SQL server report builder (3.0) the date parameter does not work.
    The data parameter is set as "date and time" type and field name equals the col name in the SP list
    When run the report, the whatever dates I select, the result is always the same, so the parameters do not take any effect.
    Is any step missing?
    Thanks for any advice !

    Hi ,
    How did you configure you "date and time" type parameter and field name equals the col name in the SP list?
    Have you tested if other type parameter worked?
    Have you tried typing the date format as 20140722 in your date parameter filed before run the report?
    http://whitepages.unlimitedviz.com/2012/02/using-sharepoint-filters-with-reporting-services-parameters-for-personalized-reports/
    Thanks,
    Daniel Yang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Daniel Yang
    TechNet Community Support

  • SQL ENTERPRISE: The edition of Reporting Services that you are using requires that you use local SQL Server relational databases for report data sources and the report server database

    The error below makes absolutely no sense! I'm using Enterprise Core...yet I'm being told I can't use remote data sources:
    w3wp!library!8!03/05/2015-19:08:48:: i INFO: Catalog SQL Server Edition = EnterpriseCore
    w3wp!library!8!03/05/2015-19:08:48:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException: , Microsoft.ReportingServices.Diagnostics.Utilities.OperationNotSupportedException: The feature: "The edition of Reporting
    Services that you are using requires that you use local SQL Server relational databases for report data sources and the report server database." is not supported in this edition of Reporting Services.;
    Really? This totally contradicts the documentation found here:
    https://msdn.microsoft.com/en-us/library/ms157285(v=sql.110).aspx
    That article says remote connections are completely supported.
    ARGH! Why does this have to be so difficult to setup?!?

    Hi jeffoliver1000,
    According to your description, you are using Enterprise Core edition and you are prompted that you can’t use remote data sources.
    In your scenario, we neither ignore your point nor be doubt with what you say. But actually we have met the case before that even though the SQL Server engine is Enterprise but the reporting services is still standard. So I would recommend you to find the
    actual edition of reporting services you are using. You can find Reporting Services starting SKU in the Reporting Service logs ( default location: C:\Program Files\Microsoft SQL Server\<instance name>\Reporting Services\LogFiles). For more information,
    please refer to the similar thread below:
    https://social.technet.microsoft.com/Forums/en-US/f98c2f3e-1a30-4993-ab41-acbc5014f92e/data-driven-subscription-button-not-displayed?forum=sqlreportingservices
    By the way, have you installed the other SQL Server edition before?
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • The feature: "The edition of Reporting Services that you are using requires that you use local SQL Server relational databases for report data sources and the report server database." is not supported in this edition of Reporting Services.

    Hello all,
    I have SQL express 2014 advance edition installed ..
    and i am connecting SQl server 2008 r2 instance which is in network 
    while creating datasource in Reportserver which has Express installed ..
    got this error ..
    please help me how to connect to remote server
    Dilip Patil..

    Error message says it all.
    With SQL Express, Data source should be local SQL DB.
    With SQL Enterprise, Standard, BI edition, you can create Data soruce which are hosted on other servers.
    Please refer similar thread:
    https://social.msdn.microsoft.com/Forums/en-US/c0468e3f-bad7-47a7-a695-75c13762280a/the-feature-the-edition-of-reporting-services-that-you-are-using-requires-that-you-use-local-sql?forum=sqlreportingservices
    Cheers,
    Vaibhav Chaudhari
    [MCTS],
    [MCP]

  • SAP NetWeaver BI with Microsoft SQL Server 2012 Reporting Services using XMLA

    I am currently implementing SAP BW and am trying to connect the Microsoft SQL Server 2012 Reporting Services product.  I am able to connect to SAP BW but there is one problem when i click on Query Designer after adding a DataSet the screen just displays the dialog prompt saying '' NO CUBES WERE FOUND. VERIFY THAT YOU HAVE SELECTED A VALID CATALOG''.
    The advanced information depicts the following:

    Hi Raunak T,
    Just a very basic question from my end:
    I believe that "Microsoft SQL server Report Builder" is the 3rd party which uses MDX as interface.
    Have you set the property using OLE DB for OLAP in your queries?
    BR
    Prabhith

Maybe you are looking for

  • Need To Return Calendar Events For Current Day

    Hello, I have a calendar which includes seperate start and end date fields. I need to write a query that will return events for each day in a month, but I need to be mindful of the fact that some events span multiple days. Here is my query so far whi

  • Multiple Libraries - One Preferences File

    Hi all, I would like to set up Multiple Libraries in iTunes to Sync one with ATV and stream the other to ATV when it is active. The problem I have is that iTunes has ONE preferences file independent to the library and in particular the "Shared Name"

  • Issue with downloaing from ALV to Excel sheet

    Hi All, When we download the ALV Report to excel sheet, the first line/first column (A11) of excel sheet will have today's date. Since my customer uses the excel sheet for further processing into a non-SAP system, we need to provide the excel sheet w

  • Screens missing when the Recording is processed : XK01

    I need to upload vendor master data. I also need to capture second address under the International Versions section. I could record it ( selecting the checkbox "Not a Batch Input Session") in the very first screen of SHDB. Otherwise we will not be ab

  • "Saving as" obliterates format

    Hello all: I am using Adobe Acrobat 8.1.2 Professional on a Windows XP (SP2) box. Please let me know if you need any other information on the environment in which I am working. Every week a report in a PDF file is emailed to me with important data st