home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / postgres / postgre1.z / postgre1 / video / script-31 < prev    next >
Encoding:
Text File  |  1992-08-27  |  697 b   |  26 lines

  1. /* 
  2.  *  postquel functions can also take multiple arguments.  Arguments may
  3.  *  be either base types or complex types (classes).
  4.  */
  5.  
  6. /*
  7.  *  this function raisers the salary of an employee and returns 'true'.
  8.  *  by convention, the return value of a postquel procedure is the
  9.  *  value produced by the last query in the procedure -- in this case,
  10.  *  the 'retrieve'.
  11.  */
  12.  
  13.     define function raise_sal (language = "postquel", returntype = bool)
  14.     arg is (char16, int4)
  15.     as "replace e (salary = e.salary + $2) from e in emp
  16.         where e.name = $1
  17.     retrieve (x = \\"t\\"::bool)"
  18.  
  19. \p
  20. \g
  21.  
  22. /* give mike a raise -- have to typecast the char16 arg */
  23. retrieve (x = raise_sal("sam"::char16, 100))
  24. \p
  25. \g
  26.