"Oracle ORDS parse" Code Answer's

You're definitely familiar with the best coding language SQL that developers use to develop their projects and they get all their queries like "Oracle ORDS parse" answered properly. Developers are finding an appropriate answer about Oracle ORDS parse related to the SQL coding language. By visiting this online portal developers get answers concerning SQL codes question like Oracle ORDS parse. Enter your desired code related query in the search bar and get every piece of information about SQL code related question on Oracle ORDS parse. 

Oracle ORDS parse

By Wicked WilletWicked Willet on Jun 24, 2020
CONN testuser1/testuser1@pdb1

CREATE OR REPLACE PROCEDURE create_departments (p_data  IN  BLOB)
AS
  TYPE t_dept_tab IS TABLE OF dept%ROWTYPE;
  TYPE t_emp_tab  IS TABLE OF emp%ROWTYPE;

  l_dept_tab     t_dept_tab := t_dept_tab();
  l_emp_tab      t_emp_tab  := t_emp_tab();

  l_clob         CLOB;
  l_dest_offset  PLS_INTEGER := 1;
  l_src_offset   PLS_INTEGER := 1;
  l_lang_context PLS_INTEGER := DBMS_LOB.default_lang_ctx;
  l_warning      PLS_INTEGER;

  l_dept_count   PLS_INTEGER;
  l_emp_count    PLS_INTEGER;
BEGIN

  -- Convert the BLOB to a CLOB.
  DBMS_LOB.createtemporary(
    lob_loc => l_clob,
    cache   => FALSE,
    dur     => DBMS_LOB.call);

  DBMS_LOB.converttoclob(
   dest_lob      => l_clob,
   src_blob      => p_data,
   amount        => DBMS_LOB.lobmaxsize,
   dest_offset   => l_dest_offset,
   src_offset    => l_src_offset, 
   blob_csid     => DBMS_LOB.default_csid,
   lang_context  => l_lang_context,
   warning       => l_warning);
   
  APEX_JSON.parse(l_clob);

  -- Loop through all the departments.
  l_dept_count := APEX_JSON.get_count(p_path => 'departments');
  FOR i IN 1 .. l_dept_count LOOP
    l_dept_tab.extend;
    l_dept_tab(l_dept_tab.last).deptno := APEX_JSON.get_number(p_path => 'departments[%d].department.department_no', p0 => i);
    l_dept_tab(l_dept_tab.last).dname  := APEX_JSON.get_varchar2(p_path => 'departments[%d].department.department_name', p0 => i);
    l_emp_count   := APEX_JSON.get_count(p_path => 'departments[%d].department.employees', p0 => i);

    -- Loop through all the employees for the current department.
    FOR j IN 1 .. l_emp_count LOOP
      l_emp_tab.extend;
      l_emp_tab(l_emp_tab.last).deptno   := l_dept_tab(l_dept_tab.last).deptno;
      l_emp_tab(l_emp_tab.last).empno    := APEX_JSON.get_number(p_path => 'departments[%d].department.employees[%d].employee_number', p0 => i, p1 => j);
      l_emp_tab(l_emp_tab.last).ename    := APEX_JSON.get_varchar2(p_path => 'departments[%d].department.employees[%d].employee_name', p0 => i, p1 => j);
      l_emp_tab(l_emp_tab.last).sal      := APEX_JSON.get_number(p_path => 'departments[%d].department.employees[%d].salary', p0 => i, p1 => j);
      l_emp_tab(l_emp_tab.last).hiredate := SYSDATE;
    END LOOP;
  END LOOP;

  -- Populate the tables.
  FORALL i IN l_dept_tab.first .. l_dept_tab.last
    INSERT INTO dept VALUES l_dept_tab(i);

  FORALL i IN l_emp_tab.first .. l_emp_tab.last
    INSERT INTO emp VALUES l_emp_tab(i);

  COMMIT;

  DBMS_LOB.freetemporary(lob_loc => l_clob);
EXCEPTION
  WHEN OTHERS THEN
    HTP.print(SQLERRM);
END;
/

Source: oracle-base.com

Add Comment

0

All those coders who are working on the SQL based application and are stuck on Oracle ORDS parse can get a collection of related answers to their query. Programmers need to enter their query on Oracle ORDS parse related to SQL code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about Oracle ORDS parse for the programmers working on SQL code while coding their module. Coders are also allowed to rectify already present answers of Oracle ORDS parse while working on the SQL language code. Developers can add up suggestions if they deem fit any other answer relating to "Oracle ORDS parse". Visit this developer's friendly online web community, CodeProZone, and get your queries like Oracle ORDS parse resolved professionally and stay updated to the latest SQL updates. 

SQL answers related to "Oracle ORDS parse"

View All SQL queries

SQL queries related to "Oracle ORDS parse"

Oracle ORDS parse oracle split string oracle sql drop index alter table oracle oracle sql create user oracle table statistics oracle to date oracle create procedure example select index table oracle oracle view index oracle auto_increment sql oracle update multiple rows specific date format oracle oracle to_number oracle sql copy table without data oracle remove line breaks oracle virtual column oracle SQL developer update from select oracle oracle create index if not exists oracle cursor rowcount oracle sql for each row oracle insert single quote in string oracle start job oracle: using statement oracle running queries oracle sql compile package différence entre deux dates sql oracle trim sql oracle exec procedure oracle oracle exchange partition ORACLE MULTIPLE CTE STATEMENTS oracle db get table sizes oracle last connexion oracle list partitions oracle allow space to user oracle sql union tables with different columns oracle user last connection date oracle execute package dblink oracle live sql oracle apex version view oracle plsql sleep oracle character index oracle exchange subpartition oracle calculate statistics on partition change compatible parameter in oracle 12c cube oracle oracle show running procedures how to increase the width of the screen in oracle oracle last connection oracle list subpartitions oracle show execution plan MAKE TABLE FIT in oracle sql apex for oracle 11g oracle list user locked oracle stop oracle sysdate - 1 month oracle show running queries oracle list partitioned tables oracle 11g forget password non equal join in oracle oracle least oracle list user grants oracle executing sqlplus commands and waiting for completion default username and password for oracle 11g equi joins in oracle Oracle NLS_CHARACTERSET how to create script to connect to oracle database and run query Tablespace ORACLE procedure excute monthly oracle oracle sql select from multiple tables oracle alter table add column column names in oracle sql oracle revoke grant oracle revoke module operator in oracle sql add days in oracle sql oracle c# multiple update sql mysql equivalent decode oracle Work around for mutating problem in Oracle Triggers. Please check it out. for loop in oracle oracle to_number oracle difference between two dates in days lpad oracle oracle select top 100 insert into select oracle

Browse Other Code Languages

CodeProZone