## Floyd's triangle in PL/SQL

Updated on 01-Feb-2022 10:59:10
PL/SQL is a combination of SQL along with the procedural features of programming languagesFLOYD’s triangle − it is a triangle formed by natural numbers. It is the triangle formed by filling numbers in rows starting from 1 at the top-left corner. It is a right-angled triangle i.e. the count of numbers in each row is the same as the row number.In this problem, we are given a natural number N. Our task is to create Floyd’s triangle in PL/SQL.Let’s take an example to understand the problemInput: 16 Output: 1 2 3 4 5 6 7 8 9 10 11 12 ... Read More

## Finding sum of first n natural numbers in PL/SQL

Updated on 01-Feb-2022 10:26:35
In this problem, we are given a number N. Our task is to finding sum of first n natural numbers in PL/SQL.PL/SQL is a combination of SQL along with the procedural features of programming languages.PL/SQL has the following features −PL/SQL is tightly integrated with SQL.It offers extensive error checking.It offers numerous data types.It offers a variety of programming structures.It supports structured programming through functions and procedures.It supports object-oriented programming.It supports the development of web applications and server pages.PL/SQL has the following advantages −SQL is the standard database language and PL/SQL is strongly integrated with SQL. PL/SQL supports both static and ... Read More

## Find the area and perimeter of right triangle in PL/SQL

Updated on 27-Jan-2022 08:57:10
In this problem, we are given three values: base, height and hypotenuse of a right triangle. Our task is to find the area and perimeter of the right triangle in PL/SQL.PL/SQL is a combination of SQL along with the procedural features of programming languagesLet's take an example to understand the problem, Input : height = 4, base = 3, hypotenuse = 5 Output : area = 6, perimeter = 12Explanation −1 + 22 + 333 + 4444 = 4800 Solution ApproachA simple approach to solve the problem is using the formula for the area and perimeter of the triangle.Area = ... Read More

## Reverse a Number in PL/SQL

Updated on 08-Mar-2023 13:16:44
PL/SQL is a block-structured language that combines SQL's functionality with procedural commands. In this article, we will discuss a program in PL/SQL to reverse a given number for example −Input : 98765 Output : 56789 Explanation : reverse number of 98765 is 56789. Input : 56784 Output : 48765 Explanation Reverse number of ‘56784’ is ‘48765’.Approach to find The SolutionTake out the last digit from the number by finding the remainder of num/10.Now add the last digit to another variable reversed_num.Now check if num becomes 0 −If YES, then go to STEP1.If NO, then go to STEP4.Finally, print the ... Read More

## Explain the PL/SQL Engine in DBMS

Updated on 08-Mar-2023 13:30:54
PL/SQL is oracle’s procedural language extension to SQL. PL/SQL allows you to mix SQL statements with procedural statements like IF statements. Looping structure etc, PL/SQL is the superset of SQL. It uses SQL for data retrieval and manipulation and uses its own statement for data processing.Pl/SQL program units are generally categorized as follows −Anonymous blockThis is a PL/SQL block that appears within your application. In many applications PL/SQL blocks can appear where SQL statements can appear. Such blocks are called Anonymous blocks.Stored proceduresThis is a PL/SQL block that is stored in the database with a name. Application programs are executing ... Read More

## What is PL/SQL?

Updated on 08-Mar-2023 13:34:25
It is a procedural extension language (PL) for the structured query language (SQL) and the Oracle relational database. It provides a built-in, interpreted and OS independent programming environment.Apart from Oracle it also available Times Ten in-memory database and IBM DB2.The Syntax of PL/SQL is based on ADA and Pascal programming languages. PL/SQL is tightly integrated with SQL.PL/SQL offers the following −Extensive error checking.Numerous data types.Variety of programming structures.PL/SQL supports the following −Structured programming through functions.Procedures and object-oriented programming.Development of web applications and server pages.PL/SQL block structureIt defines the type of block (procedure, function, anonymous) and the way it is called, it declares ... Read More

## Count odd and even digits in a number in PL/SQL

Updated on 09-Mar-2023 10:22:23
We are given a positive integer of digits and the task is to calculate the count of odd and even digits in a number using PL/SQL.PL/SQL is a combination of SQL along with the procedural features of programming languages. It was developed by Oracle Corporation in the early 90's to enhance the capabilities of SQL.PL/SQL is one of three key programming languages embedded in the Oracle Database, along with SQL itself and Java. Input int number = 23146579 Output count of odd digits in a number are : 5 count of even digits in a number are : 3Explanation − ... Read More

## Sum of the first and last digit of a number in PL/SQL

Updated on 06-Aug-2020 08:15:02
In this problem, we are given a number n. Our task is to create a program to find the sum of the first and last digit of a number in PL/SQL.First, let’s brush-up about PL/SQL, PL/SQL is a combination of SQL along with the procedural features of programming languages.Let’s take an example to understand the problem, Input − n = 31415Output − 8Explanation − first digit = 3 , last digit = 5. Sum = 8To, solve this problem, we will extract the first and last digit to number n. And the print their sum.The first and last digits are ... Read More

## Count no. of characters and words in a string in PL/SQL

Updated on 15-May-2020 10:21:54
We are given a string of any length and the task is to calculate the count of characters and words in a string using PL/SQL.PL/SQL is a combination of SQL along with the procedural features of programming languages.It was developed by Oracle Corporation in the early 90's to enhance the capabilities of SQL. PL/SQL is one of three key programming languages embedded in the Oracle Database, along with SQL itself and Java.In PL/SQL block, we have DECLARE block which is used to declare the variables used in programming and we have BEGIN block where we write the logic for the ... Read More

## Convert distance from km to meters and centimeters in PL/SQL

Updated on 15-May-2020 08:27:43
The task is to convert the distance from kilometers to meters and centimeters in PL/SQL.PL/SQL is the extension of SQL which combines the Data manipulation of SQL with the working of procedural language.According to the problem we should have distance in kilometers whose value we have to convert in meters and centimeters.As per the conversion rule −1km = 1000 meters1km = 100000 centimetersAccording to this conversion rule we want the distance to be converted by a logic in PL/SQL.ExampleInput: kilometer = 10 Output: meter = 10000    Centimeter = 1000000 Input: kilometer = 9 Output: meter = 9000    Centimeter ... Read More