You are reading the article **Learn The Different Examples Of Sqlite Function** updated in December 2023 on the website Kientrucdochoi.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. *Suggested January 2024 Learn The Different Examples Of Sqlite Function*

SQLite provides different kinds of functions to the user. Basically, SQLite has different types of inbuilt functions, and that function we easily use and handle whenever we require. All SQLite functions work on the string and numeric type data. All functions of SQLite are case sensitive that means we can either use functions in uppercase or lowercase. By using the SQLite function, we sort data as per the user requirements. SQLite functions have a different category, such as aggregate functions, data functions, string functions, and windows functions, and that function we can use as per the requirement.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

SQLite functionsNow let’s see the different functions in SQLite as follows.

1. Aggregate Functions

AVG: It is used to calculate the average value of a non-null column in a group.

COUNT: It is used to return how many rows from the table.

MAX: It is used to return the maximum value from a specified

MIN: It is used to return the minimum value from a specified

SUM: is used to calculate the sum of non-null columns from the specified table.

GROUP_CONCAT: It is used to concatenate the null value from the column.

2. String Functions

SUBSTR: It is used to extract and return the substring from the specified column with predefined length and also its specified position.

TRIM: It is used to return the copy of the string, and it removes the start the end character.

LTRIM: It is used to return the copy of the string that removed the starting character of the string.

RTRIM: It is used to return the copy of the string that removed the ending character of the string.

LENGTH: It is used to return how many characters in the string.

REPLACE: It is used to display the copy of the string with each and every instance of the substring that is replaced by the other specified string.

UPPER: It is used to return the string with uppercase that means it is used to convert the all character into the upper cases.

LOWER: It is used to return the string with a lowercase, which means converting all character into lower cases.

INSTR: It is used to return the integer number that indicates the very first occurrence of the substring.

3. Control Flow Functions

COALESCE: It is used to display the first non-null argument.

IFNULL: It is used to implement if-else statements with the null values.

IIF: By using this, we can add if – else into the queries.

NULLIF: It is used to return the null if first and second the element is equal.

4. Data and Time Function

DATE: It is used to determine the date based on the multiple data modifiers.

TIME: It is used to determine the time based on the multiple data modifiers.

DATETIME: It is used to determine the date and time based on the multiple data modifiers.

STRFTIME: That returns the date with the specified format.

5. Math Functions

ABS: It is used to return the absolute value of the number.

RANDOM: It is used to return the random floating value between the minimum and maximum integer.

ROUND: It is used to specify the precision.

ExamplesNow let’s see the different examples of SQLite functions as follows.

create table comp_worker(worker_id integer primary key, worker_name text not null, worker_age text, worker_address text, worker_salary text);Explanation

In the above example, we use the create table statement to create a new table name as comp_worker with different attributes such as worder_id, worker_name, worker_age, worker_address, and worker_salary with different data types as shown in the above example.

Now insert some record for function implementation by using the following insert into the statement as follows.

insert into comp_worker(worker_id, worker_name, worker_age, worker_address, worker_salary) values(1, "Jenny", "23", "Mumbai", "21000.0"), (2, "Sameer", "31", "Pune", "25000.0"), (3, "John", "19", "Mumbai", "30000.0"), (4, "Pooja", "26", "Ranchi", "50000.0"), (5, "Mark", "29", "Delhi", "45000.0");Explanation

In the above statement, we use to insert it into the statement. The end output of the above statement we illustrate by using the following screenshot as follows.

Now we can perform the SQLite different functions as follows.

a. COUNT FunctionSuppose users need to know how many rows are present in the table at that time; we can use the following statement.

select count(*) from comp_worker;Explanation

In the above example, we use the count function. The end output of the above statement we illustrate by using the following screenshot.

b. MAX FunctionSuppose we need to know the highest salary of the worker so that we can use the following statement as follows.

select max(worker_salary) from comp_worker;Explanation

In the above example, we use the max function to know the max salary of a worker from the comp_worker table. The end output of the above statement we illustrate by using the following screenshot.

c. MIN Function select min(worker_salary) from comp_worker;Explanation

The end output of the above statement we illustrate by using the following screenshot.

d. AVG FunctionSuppose users need to know the total average salary of a worker from comp_worker at that time; we can use the following statement as follows.

select avg(worker_salary) from comp_worker;Explanation

The end output of the above statement we illustrate by using the following screenshot.

