home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / database / oracle / 2270 < prev    next >
Encoding:
Text File  |  1992-11-22  |  2.4 KB  |  60 lines

  1. Newsgroups: comp.databases.oracle
  2. Path: sparky!uunet!mcsun!news.funet.fi!cs.joensuu.fi!omikko
  3. From: omikko@cs.joensuu.fi (Olli Mikkonen)
  4. Subject: Re: Long insert statement in PCC ireclen exceeded.
  5. Message-ID: <1992Nov23.082604.5467@cs.joensuu.fi>
  6. Organization: University of Joensuu
  7. References: <BxvLKB.4uC@inews.Intel.COM>
  8. Date: Mon, 23 Nov 1992 08:26:04 GMT
  9. Lines: 49
  10.  
  11. kortikar@mipos2.intel.com (Aniruddha Kortikar) writes:
  12.  
  13. >I have a long insert statement in PRO*C insert into table ( ....) values (...)
  14. >ireclen is exceeded.
  15. ireclen is the maximum length of source line.  The PCC option does not work.
  16. ireclen is always 80 characters.  If you have longer source lines,
  17. there will occur some kind of a input buffer overflow in PCC, and
  18. the results are quite unpredictable (core dump or erraneous code produced).
  19.  
  20. >I tried 
  21. >char stmt[1000];
  22. >sprintf(stmt,"insert into ... values (:v1,:v2);");
  23. >exec sql execute s using :val1,:val2 ....
  24. 1. Remove the semicolon from the end of the SQL-statement.
  25. 2. There is a bug in Oracle.  If you declare a host variable
  26.    as an array of char, Oracle can't always detect the end of the
  27.    string.  To get around the bug there are several alternatives:
  28. a) Add some spaces to the end of the string.
  29. b) Use VARCHAR as a type the host variable.
  30. c) Try something like this:
  31. char stmt[1000];
  32. EXEC SQL BEGIN DECLARE SECTION;
  33. char *sqlstatement;
  34. EXEC SQL END DECLARE SECTION;
  35. ...
  36. sprintf(stmt,"insert into ... values (:v1,:v2);");
  37. sqlstatement = stmt;
  38. EXEC SQL PREPARE S FROM :sqlstatement;
  39. exec sql execute s using :val1,:val2 ....
  40.  
  41. >but even then the exec sql execute s using is about 300 chars long.
  42.  
  43. >is there any way out other than using :a1,:a2 as variable names.
  44.  
  45. >Aniruddha Kortikar (kortikar@mipos2.intel.com)
  46. >-------------------------------------------------------------------------------
  47. >E-mail     : kortikar@mipos2.intel.com | A billion here, a billion there ...
  48. >Phone(W): 408 765 5515              | pretty soon it adds upto real money.
  49. >-------------------------------------------------------------------------------
  50.  
  51. The information above is based on my personal experiences with Oracle
  52. versions 6.0.3[1-4] and discussions with Oracle (Finland) tech support.
  53. People at Oracle may disagree.
  54.  
  55. Olli Mikkonen
  56. -- 
  57. Olli Mikkonen        : Any opinions above are purely my personal ones.
  58. Internet:         : Especially they do not reflect my employers
  59. omikko@cs.joensuu.fi    : official opinions.
  60.