Search This Blog

Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Wednesday, 19 August 2015

Oracle Analytic Functions

Analytic Functions

Introduced in Oracle 8i, analytic functions, also known as windowing functions, allow developers to perform tasks in SQL that were previously confined to procedural languages.
Related articles.

Introduction

Probably the easiest way to understand analytic functions is to start by looking at aggregate functions. An aggregate function, as the name suggests, aggregates data from several rows into a single result row. For example, we might use the AVG aggregate function to give us an average of all the employee salaries in the EMP table.
SELECT AVG(sal)
FROM   emp;

  AVG(SAL)
----------
2073.21429

SQL>
The GROUP BY clause allows us to apply aggregate functions to subsets of rows. For example, we might want to display the average salary for each department.
SELECT deptno, AVG(sal)
FROM   emp
GROUP BY deptno
ORDER BY deptno;

    DEPTNO   AVG(SAL)
---------- ----------
 10 2916.66667
 20  2175
 30 1566.66667

SQL>
In both cases, the aggregate function reduces the number of rows returned by the query.
Analytic functions also operate on subsets of rows, similar to aggregate functions in GROUP BY queries, but they do not reduce the number of rows returned by the query. For example, the following query reports the salary for each employee, along with the average salary of the employees within the department.
SET PAGESIZE 50
BREAK ON deptno SKIP 1 DUPLICATES

SELECT empno, deptno, sal,
       AVG(sal) OVER (PARTITION BY deptno) AS avg_dept_sal
FROM   emp;

     EMPNO     DEPTNO        SAL AVG_DEPT_SAL
---------- ---------- ---------- ------------
      7782         10       2450   2916.66667
      7839         10       5000   2916.66667
      7934         10       1300   2916.66667

      7566         20       2975         2175
      7902         20       3000         2175
      7876         20       1100         2175
      7369         20        800         2175
      7788         20       3000         2175

      7521         30       1250   1566.66667
      7844         30       1500   1566.66667
      7499         30       1600   1566.66667
      7900         30        950   1566.66667
      7698         30       2850   1566.66667
      7654         30       1250   1566.66667

14 rows selected.

SQL>
This time AVG is an analytic function, operating on the group of rows defined by the contents of the OVER clause. This group of rows is known as a window, which is why analytic functions are sometimes referred to as window[ing] functions. Notice how the AVG function is still reporting the departmental average, like it did in the GROUP BY query, but the result is present in each row, rather than reducing the total number of rows returned. This is because analytic functions are performed on a result set after all join, WHERE, GROUP BY and HAVING clauses are complete, but before the final ORDER BY operation is performed.

Analytic Function Syntax

There are some variations in the syntax of the individual analytic functions, but the basic syntax for an analytic function is as follows.
analytic_function([ arguments ]) OVER (analytic_clause)
The analytic_clause breaks down into the following optional elements.
[ query_partition_clause ] [ order_by_clause [ windowing_clause ] ]
The sub-elements of the analytic_clause each have their own syntax diagrams, shown here. Rather than repeat the syntax diagrams, the following sections describe what each section of the analytic_clause is used for.

query_partition_clause

The query_partition_clause divides the result set into partitions, or groups, of data. The operation of the analytic function is restricted to the boundary imposed by these partitions, similar to the way a GROUP BYclause affects the action of an aggregate function. If the query_partition_clause is omitted, the whole result set is treated as a single partition. The following query uses an empty OVER clause, so the average presented is based on all the rows of the result set.
CLEAR BREAKS

SELECT empno, deptno, sal,
       AVG(sal) OVER () AS avg_sal
FROM   emp;

     EMPNO     DEPTNO        SAL    AVG_SAL
---------- ---------- ---------- ----------
      7369         20        800 2073.21429
      7499         30       1600 2073.21429
      7521         30       1250 2073.21429
      7566         20       2975 2073.21429
      7654         30       1250 2073.21429
      7698         30       2850 2073.21429
      7782         10       2450 2073.21429
      7788         20       3000 2073.21429
      7839         10       5000 2073.21429
      7844         30       1500 2073.21429
      7876         20       1100 2073.21429
      7900         30        950 2073.21429
      7902         20       3000 2073.21429
      7934         10       1300 2073.21429