e. SUM FunctionSuppose users need to know the total sum salary of a worker from comp_worker at that time; we can use the following statement as follows.

select sum(worker_salary) from comp_worker;Explanation

The end output of the above statement we illustrate by using the following screenshot.

f. Random Function select random() AS Random;The end output of the above statement we illustrate by using the following screenshot.

g. Upper FunctionSuppose we need to return the worker_name column in the upper case at that time, we can use the following statement as follows.

select upper(worker_name) from comp_worker;Explanation

The end output of the above statement we illustrate by using the following screenshot.

h. Length Function select worker_name, length(worker_name) from comp_worker;Explanation

The end output of the above statement we illustrate by using the following screenshot.

ConclusionWe hope from this article you have understood about the SQLite Function. From the above article, we have learned the basic syntax of Function statements, and we also see different examples of Function. From this article, we learned how and when we use SQLite Functions.

Recommended ArticlesWe hope that this EDUCBA information on “SQLite functions” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

You're reading __Learn The Different Examples Of Sqlite Function__

## Learn The Different Examples Of Bind Function

Introduction to DB2 bind

Database management systems provide a different kind of function to the user; the DB2 bind function is one of the functions provided by the database management system. In which that bind function () is used to establish the relationship between the application program and relational data. When we execute the bind function, that means during the execution of the binding process or function, it performs different kind of actions such as it validate all referenced objects in the SQL statement of the specified program that means the user-created table, created view column name per the DB2 catalog that is given.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Syntax

Explanation

In the above syntax, we select statements with different parameters as follows.

colm 1, 2, and N: It is a column name that is created inside the table.

specified schema name: It is a user-defined schema.

specified table name: Specified table name means an actual table that the user creates.

where: It is used for the condition, and it contains an input bind function.

How does the bind function work in DB2?Now let’s see how the bind function works in DB2 as follows.

Utilizing the input bind function, we can improve execution. A query can be arranged once and executed at various times, changing the bind variable values between every execution of the SQL statement at the server-side.

Utilizing the bind function, we can improve the reserve hit rate for data sets as well as which is used to store prepared queries. Information bases that support to bind function variables parse the query at that point plug input bind function into the generally parsed code. On the off chance that a similar query is run a lot of times, even with various qualities for the info tie factors, the database will have the code stored and will not need to parse the inquiry once more. In the event that you don’t utilize input bind faction, the information base will parse the query each time on the grounds that the where the condition will be marginally extraordinary each time and the code for every one of those somewhat various queries will stop up the reserve.

As a dependable guideline, you should utilize input bind variables rather than replacements in the WHERE clause of SELECT explanations at whatever point you can.

Output bind variable permit esteems to be passed straightforwardly from procedural code into cushions in your program, that means user-defined program. For the most part, this is more helpful and proficient than constructing a query that calls procedural code or building procedural code that fabricates an outcome set.

SQL Relay will counterfeit information and bind variables for data set API’s which don’t locally uphold ties. Presently that is only the MDB Tools association. Postgresql 8, MySQL 4.1.2, and current SQLite support bind variables, yet more seasoned variants don’t. SQL Relay fakes input binding for Postgresql, MySQL, and SQLite renditions that don’t uphold them. For variants that do, the “fackebinds” interface string boundary can be utilized to compel SQL Relay to counterfeit ties instead of utilizing the data set’s implicit help. You can utilize either Oracle style or DB2/Firebird style tie factors with those data sets. Yield ties are not upheld when utilizing “fakebinds”.

When utilizing a data set for which SQL Relay fakes bind variable, you should make a point not to pass some unacceptable sort of information into a bind variable.

The SQL explanation in the past area is an illustration of a named tie. Every placeholder in the articulation has a name related to it, for example, ’emp_name’ or ’emp_sal’. At the point when this assertion is readied, and the placeholders are related with values in the application, the name makes the affiliation of the placeholder utilizing the OCIBindByName() call with the name of the placeholder passed in the placeholder boundary.

The second sort of bind is known as a positional bind. In a positional tough situation, the placeholders are alluded to by their situation in the articulation instead of their names. For restricting purposes, an affiliation is made between information esteem and the situation of the placeholder.

Insert into employee values(:emp_no, :emp_name, :emp_job, :emp_sal)

ExamplesNow let’s see the different examples of the bind function to better understand as follows.

First, create a new table by using the following create table statement as follows.

create a new table by using the create table statement as follows.

comp_address text);

