Sometimes you have long alert messages to display to the user. For instance if you want to explain a complicated error or warning. A lot of text can be placed into the alert, but this can look pretty bad because it word-wraps every 40 characters or so. This tip will detail how you can control the amout of text on each line, and format the alert text a little better. Consider the situation where you want to display an alert with some variables and give the user options for remedying the problem. You might want the alert text to look something like the following:

This harvest is associated with Timber Sale: RED RIVER - ID: 10 Cannot Delete until one of the following is done: 1) Delete this FMU from the sale 2) Associate this FMU with a different harvest If this text is just placed in the alert you will see just several lines all concatonated together with tab marks.
So how do I fix it? Use CHR(10)! One solution to this formatting problem is to use imbedded carriage returns to control where the lines wrap in the alert. This can be done by using 'CHR(10)' which will return the ascii 10 value, which is carriage return. This value can be concatenated with the various lines to cause the alert line to wrap where desired. The following procedure is an example of using this technique: PROCEDURE wrapped_ts_alert(p_TS_NM IN VARCHAR2, p_TS_ID IN NUMBER) IS -- A variable to hold the alert's 'handle' -- it is set to use an alert that exists in the form. id_Alert Alert := Find_Alert('ALERT1'); -- Variable to hold return from alert v_Button NUMBER; -- This Constant holds the ascii value of the carriage return. -- the CHR(10) is placed into a constant to avoid calling CHR multiple times. v_CR CONSTANT CHAR(1) := CHR(10); -- Carriage Return -- Holding variable for alert message v_Msg VARCHAR2(255); BEGIN -- First make sure that the alert exists in the form. IF ID_Null(id_Alert) THEN MESSAGE('Cannot find alert: ALERT1'); ELSE -- Put together the message, using v_CR for carriage returns v_Msg := 'This harvest is associated with:'||v_CR||v_CR ||' Timber Sale: ' ||p_TS_Nm ||' - ID: ' ||to_char(p_TS_ID)||v_CR||v_CR ||'Cannot Delete until one of the following is done:'||v_CR||v_CR ||' 1) Delete this FMU from the sale'||v_CR ||' 2) Associate FMU with a different harvest.'; -- Set the alert message and display the alert SET_ALERT_PROPERTY(id_Alert,ALERT_MESSAGE_TEXT,v_Msg); v_Button := SHOW_ALERT(id_Alert); END IF; END; If this procedure is called it will display an alert that is easy on the eye Which is a much clearer layout. Limitations. You can have as many lines as can fit on the screen, but there is an overall limit of 200 characters, with each CHR(10) also counting as a character.