Search This Blog

Monday, July 16, 2018

PL/SQL To JSON Conversion





SET SERVEROUTPUT ON
DECLARE
  l_cursor SYS_REFCURSOR;
BEGIN
  
  OPEN l_cursor FOR
    SELECT e.empno AS "employee_number",
           e.ename AS "employee_name",
           e.deptno AS "department_number"
    FROM   emp e ;
   -- WHERE  rownum <= 2;

  APEX_JSON.initialize_clob_output;

  APEX_JSON.open_object;
  APEX_JSON.write('employees', l_cursor);
  APEX_JSON.close_object;

  DBMS_OUTPUT.put_line(APEX_JSON.get_clob_output);
  APEX_JSON.free_output;
END;

OUTPUT WILL LIKE :

{"employees":[{"employee_number":4,"employee_name":"ZAMAN","department_number":30}
,{"employee_number":2,"employee_name":"ZAMAN","department_number":30}
,{"employee_number":3,"employee_name":"ZAMAN","department_number":30}
,{"employee_number":1,"employee_name":"ZAMAN","department_number":30}
,{"employee_number":6,"employee_name":"ZAMAN","department_number":30}
,{"employee_number":7,"employee_name":"aa","department_number":30}
,{"employee_number":5,"employee_name":"jhjkhkj"}]}


Thursday, July 5, 2018

Classic Report Scroll Bar in Oracle Apex

To add scroll bar on classic report .

Use this CSS on Region >> Region Attribute

<div style ="overflow-x: scroll;overflow-y: scroll;height:500px;">
<div style ="overflow:auto;height:220px;"> 

Region Print by JavaScript Clicking on Button And Save PDF in Oracle Apex


1. Create a Region and Do what ever you want.

2. Set a static id of the region. Region properties>>Advance>>Static ID >> exp: printableArea

3. Create a button and use this code. Button properties>>Advance>>Custom Attributes>> 

onclick="printDiv('printableArea')"

4. Use this code on. Region propertice>>Footer Text>>

<script>
function printDiv(printableArea) {
     var printContents = document.getElementById(printableArea).innerHTML;
     var originalContents = document.body.innerHTML;
    document.body.innerHTML = printContents;
     window.print();
     document.body.innerHTML = originalContents;
}
</script>

Now Enjoy Region Print by JavaScript clicking on print button ..

Monday, July 2, 2018

Auto New Row Generation In Interactive Grid Using Bar-code Reader or Manual Input


1. Create a page and a region type Interactive Grid form from a table.
  (using where 1=2 for showing empty grid).

2. Now create a Dynamic action with Change Event and Execute javaScript Action
on column, from where new row will create.

3. Then goto Region Properties Advanced>> Static ID >> type a id like: REG_ID

4.Use below JavaScript for create new from Upper side new row.

apex.region("REG_ID").widget().interactiveGrid("getActions").invoke("row-add-row")
OR

apex.region("REG_ID").widget().interactiveGrid("getActions").invoke("insert-record")
 (for down side new row)

(After making interactive grid if there any primary key problem then go to a primary key column>>
Sours>>Primary Key>>Yes)

PDF to Text Covert by Oracle Apex

Here are the steps to convert and get the character into a region by Oracle Apex. Step1.  Create a page and Copy-Pest the below code into Pa...