Cursors in PL/SQL

What is cursor: Pointer to the memory location where the information about sql stmt or DML statement got executed. There are two types of cursors − Implicit Cursor:= Any Select Stmt Or Any SQL Stmt Executed By Oracle Is Through Cursor And User Don’t Have Controlled On Implicit Cursor But Use Can Get Information …

CLOB to BLOB using PLSQL

Create function to convert the CLOB to BLOB CREATE OR REPLACE FUNCTION clob_to_blob (i_clob_text IN CLOB) RETURN BLOB IS /* Version 1 29-mar-2020 */ l_blob_file BLOB; l_lob_length PLS_INTEGER := DBMS_LOB.getlength (i_clob_text); l_position PLS_INTEGER := 1; l_buffer_size RAW (32767); BEGIN DBMS_LOB.createtemporary …

ORA-06533: Subscript beyond count

ORA-06533: Subscript beyond count Cause: An in-limit subscript was greater than the count of a varray or too large for a nested table. Action: Check the program logic and explicitly extend if necessary. CREATE OR REPLACE TYPE l_rec_type IS OBJECT (id NUMBER, name VARCHAR2 (4000)); / CREATE OR REPLACE TYPE l_tab_type IS …

Plsql Collection Data Deletion

PLSQL collection data deletion CREATE OR REPLACE TYPE l_rec_type IS OBJECT (id NUMBER, name VARCHAR2 (1111)); / CREATE OR REPLACE TYPE l_tab_type IS TABLE OF l_rec_type; / DECLARE l_tab l_tab_type := l_tab_type (); l_check NUMBER; BEGIN l_tab := l_tab_type (NULL, NULL); l_tab (1) := l_rec_type (1000, 'ashish'); …

Ref cursor switch based on condition

A ref cursor is a datatype that holds a cursor value in the same way that a varchar2 variable will hold a string value. Ref cursor will allow us to open difference sets of query where is the explicit cursor will not allow us to open a query other then the one which is associated to that cursor pointer. Using ref …

Row level, statement level Trigger

Create two table based on query: CREATE TABLE product (Message varchar2(50), Current_Date date ); CREATE TABLE product_log (Message varchar2(4000), Current_Date date ); Statement level trigger CREATE or REPLACE TRIGGER Before_Update_Stat_product BEFORE UPDATE ON product Begin INSERT INTO product_log …

Refresh a materialized view

To refresh a Materialized view we need DBMS_SNAPSHOT.REFRESH procedure. Steps. CREATE TABLE demo_m ( id NUMBER (10) primary key, name VARCHAR2 (400) ); / INSERT INTO DEMO_M ( ID, NAME) VALUES (1001, 'VIKAS' ); / SELECT * FROM demo_m; One record is available in the table. Create Materialized view. CREATE …

RANK and DENSE_RANK

RANK() : function always returns sequential order for each record. DENSE_RANK() : It returns continuous order for each record. SELECT empno, deptno, sal, mgr, RANK () OVER (PARTITION BY deptno ORDER BY sal) "rank", DENSE_RANK() OVER (PARTITION BY deptno ORDER BY sal) "dense rank" FROM emp;

Constraints in Nested table

In my previous blog “Working With Nested Table Oracle ” i have explained about how to work with nested tables. Here we can also define Constraints to the nested table. According to the previous blog “Working With Nested Table Oracle ” we have Table := dept_details nested table := employees with …

Working With Nested Table Oracle

Nested table is awesome feature of Oracle. You can create table inside a table, Which means one column can be treated as a table. Nested tables are faster than the parent child table relationship. Steps : Create Object TYPE CREATE OR REPLACE TYPE emp_rec_type AS OBJECT ( EMPNO NUMBER (4), ENAME VARCHAR2 (10 BYTE), …

Working with Multi Select List

As we know select list is an item type available in Oracle apex in each of the version, for the single selection you don’t need to bother, it is just below We have a select list in page region Here i have disabled Multi Selection . ITEM Settings Allow Multi Selection - NO Report query is just simple as where …