Explanation

In the above example, we use a create table statement to create a new table name as a company with different attributes such as Comp_id, comp_name, and comp_address with different data types and different sizes as shown in the above statement.

For confirmation, insert some records by using the following insert into the statement as follows.

select * from company;

In the above example, we use to insert into statement. The end out we illustrate by using the following screenshot as follows.

Select count(*) from company where comp_name = :Dell and comp_address = :Pune;

Explanation

In the above example, we use a select statement with a count function as shown in the above statement; here, we use a bind variable such as comp_name and comp_address in the above statement. The end out we illustrate by using the following screenshot as follows.

Now execute the following statement as follows.

AND comp_address = ‘Pune’;

After checking the performance of the above statement, you will get a difference between them.

ConclusionWe hope from this article you have understood about the DB 2 bind functions. From the above article, we have learned the basic syntax of the bind function, and we also see different examples of bind function. We also learn the rule for the bind function. From this article, we learned how and when we use the DB 2 bind function.

Recommended ArticlesThis is a guide to DB2 bind. Here we discuss the basic syntax of the bind function, and we also see different examples of bind function. You may also have a look at the following articles to learn more –

## Learn The Different Examples Of Matlab Exponent

Introduction to MATLAB exponent

MATLAB offers us different types of exponent functions that can compute the exponential of an array or matrix. These functions can be used to compute basic exponential, matrix exponential, or exponential integral as per our requirement. In this article, we will learn about 3 exponent functions offered by MATLAB: exp, expint, and expm. With the help of these functions, we can compute the solution when our input is an array, matrix, or a complex number and ‘e’ is raised to this power.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Syntax of exponent function:

E = exp (I)

E = expint (I)

E = expm (I)

Description of the syntax:

E = exp (I) is used to return the exponential ‘e’ raised to the power (I). For an array, it will compute the exponential of every element

E = expint (I) is used to return the exponential integral of every element in the input ‘I’

E = expm (I) is used to compute the matrix exponential for our input matrix ‘I’. Please note that matrix exponential is given by the formula:

Examples of Matlab exponentLet us now understand the code for these exponent functions in MATLAB

Example #1 (exp (I))In this example, we will find the exponent of an array in MATLAB by using the exp (I) function. Below are the steps to be followed:

Initialize the array whose exponent we need to compute

Pass the input array as an argument to the exp function

Code:

I = [2 4 6 2 6] [Initializing the array whose exponent we need to compute] [Passing the input array as an argument to the exp function]

This is how our input and output will look like in MATLAB:

Input:

Output:

As we can see in the output, the exp function has computed the exponential of every element in our input array ‘I’.

Next, we will learn the use of the expint function

Example #2 (expint (I))

In this example, we will find the integral exponent of an array in MATLAB by using the expint (I) function. Below are the steps to be followed:

Initialize the array whose integral exponent we need to compute

Pass the input array as an argument to the expint function

Code:

I = [2 3 5 1 6] [Initializing the array whose integral exponent we need to compute] [Passing the input array as an argument to the expm function]

This is how our input and output will look like in MATLAB:

Input:

Output:

As we can see in the output, the expint function has computed the integral exponential of every element in our input array ‘I’.

Next, we will learn the use of the expm function

Example #3 (expm (I))In this example, we will find the matrix exponent of a matrix in MATLAB by using the expm (I) function. Below are the steps to be followed:

Initialize the matrix whose matrix exponent we need to compute

Pass the input matrix as an argument to the expm function

Code:

I = [2 3 5; 1 0 3; 2 5 7] [Passing the input matrix as an argument to the expm function]

This is how our input and output will look like in MATLAB:

Input:

Output:

As we can see in the output, the expm function has computed the matrix exponential of our input matrix ‘I’.

The exponent functions discussed above can also be used to compute the exponential of complex numbers. Let us understand this with an example.

Example #4 (exp (I))In this example, we will find the exponent of an array of complex numbers in MATLAB by using the exp (I) function. Below are the steps to be followed:

Initialize the array of complex numbers whose exponent we need to compute

Pass the input array as an argument to the exp function

Code:

I = [2 + 3i 5 - 1i 4 + 5i] [Initializing the array of complex numbers whose exponent we need to compute] [Passing the input array as an argument to the exp function]

This is how our input and output will look like in MATLAB:

Input:

Output:

As we can see in the output, the exp function has computed the exponential of every complex element in our input array ‘I’.