SQL>
If we change the OVER clause to include a query_partition_clause based on the department, the averages presented are specifically for the department the employee belongs too.
BREAK ON deptno SKIP 1 DUPLICATES

SELECT empno, deptno, sal,
       AVG(sal) OVER (PARTITION BY deptno) AS avg_dept_sal
FROM   emp;

     EMPNO     DEPTNO        SAL AVG_DEPT_SAL
---------- ---------- ---------- ------------
      7782         10       2450   2916.66667
      7839         10       5000   2916.66667
      7934         10       1300   2916.66667

      7566         20       2975         2175
      7902         20       3000         2175
      7876         20       1100         2175
      7369         20        800         2175
      7788         20       3000         2175

      7521         30       1250   1566.66667
      7844         30       1500   1566.66667
      7499         30       1600   1566.66667
      7900         30        950   1566.66667
      7698         30       2850   1566.66667
      7654         30       1250   1566.66667

SQL>

order_by_clause

The order_by_clause is used to order rows, or siblings, within a partition. So if an analytic function is sensitive to the order of the siblings in a partition you should include an order_by_clause. The following query uses the FIRST_VALUE function to return the first salary reported in each department. Notice we have partitioned the result set by the department, but there is no order_by_clause.
BREAK ON deptno SKIP 1 DUPLICATES

SELECT empno, deptno, sal, 
       FIRST_VALUE(sal IGNORE NULLS) OVER (PARTITION BY deptno) AS first_sal_in_dept
FROM   emp;

     EMPNO     DEPTNO        SAL FIRST_SAL_IN_DEPT
---------- ---------- ---------- -----------------
      7782         10       2450              2450
      7839         10       5000              2450
      7934         10       1300              2450

      7566         20       2975              2975
      7902         20       3000              2975
      7876         20       1100              2975
      7369         20        800              2975
      7788         20       3000              2975

      7521         30       1250              1250
      7844         30       1500              1250
      7499         30       1600              1250
      7900         30        950              1250
      7698         30       2850              1250
      7654         30       1250              1250

SQL>
Now compare the values of the FIRST_SAL_IN_DEPT column when we include an order_by_clause to order the siblings by ascending salary.
SELECT empno, deptno, sal, 
       FIRST_VALUE(sal IGNORE NULLS) OVER (PARTITION BY deptno ORDER BY sal ASC NULLS LAST) AS first_val_in_dept
FROM   emp;

     EMPNO     DEPTNO        SAL FIRST_VAL_IN_DEPT
---------- ---------- ---------- -----------------
      7934         10       1300              1300
      7782         10       2450              1300
      7839         10       5000              1300

      7369         20        800               800
      7876         20       1100               800
      7566         20       2975               800
      7788         20       3000               800
      7902         20       3000               800

      7900         30        950               950
      7654         30       1250               950
      7521         30       1250               950
      7844         30       1500               950
      7499         30       1600               950
      7698         30       2850               950

SQL>
In this case the "ASC NULLS LAST" keywords are unnecessary as ASC is the default for an order_by_clause and NULLS LAST is the default for ASC orders. When ordering by DESC, the default is NULLS FIRST.
It is important to understand how the order_by_clause affects display order. The order_by_clause is guaranteed to affect the order of the rows as they are processed by the analytic function, but it may not always affect the display order. As a result, you must always use a conventional ORDER BY clause in the query if display order is important. Do not rely on any implicit ordering done by the analytic function. Remember, the conventional ORDER BY clause is performed after the analytic processing, so it will always take precedence.

windowing_clause

