Text FormattingDisplay normal text within listings environment (SQL)

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
dajense
Posts: 4
Joined: Thu Sep 03, 2009 3:43 pm

Display normal text within listings environment (SQL)

Post by dajense »

Hi,

I am using the listings environment to display some SQL statements. Some of these contain signal statements which print out messages. The problem is, that the message output is diplayed like_this_for_all_messages... So I need a way to display normal text within the listings enviornment. Any ideas?

Code: Select all

\begin{lstlisting}[frame=tb, language = SQL, title={Trigger on update of QUESTIONNAIRE}]
CREATE TRIGGER QUESTIONNAIRE_STATE_UPDATE
AFTER UPDATE OF WORKFLOW_STATE ON QUESTIONNAIRE
REFERENCING NEW AS N OLD AS O
FOR EACH ROW 
BEGIN ATOMIC

DECLARE CHECK_QUESTIONNAIRE_ID INTEGER;

SET CHECK_QUESTIONNAIRE_ID = N.QUESTIONNAIRE_ID;

IF (EXISTS(SELECT STATE FROM RULE_VIOLATION, QUESTIONNAIRE
WHERE RULE_VIOLATION.QUESTIONNAIRE_ID = CHECK_QUESTIONNAIRE_ID AND STATE = 1 OR STATE = 3
AND N.WORKFLOW_STATE > 0))
THEN SIGNAL SQLSTATE '90000' 
 SET MESSAGE_TEXT ='Questionnaire contains rule violations in data entries. Please revise questionnaire.';
END IF;

END @
\end{lstlisting}
Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

Post Reply