Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I simulate a print statement in MySQL?

Tags:

mysql

I have some procedures where I would like to get some kind of acknowledgement after a condition has been assessed.

For example, the pusedocode would be like,

if ( select count(*) from assgn to where eid = 1 )  > 5   print " the total number of projects employee working is more than 5 " else   insert the value into the assgnto table   

How should I go about doing that in MySQL?

like image 523
Rahul Avatar asked Aug 02 '11 12:08

Rahul


2 Answers

If you do not want to the text twice as column heading as well as value, use the following stmt!

 SELECT 'some text' as '';  

Example:

mysql>SELECT 'some text' as ''; +-----------+ | | +-----------+ | some text | +-----------+ 1 row in set (0.00 sec)

like image 144
mvsagar Avatar answered Oct 03 '22 08:10

mvsagar


You can print some text by using SELECT command like that:

SELECT 'some text' 

Result:

+-----------+ | some text | +-----------+ | some text | +-----------+ 1 row in set (0.02 sec) 
like image 37
dan.dev.01 Avatar answered Oct 03 '22 08:10

dan.dev.01