We have seen previously the query_partition_clause controls the window, or group of rows, the analytic operates on. The windowing_clause gives some analytic functions a further degree of control over this window within the current partition. The windowing_clause is an extension of the order_by_clause and as such, it can only be used if an order_by_clause is present. The windowing_clause has two basic forms.
RANGE BETWEEN start_point AND end_point
ROWS BETWEEN start_point AND end_point
Possible values for "start_point" and "end_point" are:
  • UNBOUNDED PRECEDING : The window starts at the first row of the partition. Only available for start points.
  • UNBOUNDED FOLLOWING : The window ends at the last row of the partition. Only available for end points.
  • CURRENT ROW : The window starts or ends at the current row. Can be used as start or end point.
  • value_expr PRECEDING : A physical or logical offset before the current row using a constant or expression that evaluates to a positive numerical value. When used with RANGE, it can also be an interval literal if theorder_by_clause uses a DATE column.
  • value_expr FOLLOWING : As above, but an offset after the current row.
The documentation states the start point must always be before the end point, but this is not true, as demonstrated by this rather silly, but valid, query.
SELECT empno, deptno, sal, 
       AVG(sal) OVER (PARTITION BY deptno ORDER BY sal ROWS BETWEEN 0 PRECEDING AND 0 PRECEDING) AS avg_of_current_sal
FROM   emp;

     EMPNO     DEPTNO        SAL AVG_OF_CURRENT_SAL
---------- ---------- ---------- ------------------
      7934         10       1300               1300
      7782         10       2450               2450
      7839         10       5000               5000

      7369         20        800                800
      7876         20       1100               1100
      7566         20       2975               2975
      7788         20       3000               3000
      7902         20       3000               3000

      7900         30        950                950
      7654         30       1250               1250
      7521         30       1250               1250
      7844         30       1500               1500
      7499         30       1600               1600
      7698         30       2850               2850

SQL>
In fact, the start point must be before or equal to the end point. In addition, the current row does not have to be part of the window. The window can be defined to start and end before or after the current row.
For analytic functions that support the windowing_clause, the default action is "RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW". The following query is similar to one used previously to report the employee salary and average department salary, but now we have included an order_by_clause so we also get the default windowing_clause.
SELECT empno, deptno, sal, 
       AVG(sal) OVER (PARTITION BY deptno ORDER BY sal) AS avg_dept_sal_sofar
FROM   emp;

     EMPNO     DEPTNO        SAL AVG_DEPT_SAL_SOFAR
---------- ---------- ---------- ------------------
      7934         10       1300               1300
      7782         10       2450               1875
      7839         10       5000         2916.66667

      7369         20        800                800
      7876         20       1100                950
      7566         20       2975               1625
      7788         20       3000               2175
      7902         20       3000               2175

      7900         30        950                950
      7654         30       1250               1150
      7521         30       1250               1150
      7844         30       1500             1237.5
      7499         30       1600               1310
      7698         30       2850         1566.66667

SQL>
There are two things to notice here.
  • The addition of the order_by_clause without a windowing_clause means the query is now returning a running average.
  • The default windowing_clause is "RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW", not "ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW". The fact it is RANGE, not ROWS, means it stops at the first occurrence of the value in the current row, even if that is several rows earlier. As a result, duplicate rows are only included in the average when the salary value changes. You can see this in the last two records of department 20 and in the second and third records of department 30.
In my opinion, the default windowing_clause should have been "RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING". This would make the accidental inclusion of the windowing_clausemuch less confusing.
The following query shows one method for accessing data from previous and following rows within the current row using the windowing_clause. This can also be accomplished with LAG and LEAD.
CLEAR BREAKS

SELECT empno, deptno, sal, 
       FIRST_VALUE(sal) OVER (ORDER BY sal ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) AS previous_sal,
       LAST_VALUE(sal) OVER (ORDER BY sal ROWS BETWEEN CURRENT ROW AND 1 FOLLOWING) AS next_sal
FROM   emp;

     EMPNO     DEPTNO        SAL PREVIOUS_SAL   NEXT_SAL