Conclusion

Different forms of Exponent function can be used to compute the exponentials as per our requirement.

Basic exponential, integral exponential, matrix exponential are the types of exponentials we can compute using the exponent functions.

The exponential of complex numbers can also be calculated using the exponent functions.

Recommended ArticlesThis is a guide to Matlab exponent. Here we discuss the 3 exponent functions offered by MATLAB: exp, expint and expm, along with the examples. You may also have a look at the following articles to learn more –

## Learn The Different Examples Of Numpy Random

Introduction to NumPy random

A Random number is a number that is generated without following any logic or pattern so that it cannot be used again for any process; such kind of random number generation is very useful in the security or encryption of crucial information, and so serve this purpose python has a library that performs a variety of numerical operation very easily called Numpy (Numerical Python) which can be used in the generation of Pseudo-Random numbers using BitGenerator that gives different combinations of sequences and the Generator then transforms the sequences into numbers following probability distribution.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

SyntaxNumpy can generate a Random sequence for various data types like float, int, array, etc. Random number generation is performed by importing the Random package from the Numpy library. The basic syntax for numpy random generation is

from numpy import random randint(int) Examples of NumPy randomLet us discuss a different example of using different random generation techniques for better understanding.

Example #1Code:

from numpy import random a = random.randint(10) b= random.randint(50) print(a) print(b)In this example, we have imported the random package from the numpy library to operate. We have generated random integer a & b using the numpy random.randint() syntax and the value we gave in the bracket is the maximum limit for generating a random number. The output 4 is below the 10 we declared, and 44 is below the 50 we have declared.

Example #2We Numpy random to generate a list of float values in this example,

Code:

from numpy import random a = random.rand() b= random.rand(5) print(a) print(b)Output:

In this example, we have used the random.rand() syntax, which allows us to generate float values. We haven’t declared any number in the variable’ a’, so it generates a random float from 0 to 1 by default. In variable ‘b,’ we have declared a limit of 5, so we have a list of 5 random float values. We can declare any number to generate float values of that limit we have declared.

Example #3In this example, we’ll discuss the random generation of numpy arrays using a similar syntax we used in the previous examples.

Code:

from numpy import random a = random.randint(10, size=(3)) b= random.randint(50, size=(7)) print(a) print(b)Output:

We have used the randint syntax and declared the maximum limit and the sequence size we are generating in this example. This method is a random generation of 1-dimensional arrays. For ‘a’, we declared the maximum limit to be 10 and the sequence length to be 3; for ‘b,’ we declared the maximum limit to be 50 and the sequence length to be 7, and we got the corresponding output.

Similarly, we’ll try to generate 2-dimensional arrays in the following code.

Code:

from numpy import random a = random.randint(10, size=(3,3)) b= random.randint(50, size=(5,5)) print(a) print(b)Output:

Using a similar code, we have generated the 2-dimensional random arrays by declaring the size of the generation in two dimensions. For example, in variable ‘a’, we have declared the maximum limit to be 10 and the length of the sequence to be 3, 3, which is a two-dimensional array, and for ‘b,’ we have declared the maximum limit to be 50 and the length of the sequence to be 5, 5, and we got the corresponding 2-dimensional array as output.

We can also generate 3-dimensional arrays using the same technique as shown below.

Code:

from numpy import random a = random.randint(10, size=(3,2,1)) print(a)Code:

from numpy import random b= random.randint(50, size=(5,2,1)) print(b)Output:

In the above example, we have generated 3-dimensional random arrays for variables ‘a’ and ‘b’ where the size we have ‘a’ we have declared the maximum limit to be 10 and the length of the sequence to be (3, 2, 1), which is a two-dimensional array and for ‘b’ we have declared the maximum limit to be 50 and length of the sequence to be (5,2, 1) and we got the corresponding 3-dimensional array as output.

Example #4In the previous example, we have discussed the generation of multiple dimensional arrays using integer values; here, we will discuss the generation of float values.

Code:

from numpy import random a = random.rand(3,2) b = random.rand(5,2) print(a) print(b)Output:

When we are using chúng tôi syntax, it generates float values as default from 0 to 1, so when we declared the size of the random generation in two dimensions as we did in the above code where ‘a’ and ‘b’ is given a two-dimensional size of (3,2) & (5,2) we get the two-dimensional float array.

Similarly, for 3-dimensional float array,

Code:

