Showing posts with the label Oracle

Self Join - How to Write Self Join Queries Easily

Self Join : By definition self join query is a query in which the table is joined to itself. Self joins are written in cases where there is...

Oracle Query to Repeat a Number n Times

I need to write one query which will accept input parameter from user and display that number of times the user input. For example if I giv...

Cursor For Loop Example in Oracle PlSql

Cursors provide easy way to fetch records from database table(s) and store them in memory for future use. The following steps are followe...

Max of Product N consecutive Digits - Oracle Sql Query

Q) I have a table which has only one column and one row. The numeric column contains a 6 digit number. My requirements are Find out the...

SQL Query to Group / Aggregate N Consecutive Rows

Q) In one of my project, I got a requirement to group N consecutive rows and find the min, max and sum of values in each group. In this art...

Oracle Trigger After Insert Example & Create

The after insert trigger in oracle is a DML trigger which is fired by an insert statement on a table. The oracle after insert trigger is us...

Oracle Trigger Before Insert Create & Example

The before insert trigger in oracle is a DML trigger which is fired by an insert statement on a table. The oracle before insert trigger is ...

Instead of Triggers on Views Example in Oracle

Instead of triggers in oracle database are defined on views only. A normal DML trigger executes only when a DML operation is issued on a ta...

Different Ways (How) to Delete Duplicate Rows in Table

In this article I am going to show different ways of deleting duplicating records from the table. It is a common question in interviews wh...

SQL Query to Select Numeric Values from Varchar Column in Oracle

Problem Description: One of the columns in the table is of varchar data type. It contains both strings, numbers, and mix of char and numeri...

System Triggers Example in Oracle PLSQL

System Trigger fires when a system event like database startup, shutdown or DDL operations like creating objects occur in oracle database. ...

Associative Arrays (Index-By Tables) Examples in Oracle Plsql

Associative arrays or index by tables are set of key-value pairs. The keys are unique and are used to get the values from the array. The ke...

Range Partitioning Examples - Oracle

Range partition is a partitioning technique where the ranges of data are stored on separate sub-tables. MAXVALUE is offered as a catch-all ...

Load Variable Fields Flat File in Oracle Table

In one of my project, we got a requirement to load data from a varying fields flat file into oracle table. The complete requirements are men...

Min and Max values of contiguous rows - Oracle SQL Query

Q) How to find the Minimum and maximum values of continuous sequence numbers in a group of rows. I know the problem is not clear without ...

Rewrite Sql Query | Sql Performance Tuning

Tuning an SQL query for performance is a big topic. Here I will just cover how to re-write a query and thereby improve the performance. Rewr...

Oracle General Function Examples

The general functions work with any data type and are mainly used to handle null values. The Oracle general functions are

Oracle Conversion Functions Examples

Conversions functions are used to convert one data type to another type. In some cases oracle server automatically converts the data to the ...

Oracle Subquery/Correlated Query Examples

A subquery is a SELECT statement which is used in another SELECT statement. Subqueries are very useful when you need to select rows from a t...

Oracle Single Row Functions Examples

Oracle provides single row functions to manipulate the data values. The single row functions operate on single rows and return only one resu...

Load More That is All