Emailing Top SQL report metrics

I have performance monitoring configured on a database using 10g Em grid control. Is there a mechanism through which I could email the 'Top SQL' page that we get to see using EM? Ideally I would like to come up with the sql that EM uses to get the top SQL for a particular 24 hour period. Based on what I found, most of the information is in perfstat.stats$sql_summary. Has anyone done this before, and if so, could you share the sql script.?
Thanks,
Sunil.

Hello Alan,
Thank you very much for your answer. I implemented you solution as follows: I programmed a job exactly as you said and then I created a custom report which diplayed the 'output' column from mgmt$job_step_history. Unfortunately, although the 'output' column is CLOB and displays very nicely in any sql developing tool, when included in a report it seems that Information Publisher takes all the end-of-line out of it and thus it is displayed horribly, with no "enters"... Maybe if i used some pl/sql i would somehow manage to trick Information Publisher into displaying end-of-line characters...
In the end, i will use one of the two workarounds:
- program a job just like you said and set Grid control to notify me by email when succeded; this also includes the job's output, and so I can get the Top SQL reports via email. If more than one people would have to be notified by this, an email group would have to be set up by the email administrators in the company, and also a new user in grid control (a simple administrator with view privileges on the target, no super-user is necesary) with a notification rule that would send emails on succeed for the programmed job(s).
- send the output of the ADDM report per email from the target db - the grid control is no longer involved; the steps are:
select task_name tname from dba_advisor_tasks where created = (select max(created) from dba_advisor_tasks);
SELECT dbms_advisor.get_task_report('&addm_task_name', 'TEXT', 'TYPICAL') FROM dual;
Send the result by email. See Note 730746.1.
Thanks a lot,
Ana.