from numpy import random a = random.rand(3,2,2) b = random.rand(5,2,2) print(a) print(b)Output:

So in this code, we have declared the three-dimension size for a & b as (3,2,2) & (5,2,2), so we got the output in a three-dimensional array.

Example #5Another method in Numpy random generation uses a function as a choice(), which allows the computer to make a random choice from the given sequence of values.

Code:

from numpy import random a = random.choice([8, 10, 16]) b= random.choice([80, 100, 160,1100]) print(a) print(b)Output:

In this method, we use a function called choice(), which allows the computer to randomly select a value from the array of values the user declares.

The choice() function gets an array as input and gives a randomly selected value as output. Thus, we can give an array of any length and generate a random value from it.

Similarly, we can generate multi-dimensional arrays using the choice() function by giving the size of the dimension.

Code:

from numpy import random a = random.choice([8, 10, 16],size=(3, 2)) b= random.choice([80, 100, 160,1100],size=(5, 2)) print(a) print(b)Output:

So using the choice() function, we can declare the size and generate 2-dimensional and 3-dimensional arrays from the array we have declared.

ConclusionIn this article, we have discussed Numpy random using various examples. We have also discussed generating random values using integers, floats, and arrays. We also discussed different techniques for generating multi-dimensional arrays numpy random can be very helpful for working on various projects involving random sequence generation.

Recommended ArticlesWe hope that this EDUCBA information on “NumPy random” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

## Learn The Examples Of Bootstrap Combobox

Introduction to Bootstrap Combobox

The Combo-box in bootstrap is a combination of the list box, input field, and dropdown box. The dropdown list mostly used for the combo box with the search button. The list box with the search field is used in the combo box. Sometimes users can choose multiple items using the list box. The input field is editable in the combo box of bootstrap. You can add the value according to the requirement. The user can choose the value from the list otherwise enter the value as per demand and requirement. The developer needed bootstrap and JavaScript together to make a combo box in bootstrap. In this topic, we are going to learn about Bootstrap Combobox.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

SyntaxTo understand how to work in combo box, we need syntax of list/ dropdown in bootstrap. How to work search and list/ dropdown together, we need basic JavaScript syntax.

The following syntax is a list box with a search in bootstrap syntax.

The bootstrap syntax for the list.

JavaScript syntax for search.

$(document) .ready(function(){ $("#listbox") .on("keyup", function() { var values = $(this) .val() .toLowerCase(); $("#listItem li") .filter(function() { }); }); });The toLowerCase() used to convert the characters uppercase to lowercase for display and search.

Examples of Bootstrap ComboboxHere are the following examples mentioned below

Example #1You can see the combination of the list box with the input box together.

The form-control class used for the input search box in bootstrap.

The list-group and list-group-item used for the list box.

The filter() function used for search the item given list using JavaScript.

Code:

