home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / database / oracle / 1527 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  2.1 KB

  1. Path: sparky!uunet!uswnvg!nv6.uswnvg.com!mmcgreg
  2. From: mmcgreg@uswnvg.com (Mark McGregor)
  3. Newsgroups: comp.databases.oracle
  4. Subject: Re: How to print something in PL/SQL
  5. Message-ID: <2676@uswnvg.uswnvg.com>
  6. Date: 8 Sep 92 16:33:11 GMT
  7. References: <2662@uswnvg.uswnvg.com>
  8. Sender: news@uswnvg.uswnvg.com
  9. Organization: U S WEST NewVector Group, Inc.
  10. Lines: 47
  11. X-Newsreader: Tin 1.1 PL5
  12.  
  13. : Oracle, in their infinite wisdom, has deemed it appropriate that PL/SQL
  14. : have no native print utilities.  A rather hideous means of "printing"
  15. : is to write results to a table and then print them out with a select
  16. : statement following the PL/SQL script.  But this is horrible (and costly
  17. : in terms of extra database access) alternative to a print statement.
  18.  
  19. It was correctly pointed out by various people that PL/SQL has no print
  20. statements because it is implemented in the DB kernel.
  21.  
  22. So, I apologize for getting on the soapbox, but, I still think that
  23. something could be done.  Sybase has already implemented stored procedures
  24. as part of there kernel and also includes a message and error facility
  25. with the following specifications:
  26.  
  27.     Sybase PRINT command
  28.  
  29.     example:
  30.  
  31.     if exist (select * from table) where something = something
  32.     print "something"
  33.  
  34.     This allows you to send up to a 255 character message.  The application
  35.     message handler then can determine what to do with the message.
  36.  
  37.     The other form of generating a message is the Raiserror.
  38.  
  39.     This form has the syntax:
  40.  
  41.           Raiserror #### 'message'
  42.  
  43.     It works the same as print, but it also sets the @@ERROR variable to
  44.     ####.  The message can be accessed by the application programs message
  45.     handler.
  46.  
  47.     These commands can be placed directly in stored procedures which can
  48.     be accessed by various applications which can either do something
  49.     with the message or ignore the message.
  50.  
  51.  
  52. Although this is not the worlds greatest feature, at least it allows the
  53. user to do messaging from within the procedural language.  I think that the
  54. key thing here is that the application message handler determines what to
  55. do with the message.
  56.  
  57. Mark McGregor -- mmcgreg@uswnvg.com
  58.  
  59.