---------- ---------- ---------- ------------ ----------
      7369         20        800          800        950
      7900         30        950          800       1100
      7876         20       1100          950       1250
      7521         30       1250         1100       1250
      7654         30       1250         1250       1300
      7934         10       1300         1250       1500
      7844         30       1500         1300       1600
      7499         30       1600         1500       2450
      7782         10       2450         1600       2850
      7698         30       2850         2450       2975
      7566         20       2975         2850       3000
      7788         20       3000         2975       3000
      7902         20       3000         3000       5000
      7839         10       5000         3000       5000

SQL>

Using Analytic Functions

The best way to understand what analytic functions are capable of is to play around with them. This article contains links to other articles I've written about specific analytic functions and the following documentation links list all analytic functions available in Oracle 12c Release 1. The "*" indicates that these functions allow for the full analytic syntax, including the windowing_clause.
For more information see:

Tuesday, 4 August 2015

Oracle Query to Calculate Age (Years, Months, Days)

SELECT
TRUNC(MONTHS_BETWEEN(SYSDATE,DOB)/12) YEAR,

 TRUNC(MOD(MONTHS_BETWEEN(SYSDATE,DOB),12)) MONTH,

 TRUNC(SYSDATE-ADD_MONTHS(DOB,TRUNC(MONTHS_BETWEEN(SYSDATE,DOB)/12)*12+TRUNC(MOD(MONTHS_BETWEEN(SYSDATE,DOB),12)))) DAY

FROM (SELECT TO_DATE('01071981','DDMMYYYY') DOB FROM DUAL);

Thursday, 23 July 2015

Oracle Reports Components Overview

A.2 Oracle Reports Components Overview

This section provides a brief description of the Oracle Reports components and the keywords that each component can use.

A.2.1 rwclient

rwclient (Reports Client) parses and transfers a command line to the specified Reports Server.
All file names and paths specified in the client command line refer to files and directories on the server machine, except for any file specified for the following command line keywords:
  • CMDFILE=filename. In this case, the CMDFILE specified is read and appended to the original command line (of which CMDFILE is a part) before being sent to the Reports Server. The runtime engine does not reread the command file
  • DESNAME=filename DESTYPE=LOCALFILE. In this case, DESNAME refers to files on the client machine.
Refer to Table A-1 for the keywords that can be used with rwclient.
Examples
Example 1: Running a paper report to cache
rwclient server=myrepserv report=test.rdf userid=scott/tiger@mydb desformat=pdf DESTYPE=cache
Example 2:  Sending report output to a file
rwclient server=myrepserv report=test.rdf userid=scott/tiger@mydb desformat=pdf DESTYPE=file DESNAME=c:\mydir\test
Example 3:  Sending report output to a printer
rwclient server=myrepserv report=test.rdf userid=scott/tiger@mydb DESTYPE=printer DESNAME=myprinter
Example 4: Sending report output through e-mail
rwclient server=myrepserv report=test.rdf userid=scott/tiger@mydb desformat=pdf DESTYPE=mailDESNAME="emp1@comp.com, emp2@comp.com" cc="emp3@comp.com" bcc="mgr@comp.com" replyto="me@comp.com" from="me@comp.com"
Example 5:  Sending report output to WebDAV (any WebDAV server or Oracle Portal WebDAV)
rwclient server=myrepserv report=test.rdf userid=scott/tiger@mydb desformat=htmlcss DESTYPE=webdavDESNAME="http://myusername:mypassword@mywebdavserv.com/mydir/test.html"
Example 6:  Sending report output to Oracle Portal
rwclient server=myrepserv report=test.rdf userid=scott/tiger@mydb DESTYPE=oracleportal desformat=PDF PAGEGROUP=mypagegrpOUTPUTPAGE=reports_output ITEMTITLE=pushtoportal STATUSPAGE=result
Example 7:  Sending XML PDS report output to a file
rwclient server=myrepserv report=myxmlpdstest.rdf DESTYPE=file desformat=PDF desname=c:\mydir\my.pdf
Example 8:  Sending JDBC PDS report output to a file
rwclient server=myrepserv report=myjdbcpdstest.rdf DESTYPE=file desformat=PDF desname=c:\mydir\myxml.pdfp_jdbcpds=sybuser/sybpwd@server1.mydomain.com:1300
Example 9:  Distributing a report output to multiple destinations:
rwclient server=myrepserv report=test.rdf userid=scott/tiger@mydb DISTRIBUTE=yes DESTINATION=c:\mydistribute.xml
Example 10:  Running scheduled reports
rwclient server=myrepserver report=test.rdf SCHEDULE="every first fri of month from 15:53 Mar 25, 2009 retry 3 after 1 hour"destype=file desformat=pdf desname=test.pdf
Example 11:  Using a secured Reports Server
rwclient server=myrepserv report=test.rdf userid=scott/tiger@mydb desformat=pdf destype=file desname=test.pdf AUTHID=myadmin/myadmin
Example 12:  Running a report with e-mail notification
rwclient server=myrepserver report=test.rdf userid=scott/tiger@mydb destype=file desformat=pdf desname=test.pdf NOTIFYSUCCESS="emp@comp.com"NOTIFYFAILURE="admin@comp.com"
Example 13:  Running a report that specifies a URL to be fetched with the URL engine
rwclient server=myrepserver report=test.rdf userid=scott/tiger@mydb destype=file desformat=pdf desname=test.pdf JOBTYPE=rwurlURLPARAMETER="http://www.oracle.com"

