Showing entries 1 to 6
Displaying posts with tag: Case (reset)
Using conditional expressions inside MySQL Stored Procedure

Sometimes there is need to use conditional expression inside stored procedure to control the flow of execution.
We can use IF or CASE statements for this.


Below is a stored procedure to check the performance of a student based on its score.
Store the below stored procedure in a file called get_performance.sql

DELIMITER $$

DROP PROCEDURE IF EXISTS get_performance$$

CREATE PROCEDURE get_performance
    (score NUMERIC(8, 2),
    OUT result VARCHAR(11))

BEGIN
    IF (score >= 90) THEN
        SET result = 'OUTSTANDING';
    ELSEIF (score >= 70 …

[Read more]
After 10 Years, MySQL Still the Right Choice for ScienceLogic's "Best Network Monitoring System on the Planet"

ScienceLogic has a pretty fantastic network monitoring appliance.  So good in fact that InfoWorld gave it their "2013 Best Network Monitoring System on the Planet" award.  Inside their "ultraflexible, ultrascalable, carrier-grade" enterprise appliance, ScienceLogic relies on MySQL and has since their start in 2003.  Check out some of the things they've been able to do with MySQL and their reasons for continuing to use MySQL in these highlights from our new MySQL ScienceLogic case study.

  • Science Logic's larger customers use their appliance to monitor and manage  20,000+ devices, each of which generates a steady stream of data and a workload that is 85% write. On …
[Read more]
Case Study: Waiting Room Solutions Relies on MySQL for Web-Based Medical Management Systems

Waiting Room Solutions (WRS) is an award-winning web-based Electronic Medical Records (EMR) and Practice Management System for physicians’ offices. Based in Goshen, NY, WRS serves almost 3,000 users for their needs in charting, medical record filing, payment tracking, prescription and reporting via the SaaS (Software as a Service) model, and WRS has sent over 20,000 electronic prescriptions a month over its secure network.

The Business Challenge

WRS was looking for a robust database for enterprise-class web-based applications with the following features:

1. Security

Medical records and health information are highly confidential, and WRS expected to be fully incompliance with privacy regulations such as the HIPAA Privacy Rule.

2. Data Integrity

It is important to minimize data corruption and inconsistency for medical records, because they directly impact …

[Read more]
Building The Perfect HTPC (Media PC), Capable Of Playing 1080P H264

The Idea.

For the past month I have been exploring options and building a perfect Home Theater PC for my 50” Vizio plasma. Besides the obvious, it has to play movies, youtube videos, etc, I had a few concrete goals in mind. Here they are:

  • it absolutely had to handle 1080P h264, specifically movies encoded using x264. An average movie size for this format is between 8.5 and 13 GB. There were 2 problems to overcome: the CPU had to be able to handle the decoding (my desktop dual core Conroe barely kept up) and the network had to be fast enough to stream in real time from my storage PC a floor away.
  • I needed to have the easiest control over the whole thing. VNC wasn’t good enough, because I don’t always have a laptop lying around.
  • It had to support 7.1 sound.
  • It had to have excellent picture quality on the TV, preferably during both movies and regular browsing/reading, etc. HDMI/DVI was …
[Read more]
MySQL Stored Procedures: CASE syntax

Thank you all for taking the time to respond to the little challenge I posted yesterday! I am pleasantly surprised to note that so many people took the time to post a solution. And most people provided the correct answer too: you are all entitled to a well deserved discount to register for the MySQL User's conference!!!

For those of you interested in the solution: there are two different forms of the CASE statement syntax: the so-called simple case and the searched case.

The simple case selects one WHEN...THEN branch by comparing the value of the expression that appears after the CASE

[Read more]
MySQL stored procedurs: ...the CASE that they gave me...

Let's see if you can solve this little puzzle...

Consider this stored procedure:


-- finds the first slash and exits
create procedure p_find_slash(p_text text)
begin
declare v_index int default 1;
declare v_length int default character_length(p_text);
declare v_char char(1);

_main_loop: while v_index <= v_length do -- loop over all characters

set v_char := substring(p_text, v_index, 1); -- grab the current character
case v_char
when v_char = '/' then -- found a slash!
select concat('A slash at ', v_index) message; -- report it
leave _main_loop; -- and then stop
else
[Read more]
Showing entries 1 to 6