Similar Messages

  • Sending email with HTML report through a button

    Hi,
    I've noticed in APEX 4 there is a default option (through Action Menu -> Download Formats: email) to send an email with report in HTML format...
    may I know how to accomplish it using a Button... seems like APEX is using javascript:gReport.email.show(); function to accomplish it but I don't know how to implement it...
    Please advice
    Thanks in advance

    qwe12654 wrote:
    GokhanAtil,
    I've posted a sample on APEX.ORACLE.COM... LOGIN DETAILS ARE SAME AS ABOVE...
    ON the page now I have both the SQL based report and interactive report...
    On the top right you may see 2 icons.. one for downloading report in PDF (using SQL Report as the source) and the second for sending email (using interactive report, similar logic as what you've recommended)...
    Is there a way I may be able to send report via email, using SQL report as the source (rather than interactive report)...?
    You can always use APEX_MAIL to send emails.
    http://download.oracle.com/docs/cd/E10513_01/doc/apirefs.310/e12855/apex_mail.htm
    or the alternative option would be:
    to convert all my SQL reports into interactive, would require a bit of efforts (I'll go with it if the above option is not available)... but would need to know how to download INTERACTIVE reports in PDF, excel and CSV formats using a button ... similar logic to what you've done for sending emails
    Thanks again for all your assistanceIt's very easy to make buttons for downloading the interactive reports in HTML, CSV or PDF.
    I have created a PDF button and put the link:
    http://apex.oracle.com/pls/apex/f?p=40418:11:1316531694094700:PDF
    "1316531694094700" is the value of p_instance. You can find it from HTML codes of your page:
    <input type="hidden" name="p_instance" value="1316531694094700" id="pInstance">
    You can change PDF to CSV or HTMLD (so your visitor download the report in CSV or HTML)
    Best Regards,
    Gokhan
    If this question is answered, please mark appropriate posts as correct/helpful and the thread as closed. Thanks

  • Bug running Report 'Top SQL by Waits'

    When I open Report 'Top SQL by Waits' in 'All Reports', 'Database Administration', 'Top SQL' I get an error message:
    *'No query found for version of the selected database'*
    After clicking OK and entering e.g. '30' for the bind variable 'minutes' I get
    'ORA-00904': "SQL_ID": invalid identifier ....
    It seems that there is no such report defined for Oracle 9.
    I tried to start the report using versions 1.5.5 and 2.1.0.63 getting the same error message
    Versions:
    SQL Developer: Version 2.1.1.64
    Build MAIN-64.39
    I am on WIN XP SP3
    Database is:
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    PL/SQL Release 9.2.0.8.0 - Production
    "CORE     9.2.0.8.0     Production"
    TNS for IBM/AIX RISC System/6000: Version 9.2.0.8.0 - Production
    NLSRTL Version 9.2.0.8.0 - Production

    When I open Report 'Top SQL by Waits' in 'All Reports', 'Database Administration', 'Top SQL' I get an error message:
    *'No query found for version of the selected database'*
    After clicking OK and entering e.g. '30' for the bind variable 'minutes' I get
    'ORA-00904': "SQL_ID": invalid identifier ....
    It seems that there is no such report defined for Oracle 9.
    I tried to start the report using versions 1.5.5 and 2.1.0.63 getting the same error message
    Versions:
    SQL Developer: Version 2.1.1.64
    Build MAIN-64.39
    I am on WIN XP SP3
    Database is:
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    PL/SQL Release 9.2.0.8.0 - Production
    "CORE     9.2.0.8.0     Production"
    TNS for IBM/AIX RISC System/6000: Version 9.2.0.8.0 - Production
    NLSRTL Version 9.2.0.8.0 - Production

  • Aligning SQL reports in a region so that all top edges are aligned

    I have 3 SQL report regions in column 2. I would like these to display so their top edges are aligned.
    40           Approved Tests     Report (Column 2)     Conditional
    60           Unapproved Tests     Report (Column 2)     Conditional
    80           Approved Count by Build     Report (Column 2)     Conditional
    What actually happens is the reports are all centered vertically around the middle of the largest (tallest) report. Here's a crude ASCII picture:
    Approved Tests
    Category        #
    Area 1          100
    Area 2          100             *Unapproved Tests*
    Area 3          100             Category        #                   *Approved Count by Build*
    Area 4          100             Area 1           50                  11.0.1               700
    Area 5          100             Area 2           50
    Area 6          100   
    Area 7          100   
    Since the leftmost report is the tallest, the other two reports end up centered vertically around the middle of the leftmost report.
    Instead, I'd like all the top edges aligned, like this:
    Approved Tests               Unapproved Tests              Approved Count by Build
    Category        #               Category        #                    11.0.1               700
    Area 1          100              Area 1           50
    Area 2          100              Area 2           50
    Area 3          100
    Area 4          100
    Area 5          100
    Area 6          100   
    Area 7          100   
    Nothing I've tried so far has worked. Anyone have an idea how to accomplish this? Thanks...

    You might try wrapping the regions in html regions that essentially give you the ability to specify a valign=top for the report regions.
    So, your regions look like this:
    30 Report Start - contains region source = (div)<table width="100%" cellspacing="0" cellpadding="0"><tr><td valign="top">
    40 Approved Tests Report (Column 2) Conditional
    45 Report 2 Start - contains </td><td valign="top">
    60 Unapproved Tests Report (Column 2) Conditional
    65 Report 3 Start - contains </td><td valign="top">
    80 Approved Count by Build Report (Column 2) Conditional
    85 Report End - contains "</td></tr></table>(/div)"
    Replace () with the angle brackets
    Maybe there is a more elegant solution with templates or page level CSS or something..
    But that should work.
    Edited by: Bob37 on Sep 17, 2010 3:33 PM
    Edited by: Bob37 on Sep 17, 2010 3:33 PM

  • Sending SQL Report by eMail

    I would like to execute a sql-query and send the result by eMail. How would the syntax be?
    begin
    l_body_html := '<p>Dear Mr. Scott, </p><p>please find below dayly orders of '||:P4_DATUMWAHL||': '||select distinct artnr, produkt, inhalt, sum(anzahl) from auftragsposition a, produkte p, auftrag ak where p.produktid=a.PRODUKT_NR and a.Auftrag_Auftrag_Nr=ak.auftrag_nr and ak.DATUM=to_char(:P4_DATUMWAHL) group by (artnr, produkt, inhalt)||
    ' </p><p>Kind regards </p><p>B. Lewis </p>'

    Found the answer.
    Regrads............Lorenz
    Task: Paste an sql-report into an eMail
    Table Example: scott.emp
    declare
    l_body_html varchar2(4000);
    CURSOR cur IS
    select * from emp;
    rec cur%ROWTYPE;
    begin
    l_body_html := '<p>Dear Mr. Lewis, </p>
    <p>please find attached the report:</p>';
    OPEN cur;
    LOOP
    FETCH cur INTO rec;
    EXIT WHEN cur%NOTFOUND;
    l_body_html := l_body_html || '<p> ' || rec.empno || ' ' || rec.ename || ' ' || rec.job || ' ' || rec.sal || '</p>';
    END LOOP;
    CLOSE cur;
    l_body_html := l_body_html || ' <p>Kind regards </p><p>Scott </p>';
    HTMLDB_MAIL.SEND(
    P_TO => '[email protected]',
    P_FROM => '[email protected]',
    P_BODY => l_body_html,
    P_BODY_HTML => l_body_html,
    P_SUBJ => 'employee report;
    end;

  • Assist with my SQL Reporting Script

    I have started writing a HTML SQL reporting script based off of Jeffrey Hicks tutorial
    Here is my entire script:
    ###################START SCRIPT#####################################
    #requires -version 3.0
    #Create a SQL Server report of said SQL environment
    [cmdletbinding()]
    Param(
    [string]$computername=$env:computername,
    [string]$path="$env:temp\sqlrpt.htm"
    #define an empty array to hold all of the HTML fragments
    #the fragments will break apart each HTML section in the final output so that you can out whatever information you like
    $fragments=@()
    #save current location so I can set it back after importing SQL module
    $curr = get-location
    #import the SQL module
    Import-Module SQLPS -DisableNameChecking
    #change the location back
    set-location $curr
    #get uptime
    Write-Verbose "Getting SQL Server uptime"
    $starttime = Invoke-Sqlcmd -Query 'SELECT sqlserver_start_time AS StartTime FROM sys.dm_os_sys_info' -ServerInstance $computername -database master
    $version = Invoke-Sqlcmd "Select @@version AS Version"
    #create an object
    $uptime = New-Object -TypeName PSObject -Property @{
     StartTime = $starttime.Item(0)
     Uptime = (Get-Date)-$starttime.Item(0)
     Version = $version.Item(0).replace("`n","|")
    $tmp = $uptime | ConvertTo-HTML -fragment -AS List
    #replace "|" place holder with <br>"
    $fragments += $tmp.replace("|","<br>")
    #SQL Host Information
    $smo = new-object ('Microsoft.SqlServer.Management.Smo.Server') $computername
    $fragments += "<h3>SQL Host Information Details</h3>"
    $fragments += $smo | select ComputerNamePhysicalNetBios,Name, Processors, ProcessorUsage, PhysicalMemory, PhysicalMemoryUsageInKB, MasterDBPath, BackupDirectory | ConvertTo-HTML -Fragment
    #Get Status of all SQL related Services
    Write-Verbose "Querying services"
    $services = Get-Service -DisplayName *SQL* -ComputerName $computername |
    Select Name,Displayname,Status
    $fragments += "<h3>SQL Services</h3>"
    $fragments += $services | ConvertTo-HTML -Fragment
    #get databases
    #path to databases
    Write-Verbose "Querying datases"
    $dbpath = "SQLServer:\SQL\Localhost\default\databases"
    $fragments += "<h3>Database Utilization</h3>"
    $fragments += dir $dbpath | Select Name,Size,DataSpaceUsage,SpaceAvailable,
    @{Name="PercentFree";Expression={ [math]::Round((($_.SpaceAvailable/1kb)/$_.size)*100,2) }} |
    Sort PercentFree | ConvertTo-HTML -fragment
    #get database backup information
    # Create an SMO connection to the instance
    $smo = new-object ('Microsoft.SqlServer.Management.Smo.Server') $computername
    $dbbackups = $smo.Databases
    $fragments += "<h3>Last Database Backup Information</h3>"
    $fragments += $dbbackups | select Name,LastBackupDate, LastLogBackupDate | ConvertTo-HTML -Fragment
    #Login & Service Account Information#SQL Host Information
    $smo = new-object ('Microsoft.SqlServer.Management.Smo.Server') $computername
    $fragments += "<h3>Login & Service Account Information</h3>"
    $fragments += $smo | select ServiceAccount, Logins | ConvertTo-HTML -Fragment
    #volume usage
    Write-Verbose "Querying system volumes"
    $data = Get-CimInstance win32_volume -filter "drivetype=3" -ComputerName $computername
    $drives = foreach ($item in $data) {
        $prophash = [ordered]@{
        Drive = $item.DriveLetter
        Volume = $item.DeviceID
        Compressed = $item.Compressed
        SizeGB = $item.capacity/1GB -as [int]
        FreeGB = "{0:N4}" -f ($item.Freespace/1GB )
        PercentFree = [math]::Round((($item.Freespace/$item.capacity) * 100),2)
        #create a new object from the property hash
        New-Object PSObject -Property $prophash
    [xml]$html = $drives | ConvertTo-Html -fragment
    #check each row, skipping the TH header row
    for ($i=1;$i -le $html.table.tr.count-1;$i++) {
      $class = $html.CreateAttribute("class")
      #check the value of the last column and assign a class to the row
      if (($html.table.tr[$i].td[-1] -as [int]) -le 25) {                                         
        $class.value = "danger" 
        $html.table.tr[$i].Attributes.Append($class) | Out-Null
      elseif (($html.table.tr[$i].td[-1] -as [int]) -le 35) {                                              
        $class.value = "warn"   
        $html.table.tr[$i].Attributes.Append($class) | Out-Null
    $fragments += "<h3>Volume Utilization</h3>"
    $fragments += $html.innerxml
    #define the HTML style
    Write-Verbose "preparing report"
    $imagefile = "c:\scripts\db.png"
    $ImageBits = [Convert]::ToBase64String((Get-Content $imagefile -Encoding Byte))
    $ImageHTML = "<img src=data:image/png;base64,$($ImageBits) alt='db utilization'/>"
    $head = @"
    <style>
    body { background-color:#FAFAFA;
           font-family:Arial;
           font-size:12pt; }
    td, th { border:1px solid black;
             border-collapse:collapse; }
    th { color:white;
         background-color:black; }
    table, tr, td, th { padding: 2px; margin: 0px }
    tr:nth-child(odd) {background-color: lightgray}
    table { margin-left:50px; }
    img
    float:left;
    margin: 0px 25px;
    .danger {background-color: red}
    .warn {background-color: yellow}
    </style>
    $imagehtml
    <br><br><br>
    <H2>SQL Server Report: $Computername</H2>
    <br>
    #create the HTML document
    ConvertTo-HTML -Head $head -Body $fragments -PostContent "<i>report generated: $(Get-Date)</i>" |
    Out-File -FilePath $path -Encoding ascii
    Write-Verbose "Opening report"
    Invoke-Item $path
    ######################END SCRIPT##################################
    I have 2 questions for help in regards to the above script:
    1)  For the Login and Service Account portion I can't get my output to show up properly.  Here is the snip from the script:
    #Login & Service Account Information#SQL Host Information
    $smo = new-object ('Microsoft.SqlServer.Management.Smo.Server') $computername
    $fragments += "<h3>Login & Service Account Information</h3>"
    $fragments += $smo | select ServiceAccount, Logins | ConvertTo-HTML -Fragment
    Here is how the output shows for this portion:
    ServiceAccount
    Logins
    domain\svcAcct
                 Microsoft.SqlServer.Management.Smo.LoginCollection
    I would like top have the login information show in the above table of the all the different logins.  When I run the script without HTML for that portion and just output to console it shows the login info as I would expect.
    2)  The 2nd question is, how do I add a variable to the bottom of the script to email the report to said email address.  This is probably simple but can't get my head wrapped around this part.
    Thanks all in advance!

    Thanks AnnaWY, that resolved the portion on how to email the report.  I was also able to utilize the following code which does the same thing as well:
    #Send an email with the contents of the report
    $MailBody= Get-Content $path
    $MailSubject= "SQL Server Report"
    $SmtpClient = New-Object system.net.mail.smtpClient
    $SmtpClient.host = "smtp.server.com"
    $MailMessage = New-Object system.net.mail.mailmessage
    $MailMessage.from = "[email protected]"
    $MailMessage.To.add("[email protected]")
    $MailMessage.Subject = $MailSubject
    $MailMessage.IsBodyHtml = 1
    $MailMessage.Body = $MailBody
    $SmtpClient.Send($MailMessage)
    I still have not been able to resolve the portion regarding the login/service account information not showing up in the table correctly.  For the time being I have removed it from the environment report and instead included it as a script of its own
    in our Security Auditing process.

  • Sql for top sql

    Dear DBAs
    Application team has asked me to provide TOP Sql statements in testing database which can help them to improve code. Developer gave OEM top sql example from his last job.
    Currently I do not have OEM installed. I am on 10.2.0.1.0 . I was thinking
    to create a job to run sql and email everyday.
    What sql can I use to generate that report ? What does OEM reports on when it show TOP Sql ?
    Thanks

    OEM will show you TOP sql by different catogories (each of which can be sorted) such as:
    Disk Reads Per Execution
    Buffer Gets Per Execution
    Executions
    Disk Reads
    Buffer Gets
    Buffer Gets Per Row
    Buffer Cache Hit Ration
    Sorts
    Shareable memory
    Rows Processed
    CPU Time
    Elapsed Time
    Now having said that....just because the TOP sql statement is the TOP sql statement does not mean that anything needs tuned. Your developers should be examining their SQL using insite gained from reading articles and documentation.
    Tuning use explain plan:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:231814117467
    SQL Tuning
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sql_1016.htm#sthref1061
    Automatic SQL Tuning
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/sql_tune.htm#g42443
    In particular:
    12.2.4 Using SQL Tuning Advisor with Oracle Enterprise Manager
    These links should point you in the right direction:
    Of course there are books and Oracle classes that concentrate on these issues as well.
    Regards
    Tim Boles

  • Top sql elasped time, how true is that

    hi guys,
    i am viewing an addm report and is concern about a top sql activity.
    i have an sql having top elasped time.
    <i>
    2,372      2,275      128,690,535      0.00      4.28      fphtjnquzzpud      [email protected] (TNS V1-V3)      SELECT USER_ID FROM SUBSCRIBER...
    </i>
    q1) what is the meaning of elasped time ?
    the time taken per execution of an sql statement ?
    q2) is the elasped time in the report shown above = sum of all the the elapsed time per execution of the sql ?
    if that the case, the most/frequently i run a SQL statement, the higher the elasped time it will be and thus higher db time.
    but how can we say that it is an inefficient sql since it has the most elasped time just because it is run way too frequently then other sqls ?
    Please advise
    Regards,
    Noob

    Hi,
    It is
    in the below addmrpt.sql the time which show 20393 is the elapsed time of the sql..
    SQL statements consuming significant database time were found.
       RECOMMENDATION 1: SQL Tuning, 24% benefit (20393 seconds)
          ACTION: Run SQL Tuning Advisor on the SQL statement with SQL_ID
             "9tkc7559d5drs".
             RELEVANT OBJECT: SQL statement with SQL_ID 9tkc7559d5drs and
             PLAN_HASH 1303522576But in awrrrpt.sql the elapsed time showing is for the total number of times the sql is executed in the DB.
    ^LSQL ordered by Elapsed Time       DB/Inst: STEELP/STEELP1  Snaps: 13011-13012
    -> Resources reported for PL/SQL code includes the resources used by all SQL
       statements called by the code.
    -> % Total DB Time is the Elapsed Time of the SQL statement divided
       into the Total Database Time multiplied by 100
      Elapsed      CPU                  Elap per  % Total
      Time (s)   Time (s)  Executions   Exec (s)  DB Time    SQL Id
         6,761      1,869            1     6761.3    11.2 4hsz1t5dsmhy4
    Module: XXLOTDETSo check the addmrpt report.
    thanks.
    baskar.l

  • Upgrade 2010 to 2013 with SQL Reporting Services

    I'm getting ready to upgrade to 2013.
    When I run the Test-SPContentDatabase I get:
    Category : MissingWebPart
    Error : True
    UpgradeBlocking : False
    Message : WebPart class [ab6d9dad-e23c-ce4f-ff98-f6575a1ccf4c] (class [
    Microsoft.ReportingServices.SharePoint.UI.WebParts.ReportView
    erWebPart] from assembly
    [Microsoft.ReportingServices.SharePoint.UI.WebParts,
    Version=10.0.0.0, Culture=neutral,
    PublicKeyToken=89845dcd8080cc91]) is referenced [24] times
    in the database [is-sharepoint], but is not installed on the
    current farm. Please install any feature/solution which
    contains this web part.
    Remedy : One or more web parts are referenced in the database
    [is-sharepoint], but are not installed on the current farm.
    Please install any feature or solution which contains these
    web parts.
    Locations :
    Category : MissingAssembly
    Error : True
    UpgradeBlocking : False
    Message : Assembly
    [Microsoft.ReportingServices.SharePoint.UI.ServerPages,
    Version=10.50.0.0, Culture=neutral,
    PublicKeyToken=89845dcd8080cc91] is referenced in the
    database [is-sharepoint], but is not installed on the
    current farm. Please install any feature/solution which
    contains this assembly.
    Remedy : One or more assemblies are referenced in the database
    [is-sharepoint], but are not installed on the current farm.
    Please install any feature or solution which contains these
    assemblies.
    Locations :
    Category : Configuration
    Error : False
    UpgradeBlocking : False
    Message : The [is.photomask.com] web application is configured with
    claims authentication mode however the content database you
    are trying to attach is intended to be used against a
    windows classic authentication mode.
    Remedy : There is an inconsistency between the authentication mode of
    target web application and the source web application.
    Ensure that the authentication mode setting in upgraded web
    application is the same as what you had in previous
    SharePoint 2010 web application. Refer to the link
    "http://go.microsoft.com/fwlink/?LinkId=236865" for more
    information.
    Locations :
    The first two have to do with reporting services.  I'm trying to workout how to go about getting these errors to go away.  I don't want to remove SQL reporting or migrate a broken site and fix it later.  FYI it does migrate but reporting services
    is of course broken.
    So what I was wanting to do was to upgrade SQL Reporting Services for SharePoint 2010 from 2008 SQL to 2014 SQL first.  This would be in the hopes that it would make the migration to SharePoint 2013 work as the assemblies would change to the proper
    version.
    Can anyone elaborate on my upgrade path?
    I'm still looking up the "Claims Based" authentication thing.  I've found an article on how to migrate it so not a big deal.  I do wonder however if this is tied to the issue I saw with default.aspx and home.aspx being denied to all users
    after I did migrate a content db.
    David Jenkins

    Hi David,
    The following sections describe the basic steps needed to upgrade or migrate from 2008 versions of Reporting Services SharePoint mode to 2014 version.
    SQL Server 2008 R2 to SQL Server 2014
    Starting environment: SQL Server 2008 R2, SharePoint 2010.
    Ending environment: SQL Server 2014, SharePoint 2010.
    In-place upgrade is supported and there is no down time for your SharePoint environment.
    Install the SQL Server 2014 version of the Reporting Services add-in for SharePoint on each web front-end in the farm. You can install the add-in by using the SQL Server 2014 installation wizard or by downloading the add-in.
    Run SQL Server 2014 installation to upgrade SharePoint mode for each “report server”. The SQL Server installation wizard will install the Reporting Services Service and create a new Service application.
    If you also want the ending environment to run SharePoint 2013, you need to complete a database-attach upgrade of the SharePoint 2010 to SharePoint 2013.
    For more scenarios information, please refer to:
    http://msdn.microsoft.com/en-us/library/ms143747.aspx#bkmk_sharePoint_scenarios
    Per the supported combinations of SharePoint and Reported Services Components, I’d recommend you firstly upgrade Reporting Services to 2014, then upgrade SharePoint to 2013.
    For more information:
    http://msdn.microsoft.com/en-us/library/gg492257.aspx
    The link below is the reference for migrating a Reporting Services:
    http://msdn.microsoft.com/en-us/library/hh759331.aspx
    Regards,
    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] .
    Rebecca Tu
    TechNet Community Support

  • Items is a region displayed after a sql report region!

    Hello everybody!
    I have 3 regions :
    1/ HTML text region with some items : sequence 10, column1
    2/ SQL report region : sequence 20, column1
    3/ HTML text region with some items : sequence 30, column1
    I have many problems and errors when submitting the page and saving data into tables, I think that htmldb is not getting the correct values corresponding to the correct items.
    If I change the column diplay of the sql report region to "2", or if I change the sequence of the SQL report region to 40, all is ok!!!
    (I am using wwv_flow.g_f10(i) to retreive data from the report).
    Any idea ?

    Hello Raju,
    Ok, My example is more complexe, but I have succed to reproduce the error in a sample example in my oracle htmldb workspace,
    My access info have bee sect to : [email protected]
    You will find the example in application 21275_TEST page 2.
    I have 3 regions, the second is a report sql region in witch I have a popkeyfrom query item.
    My submit button, update a table with a text field (item P2_IT, region1) and a date(item P2_MONTH ,region3).
    You will see that when submitting, you will get an error : not a valid month....
    I have not understand what is being done at save, but I am sure that the value of P2_MONTH is not correctly setted when updating the table!
    Just, changing the sequence of the report region from 10 to 30 resolve the problem,
    but I must have this region between the two others!!!
    Thanks for the help!

  • 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

  • SQL Report Builder 3.0 Automatic Scheduling feature ?

    Hello All,
    We have installed and commissioned a HMI SCADA solution for Shell Petroleum South Africa, We are using Copa Data Zenon for our HMI solution, Zenon's historian are writing variable values into a SQL database from where we are reading these variables with
    I-net Clear Reports. 
    However, I net  Clear Reports uses a "PLUS" license which is used for the scheduling function. The license is priced based on the amount of CPU Cores the server has and ours has 16 cores so the license is extremely expensive.
    What we need :
    To create a report with values from a SQL Database.
    Report must be able to be scheduled, to run at specific time.
    I have done some testing and used the same SQL queries we used in I-net clear reports.
    SQL Report Builder 3.0 does get the variable values when you hit "run" , but it does not look like there is an automatic report scheduling function ? We want to execute a daily , weekly & monthly report.
    Does a Scheduling feature exist ?? Please advise
    I would highly appreciate your assistance.
    Regards.
    Paul  
    Automation Engineer

    Hello,
    Report Builder 3.0 is just a report authoring tool.You can design and preview the report with Report Builder,or you can publish your report to a report server or a report server in SharePoint integrated mode, where others can run it. There is no schedule
    running function in Report Builder which can processing the report automatically.
    SQL Server Reporting Services Standard edition or high edition support email and file share subscriptions and scheduling. You can create subscriptions that can automatic running the report based on a schedule(daily , weekly or monthly ) and send reports
    to a shared folder or to an e-mail address.
    Reference:Subscriptions and Delivery (Reporting Services)
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • Passing sql report query field value to hidden item in javascript

    I have sql report which has in each row one html button. Let us say that query SHOULD look like (two columns, to be easy to get the point):
    select 1 SECURITY_ID
      , '<input type="BUTTON" value="Top10" onClick="javascript:Top10Click ('||SECURITY_ID||');" >' BTN
    FROM DUAL;
    function Top10Click (vValue) {
      html_GetElement('P31_PROCESS_VALUE').value = vValue;
      doSubmit('GO_BACK');
    } <br><br>
    where P31_PROCESS_VALUE is hidden item where i want to store value of row where click happened.
    <br><br>
    In every button i want to pass row value "SECURITY_ID" to Top10Click function for each row differently.
    <br><br>
    Problem is that when I place double qoute then js is not working, else js is ok but "SECURITY_ID" is passed as constant not as live SQL value.
    <br><br>
    Any help...THX!
    <br>
    Demo is on oracle:
    http://htmldb.oracle.com/pls/otn/f?p=26216:1
    Workspace entry:
    WK: FUNKY
    UN: [email protected]
    PW: qwertz

    I have tried to unify the solution, so it looks like:
    select 1 SECURITY_ID
      , '<input type="BUTTON" value="Top10" onClick="javascript:Top10Click ('||'&quot_X;'||SECURITY_ID||'&quot_X;'||');"  >' BTN
    FROM DUAL;change '&quot_X;' (remove "_X" part ... so it can be seen in HTML properly!
    THX Denes for great ideas...

  • Passing multiple values to another page via a sql report

    Having trouble passing multiple values to another page via a popup SQL report
    I have two fields one called "descr" and another called "Met"
    when I use the code below all works fine and the value of "descr" is passed
    Select '&lt;a href="javascript:popUp2('''
    || 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
    || 'P950_TYPE:'
    || descr
    || ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%"&gt;'
    || descr
    || '&lt;/a&gt;' "Note"
    But when I want to pass another value, all goes bonkers and instead of the value of the field being passed the literal text is passed.
    can someone look at my code below and see what may be wrong
    Select '&lt;a href="javascript:popUp2('''
    || 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
    || 'P950_TYPE,P950_CODE:'
    || descr, Met
    || ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%"&gt;'
    || descr
    || '&lt;/a&gt;' "Note"
    I appeciate your help looking into this
    FYI (Here is the entire SQL for reference)
    With t
    as
    (SELECT
    CASE WHEN KEY = 2 then
    CASE WHEN WCS_CPT &gt; :P940_METRIC_1_WCS_CPT1 then
    '&lt;span style="color:Red; "&gt;'||TO_CHAR(WCS_CPT,'FML999G999G999G999G990D00')||'&lt;/span&gt;' else
    '&lt;span style="color:#399304; "&gt;'||TO_CHAR(WCS_CPT,'FML999G999G999G999G990D00')||'&lt;/span&gt;' end
    else '&lt;span style="color:#180c8b;"&gt;'||TO_CHAR(WCS_CPT,'FML999G999G999G999G990D00')||'&lt;/span&gt;' end "WCSCPT",
    CASE WHEN KEY = 2 then
    CASE WHEN WCS_TOI_PER_FTE &lt; :P940_METRIC_2_WCS_TOI_PER_FTE then
    '&lt;span style="color:Red; "&gt;'||TO_CHAR(WCS_TOI_PER_FTE,'999G999G999G999G990')||'&lt;/span&gt;' else
    '&lt;span style="color:#399304; "&gt;'||TO_CHAR(WCS_TOI_PER_FTE,'999G999G999G999G990')||'&lt;/span&gt;' end
    else '&lt;span style="color:#180c8b;"&gt;'||TO_CHAR(WCS_TOI_PER_FTE,'999G999G999G999G990')||'&lt;/span&gt;' end "WCSTOIPERFTE",
    CASE WHEN KEY = 2 then
    CASE WHEN WCS_SIO_PER_FTE &lt; :P940_METRIC_3_WCS_SIO_PER_FTE then
    '&lt;span style="color:Red; "&gt;'||TO_CHAR(WCS_SIO_PER_FTE,'999G999G999G999G990')||'&lt;/span&gt;' else
    '&lt;span style="color:#399304; "&gt;'||TO_CHAR(WCS_SIO_PER_FTE,'999G999G999G999G990')||'&lt;/span&gt;' end
    else '&lt;span style="color:#180c8b;"&gt;'||TO_CHAR(WCS_SIO_PER_FTE,'999G999G999G999G990')||'&lt;/span&gt;' end "WCSSIOPERFTE",
    CASE WHEN KEY = 2 then
    CASE WHEN WCS_TC_PER_FTE &lt; :P940_METRIC_4_WCS_TC_PER_FTE then
    '&lt;span style="color:Red; "&gt;'||TO_CHAR(WCS_TC_PER_FTE,'999G999G999G999G990')||'&lt;/span&gt;' else
    '&lt;span style="color:#399304; "&gt;'||TO_CHAR(WCS_TC_PER_FTE,'999G999G999G999G990')||'&lt;/span&gt;' end
    else '&lt;span style="color:#180c8b;"&gt;'||TO_CHAR(WCS_TC_PER_FTE,'999G999G999G999G990')||'&lt;/span&gt;' end "WCSTCPERFTE",
    CASE WHEN KEY = 2 then
    CASE WHEN WCS_ADSL_PER_FTE &lt; :P940_METRIC_5_WCS_DSL_PER_FTE then
    '&lt;span style="color:Red; "&gt;'||TO_CHAR(WCS_ADSL_PER_FTE,'999G999G999G999G990')||'&lt;/span&gt;' else
    '&lt;span style="color:#399304; "&gt;'||TO_CHAR(WCS_ADSL_PER_FTE,'999G999G999G999G990')||'&lt;/span&gt;' end
    else '&lt;span style="color:#180c8b;"&gt;'||TO_CHAR(WCS_ADSL_PER_FTE,'999G999G999G999G990')||'&lt;/span&gt;' end "WCSADSLPERFTE",
    CASE WHEN KEY = 2 THEN
    TO_CHAR(MONTH,'MON-YY')
    else
    'METRICS'
    end "MONTH"
    FROM (
    SELECT DISTINCT
    ROW_NUMBER() OVER (ORDER BY KEY DESC) AS ROW_NUM, KEY, WCS_CPT, WCS_TOI_PER_FTE, WCS_SIO_PER_FTE, WCS_TC_PER_FTE, WCS_ADSL_PER_FTE, MONTH
    from TW_M_KEYMETRICS
    WHERE TO_DATE(UPPER(MONTH),'DD/MON/YY') &gt;= TO_DATE(UPPER(:P940_START_OF_THIS_FIN_YEAR),'DD/MON/YY')
    ORDER BY KEY ASC, ROW_NUM, MONTH)
    WHERE ROW_NUM &lt;= :P940_MONTHS_SINCE_FIN_START)
    Select '&lt;a href="javascript:popUp2('''
    || 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
    || 'P950_METRIC_TYPE,P950_METRIC_VALUE:descr,MET'
    || ''
    || ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%"&gt;'
    || descr
    || '&lt;/a&gt;' "Note"
    , max(Met) METRICS, max(Jul) Jul08, max(Aug) Aug08, max(Sep) Sep08, max(Oct) Oct08, max(Nov) Nov08, max(Dec)Dec08, max(Jan) Jan08, max(Feb) Feb08, max(Mar) Mar08, max(Apr) Apr08, max(May) May08, max(Jun) Jun08
    from (
    Select 'Cost Per Transaction' descr,
    decode (MONTH, 'METRICS', WCSCPT) MET,
    decode (MONTH, 'JUL-08', WCSCPT) Jul,
    decode (MONTH, 'AUG-08', WCSCPT) Aug,
    decode (MONTH, 'SEP-08', WCSCPT) Sep,
    decode (MONTH, 'OCT-08', WCSCPT) Oct,
    decode (MONTH, 'NOV-08', WCSCPT) Nov,
    decode (MONTH, 'DEC-08', WCSCPT) Dec,
    decode (MONTH, 'JAN-08', WCSCPT) Jan,
    decode (MONTH, 'FEB-08', WCSCPT) Feb,
    decode (MONTH, 'MAR-08', WCSCPT) Mar,
    decode (MONTH, 'APR-08', WCSCPT) Apr,
    decode (MONTH, 'MAY-08', WCSCPT) May,
    decode (MONTH, 'JUN-08', WCSCPT) Jun
    from t
    union all
    Select 'Total Orders Issued Per FTE' descr,
    decode (MONTH, 'METRICS', WCSTOIPERFTE) MET,
    decode (MONTH, 'JUL-08', WCSTOIPERFTE) Jul,
    decode (MONTH, 'AUG-08', WCSTOIPERFTE) Aug,
    decode (MONTH, 'SEP-08', WCSTOIPERFTE) Sep,
    decode (MONTH, 'OCT-08', WCSTOIPERFTE) Oct,
    decode (MONTH, 'NOV-08', WCSTOIPERFTE) Nov,
    decode (MONTH, 'DEC-08', WCSTOIPERFTE) Dec,
    decode (MONTH, 'JAN-08', WCSTOIPERFTE) Jan,
    decode (MONTH, 'FEB-08', WCSTOIPERFTE) Feb,
    decode (MONTH, 'MAR-08', WCSTOIPERFTE) Mar,
    decode (MONTH, 'APR-08', WCSTOIPERFTE) Apr,
    decode (MONTH, 'MAY-08', WCSTOIPERFTE) May,
    decode (MONTH, 'JUN-08', WCSTOIPERFTE) Jun
    from t
    union all
    Select 'SIOs Per Billing FTE' descr,
    decode (MONTH, 'METRICS', WCSSIOPERFTE) MET,
    decode (MONTH, 'JUL-08', WCSSIOPERFTE) Jul,
    decode (MONTH, 'AUG-08', WCSSIOPERFTE) Aug,
    decode (MONTH, 'SEP-08', WCSSIOPERFTE) Sep,
    decode (MONTH, 'OCT-08', WCSSIOPERFTE) Oct,
    decode (MONTH, 'NOV-08', WCSSIOPERFTE) Nov,
    decode (MONTH, 'DEC-08', WCSSIOPERFTE) Dec,
    decode (MONTH, 'JAN-08', WCSSIOPERFTE) Jan,
    decode (MONTH, 'FEB-08', WCSSIOPERFTE) Feb,
    decode (MONTH, 'MAR-08', WCSSIOPERFTE) Mar,
    decode (MONTH, 'APR-08', WCSSIOPERFTE) Apr,
    decode (MONTH, 'MAY-08', WCSSIOPERFTE) May,
    decode (MONTH, 'JUN-08', WCSSIOPERFTE) Jun
    from t
    union all
    Select 'Total Calls Answered per FTE' descr,
    decode (MONTH, 'METRICS', WCSTCPERFTE) MET,
    decode (MONTH, 'JUL-08', WCSTCPERFTE) Jul,
    decode (MONTH, 'AUG-08', WCSTCPERFTE) Aug,
    decode (MONTH, 'SEP-08', WCSTCPERFTE) Sep,
    decode (MONTH, 'OCT-08', WCSTCPERFTE) Oct,
    decode (MONTH, 'NOV-08', WCSTCPERFTE) Nov,
    decode (MONTH, 'DEC-08', WCSTCPERFTE) Dec,
    decode (MONTH, 'JAN-08', WCSTCPERFTE) Jan,
    decode (MONTH, 'FEB-08', WCSTCPERFTE) Feb,
    decode (MONTH, 'MAR-08', WCSTCPERFTE) Mar,
    decode (MONTH, 'APR-08', WCSTCPERFTE) Apr,
    decode (MONTH, 'MAY-08', WCSTCPERFTE) May,
    decode (MONTH, 'JUN-08', WCSTCPERFTE) Jun
    from t
    union all
    Select 'ADSL Orders per FTE' descr,
    decode (MONTH, 'METRICS', WCSADSLPERFTE) MET,
    decode (MONTH, 'JUL-08', WCSADSLPERFTE) Jul,
    decode (MONTH, 'AUG-08', WCSADSLPERFTE) Aug,
    decode (MONTH, 'SEP-08', WCSADSLPERFTE) Sep,
    decode (MONTH, 'OCT-08', WCSADSLPERFTE) Oct,
    decode (MONTH, 'NOV-08', WCSADSLPERFTE) Nov,
    decode (MONTH, 'DEC-08', WCSADSLPERFTE) Dec,
    decode (MONTH, 'JAN-08', WCSADSLPERFTE) Jan,
    decode (MONTH, 'FEB-08', WCSADSLPERFTE) Feb,
    decode (MONTH, 'MAR-08', WCSADSLPERFTE) Mar,
    decode (MONTH, 'APR-08', WCSADSLPERFTE) Apr,
    decode (MONTH, 'MAY-08', WCSADSLPERFTE) May,
    decode (MONTH, 'JUN-08', WCSADSLPERFTE) Jun
    from t
    GROUP by descr
    Frank

    Borg Species 5618 wrote:
    Having trouble passing multiple values to another page via a popup SQL report
    But when I want to pass another value, all goes bonkers and instead of the value of the field being passed the literal text is passed.
    can someone look at my code below and see what may be wrong
    Select '&lt;a href="javascript:popUp2('''
    || 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
    || 'P950_TYPE,P950_CODE:'
    || descr, Met
    || ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%"&gt;'
    || descr
    || '&lt;/a&gt;' "Note"
    Hi Frank,
    You should close this parameters with single quotation. Try this -
    Select '&lt;a href="javascript:popUp2('''
    || 'f?p=&APP_ID.:950:&SESSION.::&DEBUG.::'
    || 'P950_TYPE,P950_CODE:'
    *|| 'descr, Met'*
    || ''', 790, 460);"style="color:darkred; font-weight: bold;font-size: 90%"&gt;'
    || descr
    || '&lt;/a&gt;' "Note"
    Hope this helps.
    Regards,
    M Tajuddin
    http://tajuddin.whitepagesbd.com

  • How to put Check Boxes in a SQL Report?

    Hi All,
    I have a SQL Report in my application. I want to put check box for each row of the report. How can I achieve that in APEX?
    Here is my application page.
    http://apex.oracle.com/pls/otn/f?p=20420:4:
    Under the "Select" column heading I want to add the check box for each row of the report.
    So that User select that row and when he clicks on Generate report It should generate its report.
    The report should generate if user selects multiple rows also.
    Workspace : alaka
    username : [email protected]
    Password : earth
    Thanks
    Alaka

    Hi,
    But I could not able to find whether the check box is checked or not.
    In the apex page , button is provided and the checked rows "empno" should pass to next page hidden item when the button is clicked.
    I tried apex_ITEM.CHECKBOX(1,empno,'CHECKED') by passing in the URL on click of the button. But it passes the test " apex_ITEM.CHECKBOX(1" to the item in the next page. And not checked values.
    Here is my application page.
    http://apex.oracle.com/pls/otn/f?p=20420:4:
    Workspace : alaka
    username : [email protected]
    Password : earth
    Application: TEST 20420
    Page : 4
    The button "Generate Report" is provided in the page. On click of this button the checked values should pass to the next page.
    Please help me in this.
    Thanks
    Alaka

Maybe you are looking for

  • Report for Units of measurement for Material

    Hi Is there any report to extract the alterante unit of measurements for materials in a plant. Thanks

  • Repetitive Broadcom errors in journalctl

    Hi, I've managed to get everything setup on my Macbook Air 2014. I checked journalctl for errors since last boot and discovered that the following is getting logged once a second (also present in dmesg output): kernel: ERROR @wl_cfg80211_get_tx_power

  • Cannot uninstall MBAM 2.1 features

    Hello, I would like to upgrade from MBAM 2.1 to 2.5 When I try to uninstall MBAM 2.1 from our SQL server it gives me an "Invalid Drive S:\" error message I tried from Add Remove Programs and also by running the setup program....both gave me the same

  • Career Change - Question

    Hello. Cut & Dry. Network Administrator at a defense company for 4.5 years. Exposure to sql 2000 for roughly 2 years. Received an opportunity at a globally known company. Now working in an area with opportunity given, to study/learn/work in an enviro

  • My ipod's screen got broken

    i have my ipod nano since december and the screen got broken accidentally a few days ago i want to know if it can be fixed and where someone can help me?   Windows XP