$(document) .ready(function(){ $(“#listbox”) .on(“keyup”, function() { var values = $(this) .val() .toLowerCase(); $(“#listItem li”) .filter(function() { }); }); });

Output

Before search

After search

Description:

The example, IN search in the search box and INDIA and CHINA display.

Example #2The combination of the dropdown with an input field for searching.

The dropdown class is used to button and input attributes used for search.

Code:

$(document) .ready(function(){ $(“#listbox”) .on(“keyup”, function() { var values = $(this) .val() .toLowerCase(); $(“#listItem li”) .filter(function() { }); }); });

Output

Before Searching

After searching

Example #3In the dropdown box, the user can directly connect with the search tag and display the required value. If the user can Type required character in the search box then dropdown automatically displays the values.

$(document) .ready(function(){ $(“#listbox”) .on(“keyup”, function() { var values = $(this) .val() .toLowerCase(); $(“#listItem li”) .filter(function() { }); }); });

Output

Example #4The combo box can add the item in list and dropdown box as per requirement. See the below example.

Code:

<script src= $(function() { var add1 = $(‘#adding’); var listCon = $(‘#listItem’); event .preventDefault(); input1 = $(‘#listbox’).val(); $(‘#listbox’) .val(”); }); });

Output

Before adding the item in the list.

After adding the item in the list.

ConclusionThe combo box in bootstrap is a combination of many tags and attributes in one form. Along with Bootstrap, JavaScript or JQuery is required for the combo box. Users can search and add the items in the list box or dropdown list. The input field is required for add and search items for the list.

Recommended ArticlesThis is a guide to Bootstrap Combobox. Here we discuss the Examples of Bootstrap Combobox which explains that Users can search and add the items in the list box or dropdown list. You may also have a look at the following articles to learn more –

## Working Of The Decode Function With Examples

Introduction to PL/SQL DECODE

In this article, we will study the general syntax of the decode function along with the help of arguments and will also try to understand its working and implementation along with the help of some examples.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

The syntax of the DECODE function in the PL/ SQL Oracle database is as shown in the below description –

DECODE (expression/value, search expression 1, return value 1 [, search expression 2, return value 2], …. [, search expression n, return value n] [, default value])The terminologies used in the above syntax are as described here –

Expression or value – This is the literal value of an expression or a column name of the table, which we have to compare with the search expressions. Before comparing this value, it is converted into the datatype of the search expression 1. If they evaluate to true, the return value is returned or else if default value is specified then it is returned else NULL is return if a comparison of the expression and the search expression evaluates false.

Search expression 1, Search expression 2, Search expression 3, …. Search expression n – This is the expressions with which the expression will be compared one by one. Each of the search expressions is firstly converted to the appropriate datatype and then compared with the expression.

Note: If for any of the search expressions the comparison evaluates to true, then there is no datatype conversion taking place for the further search expressions. Which means that if a comparison of expression and search expression r-1 evaluates to true, then all the expressions starting from search expression r until last are not even converted to compatible datatypes for conversion.

Default value – If for all the mentioned search expressions the comparison evaluates to false, then the NULL value is returned from the decode function if this default value parameter is not specified. This is an optional parameter. IF comparison evaluates to false by all the search expression comparisons, then the decode function returns the default value as the output of the function.

Note: All these parameters search expressions, return values, and the default value can be expressions. When they are specified as expressions, their value is evaluated only when we have to do a comparison which involves those expression participants, or else, they are not evaluated when specified.

Working and Examples of PL/SQL DECODELet us try to understand the working of the DECODE function with the help of simple examples.

Example #1Consider the following query statement in PL/ SQL:

SELECT DECODE (500, 500, "Five Hundred") FROM dual;The output of the above query statement after execution is as shown below –

IF 500===500 THEN RETURN "Five Hundred" END IF; Example #2If we try to execute the following query statement with the DECODE function shown below, then it returns the NULL value –

SELECT DECODE (500,600," Five Hundred") FROM dual;The output of the execution of the above query statement is as shown below –

This is because when the comparison of the first two arguments evaluates to false, then as no default value is mentioned, the last parameter, the return value by default for false evaluation, is NULL which is given as output. The working of the above decode function is internally similar to following if-else condition –

IF 500=600 THEN RETURN "Five Hundred" ELSE RETURN NULL END IF; Example #3We can also provide more than one search expression for comparison; in that case, our decode function will be behaving the same as that of the if-else if ladder. Let us consider an example for that scenario as well. Let us try executing the following query statement of decode function –

SELECT DECODE (500, 600, "Six Hundred", 500, "Five Hundred") FROM dual;The output of the execution of the above query statement is as shown below –

IF 500 = 600 THEN RETURN 'Six Hundred'; ELSEIF 500 = 500 THEN RETURN 'Five Hundred'; END IF; Example #4We can even try providing the default value when neither of the search expression matches with the specified expression. Consider the following query statement –

SELECT DECODE (300, 600, "Six Hundred", 500, "Five Hundred"," Not even Five or six hundred") FROM dual;The output of the execution of the above query statement is as shown below:

The above query statement behaves in the same manner as shown in the below program of PL/ SQL of If else if ladder.

IF 300 = 600 THEN RETURN 'Six Hundred'; ELSEIF 300 = 500 THEN RETURN 'Five Hundred'; ELSE RETURN "Not even Five or six hundred" END IF;Null Play

Even though in all other cases, when you compare a null value with a null value, they are not treated as equal while using the DECODE function if you try to provide the NULL in first as well as any of the search expressions, the corresponding return value is returned as output which means that the two null values are treated equal.

Conclusion – PL/SQL DECODEWe can make the use of the DECODE function in PL/ SQL for making the use of the same functionality provided by if else if ladders that are for conditional statement evaluation. We can even specify the default value for false evaluation.

Recommended ArticlesWe hope that this EDUCBA information on “PL/SQL DECODE” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

Update the detailed information about **Learn The Different Examples Of Sqlite Function** on the Kientrucdochoi.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!