home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / database / oracle / 2174 < prev    next >
Encoding:
Text File  |  1992-11-11  |  1.2 KB  |  37 lines

  1. Newsgroups: comp.databases.oracle
  2. Path: sparky!uunet!mcsun!ieunet!tcdcs!vax1.tcd.ie!nafallon
  3. From: nafallon@vax1.tcd.ie
  4. Subject: Dynamic SQL - PREPARE
  5. Message-ID: <1992Nov11.191651.1@vax1.tcd.ie>
  6. Lines: 24
  7. Sender: usenet@cs.tcd.ie (NN required at ashe.cs.tcd.ie)
  8. Nntp-Posting-Host: vax1.tcd.ie
  9. Organization: Trinity College Dublin
  10. Date: Wed, 11 Nov 1992 19:16:51 GMT
  11. Lines: 24
  12.  
  13. Hi, anybody like to help a struggling Oracler?.
  14. One of our tables has a column listing the other tables to be accessed. 
  15. I want to read a table name into a variable and then query that table for some
  16.  more data, therefore I have to use Dynamic SQL, but I cannot seem to get past
  17.  the PREPARE stage.
  18.  
  19. The statement: EXEC SQL PREPARE subcat_stmt FROM :select_stmt;
  20.  
  21. gives the error: ORA-00911: invalid character
  22.  
  23. select_stmt is created as follows..
  24.  
  25. EXEC SQL BEGIN DECLARE SECTION;
  26.         VARCHAR select_stmt[200];
  27. EXEC SQL END DECLARE SECTION;
  28.  
  29. sprintf(select_stmt.arr,"SELECT song FROM rush WHERE album = 'Presto'");
  30.  
  31. I have tried all sorts of combinations of VARCHARs and char's as well as using
  32.  variables for column names but the same error always results.
  33. Any pointers as to why this is happening would be greatly appreciated.
  34.  
  35. Niall Fallon
  36. fallon@mee.tcd.ie
  37.