Re: How to print something in PL/SQL
Date: 8 Sep 92 16:33:11 GMT
Message-ID: <2676_at_uswnvg.uswnvg.com>
: Oracle, in their infinite wisdom, has deemed it appropriate that PL/SQL
: have no native print utilities. A rather hideous means of "printing"
: is to write results to a table and then print them out with a select
: statement following the PL/SQL script. But this is horrible (and costly
: in terms of extra database access) alternative to a print statement.
:
It was correctly pointed out by various people that PL/SQL has no print statements because it is implemented in the DB kernel.
So, I apologize for getting on the soapbox, but, I still think that something could be done. Sybase has already implemented stored procedures as part of there kernel and also includes a message and error facility with the following specifications:
Sybase PRINT command
example:
if exist (select * from table) where something = something print "something"
This allows you to send up to a 255 character message. The application message handler then can determine what to do with the message.
The other form of generating a message is the Raiserror.
This form has the syntax:
Raiserror #### 'message'
It works the same as print, but it also sets the _at__at_ERROR variable to ####. The message can be accessed by the application programs message handler.
These commands can be placed directly in stored procedures which can be accessed by various applications which can either do something with the message or ignore the message.
Although this is not the worlds greatest feature, at least it allows the user to do messaging from within the procedural language. I think that the key thing here is that the application message handler determines what to do with the message.
Mark McGregor -- mmcgreg_at_uswnvg.com Received on Tue Sep 08 1992 - 18:33:11 CEST