Index on Database Tables- Performance Benefits and Costs

Why Indexes?

Basic use of index is to find data in a table more quickly by speeding up the query searches. Consider an employees table with 1 million records. If I query the table to extract data for 1 employee based on emp_id, all the records are compared for the emp_id. This approach will be very time taking in real time when many queries are searching for records. Thus we should use indexes to speed up the searching process.

Continue reading
  2570 Hits
  0 Comments

CASE statement and expressions: usage in PL/SQL

CASE statement is used to select one out of many set of statements to execute.

Types of CASE statements:

Continue reading
  3357 Hits
  0 Comments

Records and Pseudo Records in PL/SQL

How about this.. you can create a composite data structure in pl/sql which can hold an entire row's data. Records are made up of one or more fields of same or different datatypes, same as a row in a table.

Example:

Continue reading
  7515 Hits
  0 Comments

Difference between DETETE, DROP and TRUNCATE Commands in SQL

I had some difficulty working with these 3 commands back when I was learning SQL particularly when deciding which one to use. SO, I've dedicated this blog to differentiating the three of them.

DELETE: used to remove rows selectively from a table. Delete is a DML command, so it will cause any delete triggers on the table to fire. You may need to explicitly commit after deleting from a table to make changes permanent.

Continue reading
  3344 Hits
  0 Comments

A Brief Description about INSTEAD OF Triggers

So folks, I’m not going to explain the trigger syntax here as its same for all types of triggers. I’ll start off with INSTEAD OF trigger straight away.

INSTEAD OF triggers hold a special functionality as they can be used to update views which are normally not updateable and perform insert, update, delete, merge operations on them.

Continue reading
  2682 Hits
  0 Comments

Module Overloading in Oracle PL/SQL

Introduction

Module overloading is a concept used across many programming languages mainly because it’s a very powerful feature which improves the usability of your software.

Continue reading
  3294 Hits
  0 Comments

When to use PL/SQL Autonomous Transactions?

Another cool and powerful feature that gives us the independence of carrying out a specific task as a separate transaction while inside the main transaction. The main transaction merely suspends for the duration the autonomous transaction runs.

It has great applications and uses while writing pl/sql code.

Continue reading
  3239 Hits
  0 Comments

DYNAMIC SQL - an introduction

What is the difference between dynamic sql and static sql?

Dynamic sql refers to statements that are constructed and executed at runtime. Whereas static sql statements are constructed when the pl/sql block containing the statement is compiled.

Continue reading
  2815 Hits
  0 Comments

Including User Defined Functions in SQL Queries

Functions are a great and fun way to implement any functionality in our code. Not only are they easy to code and include almost anywhere we need them, their reusability and the large acceptance of return datatypes make them a coder's superpower.

One of the benefits of user defined functions is that they can be included in sql queries just like any other oracle predefined functions.

Continue reading
  2296 Hits
  0 Comments