A.2.2 rwrun

rwrun (Reports Runtime) runs a report by starting its own in-process server (not to be confused with the default in-process Reports Server), which runs in the same JVM as therwrun process.
The configuration file for this in-process server is rwbuilder.conf and trace files are saved in the rep_machinename-rwbuilder directory.
Note:
It is recommended that you use rwrun for testing purposes only. Use rwservlet and rwclient in your production environment to take full advantage of the power of Oracle Reports Services.
Refer to Table A-1 for the keywords that can be used with rwrun.
Examples
Example 1:  Customizing a report
rwrun userid=scott/tiger@mydb report=emp.rdf CUSTOMIZE=empcustomize.xml destype=file desformat=pdf desname=emp.pdf
Example 2: Sending report output to a file
rwrun report=test.rdf userid=scott/tiger@mydb desformat=pdf DESTYPE=file DESNAME=c:\mydir\test.pdf
Example 3:  Sending report output to a printer
rwrun report=test.rdf userid=scott/tiger@mydb DESTYPE=printer DESNAME=myprinter
Example 4:  Sending report output through e-mail
rwrun report=test.rdf userid=scott/tiger@mydb desformat=pdf DESTYPE=mailDESNAME="emp1@comp.com, emp2@comp.com" cc="emp3@comp.com" bcc="mgr@comp.com" replyto="me@comp.com" from="me@comp.com"
Example 5:  Sending report output to WebDAV (any WebDAV server or Oracle Portal WebDAV)
rwrun report=test.rdf userid=scott/tiger@mydb desformat=htmlcss DESTYPE=webdav"DESNAME"="http://myusername:mypassword@mywebdavserv.com/mydir/test.html"
Example 6:  Sending report output to Oracle Portal
rwrun report=test.rdf userid=scott/tiger@mydb DESTYPE=oracleportal desformat=PDF PAGEGROUP=mypagegrp OUTPUTPAGE=reports_outputITEMTITLE=pushtoportal STATUSPAGE=result
Example 7:  Sending XML PDS report output to a file
rwrun report=myxmlpdstest.rdf destype=file desformat=PDF desname=c:\mydir\my.pdf
Example 8:  Sending JDBC PDS report output to a file
rwrun report=myjdbcpdstest.rdf destype=file desformat=PDF desname=c:\mydir\myxml.pdf P_JDBCPDS=sybuser/sybpwd@server1.mydomain.com:1300
Example 9:  Distributing report output to multiple destinations
rwrun report=test.rdf userid=scott/tiger@mydb DISTRIBUTE=yes DESTINATION=c:\mydistribute.xml
Example 10:  Using a secured Reports Server
rwrun report=test.rdf userid=scott/tiger@mydb desformat=pdf destype=file desname=test.pdf AUTHID=myadmin/myadmin
Example 11:  Running a report with e-mail notification
rwrun report=test.rdf userid=scott/tiger@mydb destype=file desformat=pdf desname=test.pdf NOTIFYSUCCESS="emp@comp.com"NOTIFYFAILURE="admin@comp.com"

