home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / database / oracle / 2654 < prev    next >
Encoding:
Text File  |  1992-12-30  |  2.3 KB  |  59 lines

  1. Newsgroups: comp.databases.oracle
  2. Path: sparky!uunet!spool.mu.edu!uwm.edu!linac!att!mcdchg!laidbak!newsserver.pixel.kodak.com!kodak!tempus!deal
  3. From: deal@tempus.Kodak.Com (Stephen M. Deal)
  4. Subject: ? How do I declare a structure into which to fetch records?
  5. Message-ID: <1992Dec30.054617.3077@kodak.kodak.com>
  6. Keywords: Pro*C, Declare Section, :structure
  7. Sender: deal@tempus (Stephen M. Deal)
  8. Reply-To: deal@Kodak.COM
  9. Organization: Eastman Kodak Company
  10. Distribution: na
  11. Date: Wed, 30 Dec 92 05:46:17 GMT
  12. Lines: 45
  13.  
  14.  
  15. I don't have my manuals with me (I'm at home) and I am trying to get
  16. some embedded SQL C code (a.k.a. Pro*C) to precompile. I am not sure
  17. that the manuals would answer this one anyway so I have turned to the
  18. net for help.
  19.  
  20. I have declared a structure into which a record should be retrieved:
  21.  
  22.   EXEC SQL BEGIN DECLARE SECTION;
  23.   struct emprec_ {
  24.     char name[35];
  25.     char dept_name[41];
  26.     char phone[16];
  27.   } query_results;        /* Results of query placed here */
  28.   EXEC SQL END DECLARE SECTION;
  29.  
  30. but the precompiler errors on the fetch statement as follows:
  31.  
  32.   Precompiling proc_3.pc
  33.    215           EXEC SQL FETCH emp_csr INTO :query_results;
  34.    215 ....................................................^
  35.        PCC-S-0026:  Undeclared host variable "query_results" at line 215
  36. in file proc_3.pc
  37.   *** Error code 1
  38.  
  39. It is pretty clear what is wrong. But how do I fix it? I know that char
  40. datatypes are declared as VARCHAR, yet int are declared as int. Is there
  41. a keywork for declaring embedded SQL structures?
  42.  
  43. Even a snippet of code that shows the proper syntax for the declaration
  44. would be helpful. I just need the precompiler to recognize that the
  45. structure has been declared.
  46.  
  47. Thanks in advance,
  48.   ======================================================================
  49.   | Steve Deal         | Internet: deal@Kodak.COM               |
  50.   | Eastman Kodak Co.    | UUCP:     ...rutgers!rit!kodak!tempus!deal   |
  51.   | Engr. Systems Div.    | Voice:    (716) 726 - 5396               |
  52.   | mailcode: 35108    | FAX:        (716) 726 - 7406                   |
  53.   | 901 Elmgrove Road    |                            |
  54.   | Rochester, NY    |                            |
  55.   |        14653-5108   |                           |
  56.   ======================================================================
  57.     Disclaimer:    "Everyone is entitled to an opinion, 
  58.          the above is mine and not that of my employer."
  59.