Declare NOT FOUND Handler in MySQL Cursor

varun
Updated on 22-Jun-2020 07:30:18

2K+ Views

We must have to declare NOT FOUND handler while working with MySQL cursor because it handles the situation when cursor could not find any row. It also handles the situation when the cursor reaches the end of the row because every time we call FETCH statement the cursor finds to attempt the next row in the result set. Following is the syntax to declare NOT FOUND handler −DECLARE CONTINUE HANDLER FOR NOT FOUND SET var_name = value;Here var_name is the name of any variable and value would be the value of that variable. For example, we can declare it as ... Read More

Retrieve Output with Decimal Values in Specified Format

Arjun Thakur
Updated on 22-Jun-2020 07:29:37

582 Views

MySQL FORMAT() function, converts a number to a format like #, ###, ###.### which is rounded up to the number of decimal places specified and returns the result as a string, can be used to retrieve the output having decimal values of a column in a specified format. To understand it, we are taking an example of table ‘estimated_cost’ which have the following data −mysql> Select * from estimated_cost; +----+-----------------+-----------+---------------+ | Id | Name_Company    | Tender_id | Tender_value  | +----+-----------------+-----------+---------------+ | 1  | ABC Ltd.        | 110       | 256.3256879   | | 2 ... Read More

System.Console Class and Its Methods in C#

karthikeya Boyini
Updated on 22-Jun-2020 07:29:16

923 Views

The System.Console class in C# represents the standard input, output, and error streams for console applications.The following are some of the methods of the System.Console class −Refer: MSDN System Class methodsSr.NoMethod & Description1Beep()Plays the sound of a beep through the console speaker.2Beep(Int32, Int32)Plays the sound of a beep of a specified frequency and duration through the console speaker.3Clear()Clears the console buffer and corresponding console window of display information.4MoveBufferArea(Int32, Int32, Int32, Int32, Int32, Int32)Copies a specified source area of the screen buffer to a specified destination area.5MoveBufferArea(Int32, Int32, Int32, Int32, Int32, Int32, Char, ConsoleColor, ConsoleColor)Copies a specified source area of the ... Read More

Role of CSS nth-last-child(n) Selector

Giri Raju
Updated on 22-Jun-2020 07:29:12

260 Views

Use the CSS :nth-last-child(n) selector to style every element that is the child of its parent, counting from the last child.You can try to run the following code to implement the :nth-last-child(n) selector −ExampleLive Demo                    p:nth-last-child(4) {             background: blue;             color: white;          }                     This is demo text 1.       This is demo text 2.       This is demo text 3.       This is demo text 4.       This is demo text 5.       This is demo text 6.     Output

Difference Between Write and WriteLine Methods in C#

Samual Sam
Updated on 22-Jun-2020 07:28:54

6K+ Views

The difference between Write() and WriteLine() method is based on new line character.Write() method displays the output but do not provide a new line character.WriteLine() method displays the output and also provides a new line character it the end of the string, This would set a new line for the next output.Let us see an example to learn about the difference between Write() and WriteLine() method −Example Live Demousing System; class Program {    static void Main() {       Console.Write("One");       Console.Write("Two");       // this will set a new line for the next output ... Read More

Evaluate MySQL Expression with NULLIF Function

Akshaya Akki
Updated on 22-Jun-2020 07:28:19

155 Views

As we know that MySQL NULLIF() control flow function will return the first argument both the arguments are not the same. The first argument is returned because MySQL evaluates the first argument twice if both of the arguments are not the same.Examplemysql> Select NULLIF('Tutorialspoint','MySQL'); +----------------------------------+ | NULLIF('Tutorialspoint','MySQL') | +----------------------------------+ | Tutorialspoint                   | +----------------------------------+ 1 row in set (0.00 sec)In the above example, as the arguments are not the same hence MySQL evaluates the first argument i.e.’Tutorialspoint’ two times and return it as output.

Actions Inside Stored Procedures and Functions Replication

Nancy Den
Updated on 22-Jun-2020 07:27:48

212 Views

Actually standard actions carried out in stored procedures and functions are replicated from a master MySQL server to a slave MySQL server. Even the creation of stored procedures and functions carried out through normal DDL statements on a master MySQL server are replicated to a slave MySQL server. In this way, objects will exist on both the servers.The actions that take place inside the stored procedure and functions are replicated because MySQL records each DDL event that occurs inside stored procedures and functions. After recording the events it is replicated to the slave MySQL server. But the actual calls made ... Read More

Random Numbers in Chash

karthikeya Boyini
Updated on 22-Jun-2020 07:27:06

22K+ Views

To generate random numbers in C#, use the Next(minValue, MaxValue) method. The parameters are used to set the minimum and maximum values.Next(100,200);We have set the above method under Random() object.Random rd = new Random(); int rand_num = rd.Next(100,200);The following is an example −Example Live Demousing System; class Program {    static void Main() {       Random rd = new Random();       int rand_num = rd.Next(100,200);       Console.WriteLine(rand_num);    } }Output182

Rollback Transactions Inside a MySQL Stored Procedure

mkotla
Updated on 22-Jun-2020 07:26:52

2K+ Views

As we know that ROLLBACK will revert any changes made to the database after the transaction has been started. To perform the ROLLBACK in MySQL stored procedure we must have to declare EXIT handler. We can use a handler for either sqlexception or SQL warnings. It can be understood with the help of an example in which stored procedure having ROLLBACK created for the table having the following details −mysql> SHOW CREATE table gg\G *************************** 1. row ***************************        Table: gg Create Table: CREATE TABLE `gg` (    `Id` int(11) NOT NULL AUTO_INCREMENT,    `Name` varchar(30) NOT NULL,    PRIMARY KEY ... Read More

Remove Leading Zeros from a String in C#

Ankith Reddy
Updated on 22-Jun-2020 07:26:30

14K+ Views

Let’s say the following is our string with leading zeros.String str ="000234";Use the TrimStart() method and set the 0 to remove it.TrimStart(new Char[] { '0' } )The following is the complete code to remove leading zeros.Example Live Demousing System; class Program {    static void Main() {       String str ="000234".TrimStart(new Char[] { '0' } );       Console.WriteLine(str);    } }Output234

Advertisements