A.2.3 rwbuilder

rwbuilder invokes Oracle Reports Builder. When you include a REPORT|MODULE keyword on the command line with rwbuilder, Oracle Reports Builder opens with the specified report highlighted in the Object Navigator. When no report is specified, Oracle Reports Builder opens with a Welcome dialog offering you the choice of opening an existing report or creating a new one.
Refer to Table A-1 for the keywords that can be used with rwbuilder.
Example
rwbuilder report=myrep.rdf userid=scott/tiger@mydb

A.2.4 rwconverter

rwconverter (Reports Converter) enables you to convert one or more report definitions or PL/SQL libraries from one storage format to another. For example, you can userwconverter to:
  • Combine a report file with an XML file to create a new report
  • Convert a report stored in an .rdf file to a .rep,.rex,.jsp, or .tdf (template) file.
    Note:
    When a report is converted to a template, only objects in the report's header and trailer sections and margin area are used in the template. Objects in the main section are ignored.
  • Convert a report stored in a .rex file to an .rdf or a template (.tdf file)
  • Convert a library stored in the database to a .pld or .pll file
  • Convert a library stored in a .pld file into a database library or a .pll file
  • Convert a library stored in a .pll file into a database library of a .pld file
    Note:
    When you convert a report that has an attached library, convert the .pll files attached to the report before converting the .rdf/.rex file.
  • Create a PL/SQL script that batch registers reports in Oracle Portal
In some cases, rwconverter automatically compiles the report's PL/SQL as part of the conversion process. Provided your conversion destination is not a .rex file, rwconverterautomatically compiles PL/SQL under the following conditions:
  • Converting to a .rep file. If there are compile errors, rwconverter displays an error message and the .rep file is not created.
  • Using a .rex file as the source. If there are compile errors, rwconverter displays a warning, but the conversion continues.
  • Using a report created on another platform than the source. If there are compile errors, rwconverter displays a warning, but the conversion continues.
In all other situations, you must compile the report's PL/SQL yourself (for example, using Program > Compile > All in Oracle Reports Builder).
Note:
Fonts are mapped when a report is opened by Oracle Reports Builder or Reports Runtime, not during the conversion.
Refer to Table A-1 for the keywords that can be used with rwconverter.
Example:
rwconverter scott/tiger@mydb stype=rdffile source=inven1.rdf dtype=xmlfile dest=inven1_new.xml

A.2.5 rwservlet

