Monday, 24 December 2018

Apex used to call the Oracle JOB scheduler and Java


  • Create the html link on apex
  • Ajax(Application Process) used to call the DBMS_SCHEDULER then generate the job name
  • Ajax(Application Process) used to call the DBMS_SCHEDULER .CREATE_JOB then Execute the job name

Example : 
          select DBMS_SCHEDULER.GENERATE_JOB_NAME('hariharhomes') into jobnames from              dual;

          dbms_scheduler.create_job( job_name=>jobnames, job_type=>'executable',
          job_action=>'/u01/app/oracle/product/10.2.0/ias/Apache/Apache/images/mani.sh',                                enabled=>TRUE );

Report Generation from BI through APEX


  • Oracle APEX is user friendly for designing part as well as client side data entry and validation related things.
  • Oracle BI Publisher is good for report output; it will give the output files like PDF, XLS etc, Very big advantage in BI Publisher is that can produce multiple output files as a report. With the option of Bursting.
  • Bursting will be scheduled with the particular time interval, or can schedule by the time as per the report need.
  • Template file is base for required output report. Because output will be produced based on the input template design.
  • In APEX, under Shared components there is an option called Report Layouts, that is getting the input template file for report designing.

  • That same navigation having the link called Report Queries, which is getting the query from user to generating report based on template and query.
  • When the user clicking on the designed button, then the Report file will be generated based on template and query.
  • The button option should be Download printable Report Query, and then only that printable option will work.

Create Customize POPUP LOV for APEX


  • Javascript Used to Get the Tabular Form Id
          Example :

          var eleTables = document.getElementsByTagName("table");
          for (var i=1;i
          var tId = eleTables[i].id;
          if(tId.substring(0,7)!=''){
          if(tId.substring(0,7)=='report_'){
          var originalId = i;
          var tableIds = eleTables[i].id;
          tableId = tableIds;
          return tableId;
         } } }

  • Create the POPUP Image on tabular column
          Example :

          var link = document.createElement('a');
          var image = document.createElement('img');
          var span = document.createElement('span');
          link.setAttribute('href','javascript:genList0_f16_0("'+a1+'","'+filters+'")');
          link.className="dark";
          image.setAttribute('src','/i/list_gray.gif');
  • Customize the Window open
          Example :

          w = open("wwv_flow_utilities.gen_popup_list" +
          "?p_filter=" +
         "&p_name=" + escape(filters) + "&p_element_index=" + escape (a1) +
         "&p_form_index=" + escape('0') + "&p_max_elements=" + escape('') +
         "&p_escape_html=" + escape('') + "&p_ok_to_query=" + escape('YES') +
         "&p_flow_id=" + escape(appId) + "&p_page_id=" + escape(pageId) +
         "&p_session_id=" + escape(l_field) + "&p_eval_value=" + escape('') +
         "&p_translation=" + escape('NO') + "&p_lov_checksum=Dynamicchecksum
         "winLov", "Scrollbars=1,resizable=1,width=400,height=450");
         if (w.opener == null) w.opener = self; w.focus();

         Based on Custom POPUP(Head No Column) append the value to Select list(Product) and read             only column(Description and Drawing No)
         
         Here Return value(M2595) also customized then return to Tabular Column.


