home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume22 / oraperl / patch02 / Hints < prev    next >
Encoding:
Text File  |  1991-08-25  |  1.7 KB  |  57 lines

  1.  
  2. This file contains hints and tips about Oraperl, dealing with problems which
  3. have arisen in the past.
  4.  
  5.  
  6. Retrieving Dates
  7. ================
  8.  
  9. If you want to retrieve a field which is declared as an Oracle DATE, then you
  10. must explicitly format it using the SQL*Plus TO_CHAR function, for example:
  11.  
  12.     $csr = &ora_open($lda, "select to_char(sysdate, 'DD/MM/YY') from dual")
  13.  
  14. Otherwise, Oracle tells Oraperl that the field only occupies seven bytes,
  15. and a truncation error occurs when the field is fetched. This causes
  16. &ora_fetch() to return an error.
  17.  
  18. I hope to correct this in a future patch.
  19.  
  20.  
  21. Building on a Convex machine
  22. ============================
  23.  
  24. The  strtol()  function used at the start of most of the functions in orafns.c
  25. and in oracle.mus must be replaced by  strtoul() to allow larger addresses to
  26. be converted.
  27.  
  28. The  putenv()  function used in  set_sid()  must be replaced by  setenv() .
  29.  
  30.  
  31. Using Bind Variables
  32. ====================
  33.  
  34. The support for bind variables does not reflect the full potential of Pro*C.
  35.  
  36. Firstly, bind variables may only be numeric; named bind variables are not
  37. supported. They must run in sequence from 1. (This is to make it easy for
  38. &ora_bind() to check that it has received the correct number of parameters.)
  39.  
  40. Secondly, they may only be used to modify values within the SQL statement,
  41. not field or table names. Thus
  42.  
  43.     insert into telno values (:1, :2)
  44.  
  45. is valid, but
  46.  
  47.     select * from telno order by :1
  48.  
  49. is not. This made the interaction between &ora_open() and &ora_bind() simpler,
  50. but if it's a serious restriction for you let me know, and I'll look into
  51. extending it. (Of course, there's nothing to stop you doing:
  52.  
  53.     $order_by = "name";
  54.     &ora_open($lda, "select * from telno order by $order_by");
  55.  
  56. so I don't think it should be too big a problem.)
  57.