rwservlet (Oracle Reports Servlet) translates and delivers information between either a Web server or a Java EE Container (for example, Oracle WebLogic Server) and the Reports Server, allowing you to run a report dynamically from your Web browser. Optionally, it can use the in-process Reports Server, which reduces the maintenance and administration of the Reports Server by providing a means for starting the server automatically, whenever it receives the first request from the client.
The keywords used with rwservlet are also known as Web commands. Oracle Reports 11g Release 1 (11.1.1) introduces security access levels for rwservlet Web commands, based on two categories:
The security access levels are specified using Oracle Enterprise Manager, as described in Section 6.8.4, "Defining Security Policies for Web Commands":
Note:
When you use rwservlet to run a JSP, you can use all keywords applicable to rwservlet. For more information on running a JSP with rwservlet, see Section 17, "Running Report Requests".
Note:
The following keywords are commands rather than keyword=value pairs; that is, these keywords are entered by themselves without a corresponding value: SHOWENV,SHOWJOBS, SHOWMAP, SHOWMYJOBS, KILLJOBID, KILLENGINE, PARSEQUERY, DELAUTH, GETJOBID, and GETSERVERINFO.
Refer to Table A-1 for the keywords that can be used with rwservlet.
Examples
In the following examples, myias.mycomp.com is your Oracle Application Server instance, and 7779 is the port where rwservlet is running.
Example 1:  Running a paper report to a browser (cache)
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserv+report=test.rdf+userid=scott/tiger@mydb+desformat=pdf+DESTYPE=cache
Example 2:  Sending report output to a file
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserv+report=test.rdf+userid=scott/tiger@mydb+desformat=pdf+DESTYPE=file+DESNAME=c:\mydir\test
Example 3:  Sending report output to a printer
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserv+report=test.rdf+userid=scott/tiger@mydb+DESTYPE=printer+DESNAME=myprinter
Example 4:  Sending report output to e-mail
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserv+report=test.rdf+userid=scott/tiger@mydb+desformat=pdf+DESTYPE=mail+DESNAME="emp1@comp.com, emp2@comp.com"+CC="emp3@comp.com"+BCC="mgr@comp.com"+REPLYTO="me@comp.com"+FROM=me@comp.com"
Example 5:  Sending report output to WebDAV (any WebDAV server or Oracle Portal WebDAV)
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserv+report=test.rdf+userid=scott/tiger@mydb+desformat=htmlcss+DESTYPE=webdav+DESNAME="http://myusername:mypassword@mywebdavserv.com/mydir/test.html"
Example 6:  Sending report output to Oracle Portal
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserv+report=test.rdf+userid=scott/tiger@mydb+destype=oracleportal+desformat=PDF+PAGEGROUP=mypagegrp+OUTPUTPAGE=reports_output+ITEMTITLE=pushtoportal+STATUSPAGE=result
Example 7:  Sending XML PDS report output to a file
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserv+report=myxmlpdstest.rdf+destype=file+desformat=PDF+DESNAME=c:\mydir\my.pdf
Example 8:  Sending JDBC PDS report output to a file
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserv+report=myjdbcpdstest.rdf+destype=file+desformat=PDF+desname=c:\mydir\myxml.pdf+P_JDBCPDS=sybuser/sybpwd@server1.mydomain.com:1300
Example 9:  Distributing report output to multiple destinations
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserv+report=test.rdf+userid=scott/tiger@mydb+DISTRIBUTE=yes+DESTINATION=c:\mydistribute.xml
Example 10:  Running scheduled reports
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserver+report=test.rdf+SCHEDULE="every first fri of month from 15:53 Oct 23, 2007 retry 3 after 1 hour"+destype=file+desformat=pdf+desname=test.pdf
Example 11:  Using a secured Reports Server
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserv+report=test.rdf+userid=scott/tiger@mydb+desformat=pdf+destype=file+desname=test.pdf+AUTHID=myadmin/myadmin
Example 12:  Using a key map file (for more information, see Section 17.13, "Using a Key Map File")
http://myias.mycomp.com:7779/reports/rwservlet?key1
where
key1 is a key defined in the cgicmd.dat file (the keyname should be the first parameter)
or
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserv+userparam=12+CMDKEY=keyname
Example 13:  Running a report with a Parameter Form
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserver+report=test.rdf+userid=scott/tiger@mydb+destype=cache+desformat=htmlcss+PARAMFORM=html
Example 14:  Running a report with e-mail notification
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserver+report=test.rdf+userid=scott/tiger@mydb+destype=file+desformat=pdf+desname=test.pdf+NOTIFYSUCCESS="emp@comp.com"+NOTIFYFAILURE="admin@comp"
Example 15:  Running a report that specifies a URL to be fetched with the URL engine
http://myias.mycomp.com:7779/reports/rwservlet? server=myrepserver+report=test.rdf+userid=scott/tiger@mydb+destype=file+desformat=pdf+desname=test.pdf+JOBTYPE=rwurl+URLPARAMETER="http://www.oracle.com"
Example 16:  Showing the environment information for server myrepserver
http://myias.mycomp.com:7779/reports/rwservlet/SHOWENV? server=myrepserver+authid=myrepuser/myreppassword
Example 17:  Viewing the past jobs information for server myrepserver
http://myias.mycomp.com:7779/reports/rwservlet/SHOWJOBS?server=myrepserver+authid=myrepuser/myreppassword+queuetype=past
Example 18:  Viewing the cgicmd.dat key mappings (for more information, see Section 17.13, "Using a Key Map File")
http://myias.mycomp.com:7779/reports/rwservlet/SHOWMAP?authid=myrepuser/myreppassword
Example 19:  Viewing current jobs information for user myrepuser
http://myias.mycomp.com:7779/reports/rwservlet/SHOWMYJOBS? server=myrepserver+authid=myrepuser/myreppassword+queuetype=current
Example 20:  Getting the status of a job with job ID 30
http://myias.mycomp.com:7779/reports/rwservlet/SHOWJOBID30? server=myrepserver+authid=myrepuser/myreppassword
Example 21:  Cancelling a currently running job with job ID 122
http://myias.mycomp.com:7779/reports/rwservlet/KILLJOBID122? server=myrepserver+authid=myrepuser/myreppassword
Example 22:  Viewing the parsed query of a command
http://myias.mycomp.com:7779/reports/rwservlet/PARSEQUERY? server=myrepserver+authid=myrepuser/myreppassword+report=test.rdf+userid=scott/tiger@db+destype=cache+desformat=htmlcss
Example 23:  Showing DB authentication page
http://myias.mycomp.com:7779/reports/rwservlet/SHOWAUTH? server=myrepserver+authid=myrepuser/myreppassword+authtype=D
Example 24:  Deleting cookies set by rwservlet
http://myias.mycomp.com:7779/reports/rwservlet/DELAUTH? server=myrepserver+authid=myrepuser/myreppassword
Example 25:  Getting the output of job with job ID 87 from server myrepserver
http://myias.mycomp.com:7779/reports/rwservlet/GETJOBID87? server=myrepserver+authid=myrepuser/myreppassword
Example 26:  Displaying server information for server myrepserver
http://myias.mycomp.com:7779/reports/rwservlet/GETSERVERINFO? server=myrepserver+authid=myrepuser/myreppassword
Example 27:  Killing engine rwEng-1 in server myrepserver
http://myias.mycomp.com:7779/reports/rwservlet/KILLENGINE1? type=rwEng+server=myrepserver+authid=myrepuser/myreppassword