Dynamically Generate the Checksum id to solve the apex vulnerability problem


  • Ajax(Application Process) used call the Oracle Query of APEX_ITEM.MD5_CHECKSUM
    • Java method of Math.random used to get Random no
    • Random no used to get the Attribute value from Select list
          Example

          thisObj = objs[rand_no];
          if(thisObj){
          checksumId=thisObj.getAttribute('value');
          return checksumId;
  • Apex Generate the checksum id per day only one time, I have customized and generated the checksum id per each page refresh.
  • Here show the checksum id screenshot,

To put the Company logo in each APEX page


  • Go to Shared Components then click the images link and upload the image to application.
  • Click the Definition write the image name to logo text field as #WORKSPACE_IMAGES#company_logo.gif
  • Go to Page Template and add the LOGO prefix at table

BI Bursting


  • One of the very good features of Oracle BI Publisher is its ability to burst and send the reports to multiple users simultaneously.


  • Using BI Publisher's bursting feature we can split a single batch report into individual reports to be delivered to multiple destinations. We can apply a different template, output format, delivery method, and locale to each split segment of our report.
  • Example implementations include:
    1. Invoice generation and delivery based on customer-specific layouts and delivery preference
    2. Financial reporting to generate a master report of all cost centers, bursting out individual cost center reports to the appropriate manager
    3. Generation of pay slips to all employees based on one extract and delivered via e-mail
Enabling a Report for Bursting
  • Prerequisite
    • A report defined in BI Publisher. The report data must contain an element by which the report will be split and an element by which the report will be delivered.
  • Enabling a report for bursting consists of the following steps:
    • Open the report in Edit mode.
    • Select Bursting under the report definition.
    • Select the Enable Bursting check box.
    • Select the Split By and Deliver By elements.
  • The Split By element is the data element from the report file that you wish to split the report by. For example, to split a batch of invoices by each invoice, you may use an element called CUSTOMER_NAME.
  • The Deliver By element is the data element from the report file by which to determine the delivery method.
  • In the invoice example, it is likely that each invoice will have delivery criteria determined by customer; therefore the Deliver By element may be CUSTOMER_ID.
    • Select the data source for the delivery XML.
  • The delivery XML can be sourced from the same data source as the main data set, or it can be generated from a different data source.
    • Enter the SQL query to build the delivery XML. See Defining the Delivery Data Set for details.

  • Defining the Delivery Data Set
    • Based on the SQL query that we provide on the Bursting criteria page of the Report Editor, BI Publisher will build the delivery XML data set.
    • The delivery XML data set contains the information to deliver the burst report appropriately to each recipient. The delivery data in this XML document is used as a mapping table for each Deliver By element. The structure of the delivery XML is as follows:

  • Where
    • KEY is the Delivery key and must match the Deliver By element. The bursting engine uses the key to link delivery criteria to a specific section of the burst data. TEMPLATE - is the name of the Layout template to apply. Note that the value is the Layout name (for example, "Invoice"), not the template file name (for example, invoice.rtf).
    • TEMPLATE_FORMAT - is the format of the layout template. Valid values are:
      • RTF
      • PDF
      • ETEXT
      • XLS_FO
    • LOCALE - is the template locale, for example, "en-US".
    • OUTPUT_FORMAT - is the output format. Valid values are: for example: pdf, html, excel.
      • HTML
      • PDF
      • RTF
      • EXCEL
    • DEL_CHANNEL - is the delivery method. Valid values are:
      • EMAIL
      • FAX
      • FILE
      • FTP
      • PRINT
      • WEBDAV
    • Delivery parameters by channel. The delivery parameters by channel are defined in the following table:
    • Parameter Mapping

Table Partitioning

  • Every data’s should be stored in database, because world can’t run without storing the data’s in the database. 
  • Machinery world should store data’s in database for future reference and process, so the database will be filled up of data’s. 
  • The records will be more and more and the size of the data might be Tera bytes of ranges. These databases are known as Very Large Databases (VLDB). 
  • Oracle has provided the feature of table partitioning i.e. we can partition a table according to some criteria.

          For example we have an EMPLOYEE table with the following structure,
          Suppose this table contains millions of records, but all the records belong to four years only                i.e.  2007, 2008, 2009 and 2010. And most of the time we are concerned about only one or two            years i.e. we give queries like the following

          Employee Table Structure 
         
          Column           Data Type 
         
          Emp_id           Number(4)
          Emp_Name     Varchar2(10)
          Salary              Number(10,2)

          select sum(salary) from sales where year=1991;
          select Emp_Name,sum(salary) from sales where year=1992
          Group by Emp_Name;

          Now whenever you give queries like this Oracle will search the whole table. If you partition               this table according to year, then the performance is improve since oracle will scan only a                   single partition instead of whole table.

         CREATING PARTITION TABLES

  • To create a partition table gives the following statement


                   Create table employee(emp_id number(4),
                                             emp_name varchar2(10),
                                             salary number(10,2))
                   partition by range (year)
                   partition p1 values less than (2007) tablespace u1,
                   partition p2 values less than (2008) tablespace u2,
                   partition p3 values less than (2009) tablespace u3,
                   partition p4 values less than (2010) tablespace u4,
                   partition p5 values less than (MAXVALUE) tablespace u5;

  •  In the above example employee table is created with 5 partitions. Partition p1 will contain          rows  of year 2007 and it will be stored in tablespace u1.
  •  Partition p2 will contain rows of year 2008 and it will be stored in tablespace u2. Similarly p3 and p4 have in the respective partitions.
  • In the above example if we don’t specify the partition p4 with values less than MAXVALUE,   then we will not be able to insert any row with year above 2010.


  • Although not required, we can place partitions in different tablespaces. If we place partitions in different tablespaces then we can isolate problems due to failures as only a particular partition will not be available and rest of the partitions will still be available.

          The above example the table is partition by range.

  • In Oracle we can partition a table by using the following partition methods,
    1.          Range Partitioning
    2.          Hash Partitioning
    3.          List Partitioning
    4.          Composite Partitioning

      ALTERING PARTITION TABLES

  • To add a partition, we can add a new partition to the "high" end (the point after the last existing      partition). To add a partition at the beginning or in the middle of a table, use the SPLIT PARTITION clause.
  • For example to add a partition to employee table give the following command
         alter table employee add partition p6 values less than (2008);

  • To add a partition to a Hash Partition table give the following command.

         Alter table employee add partition;

  • Then Oracle adds a new partition whose name is system generated and it is created in the default tablespace.
  • To add a partition by user define name and in your specified tablespace give the following command.

          Alter table employee add partition p5 tablespace u5;

  • To add a partition to a List partition table give the following command.

          alter table employee add partition emp_name
         values (‘JONES’,’SMITH’);

  • Any value in the set of literal values that describe the partition(s) being added must not exist in any of the other partitions of the table.