A.2.6 rwserver

rwserver (Reports Server) processes client requests, which includes ushering them through its various services, such as authentication and authorization checking, scheduling, caching, and distribution (including distribution to pluggable output destinations). Reports Server also spawns runtime engines for generating requested reports, fetches completed reports from the reports cache, and notifies the client that the job is ready.
Refer to Table A-1 for the keywords that can be used with rwserver.
To manage Reports Server using Oracle Enterprise Manager, refer to Chapter 6, "Administering Oracle Reports Services Using Oracle Enterprise Manager".
For manual configuration, see Section 7.2, "Reports Server Configuration File".

A.2.7 rwbridge

rwbridge (Oracle Reports Bridge) is used when Reports Server and Oracle Reports Client are in different Farms. Oracle Reports Client uses the default broadcast mechanism for server discovery, which sends packets that can travel only within a Farm. The Oracle Reports Bridge can bridge two Farms in a network. It intercepts the packets broadcast by Reports Server and Oracle Reports Client and transfers them to the remote bridges configured in the Oracle Reports Bridge configuration file.
There are no command line keywords for rwbridge.
To configure the Oracle Reports Bridge, refer to Section 6.5, "Configuring Oracle Reports Components".
To start and stop the Oracle Reports Bridge, see Chapter 5, "Starting and Stopping Oracle Reports Services".