parameterized query problems... 
Author Message
 parameterized query problems...

Hello All....

I'm attempting to issue a few parameterized queries, where the SQL
statements are generated at run time...  Is this even possible?  I'm
receiving some erros that I cannot seem to resolve.  I am using delphi
version 1.0, connected to Oracle 7.2 tables...  I know that I'm
connecting ok to Oracle, because I'm being prompted for the login
name and password for the Oracle tables.

Here's the error messages that are generated.....

  The first error message tha't returned is:

        "General SQL Error. ORA-01745: invalid host/bind variable name".

  The second error that is returned is:

        "Field 'part_no' is of unknown type."

    And they just continue from there, with every one of the
    parameterized variables...
Here's the offending snippet of code.....

  size_desc  : String;

{can you even use the "SELECT xx INTO :xxx" syntax??}
Query1.SQL.Add('SELECT p.part_no, p.user_part_no, p.upc_no');
Query1.SQL.Add('INTO :part_no, user_part_no, :upc_no');
Query1.SQL.Add('FROM part AS p WHERE p.user_part_no = :partno');
Query1.ParamByName('partno').AsString := edtFindPart.Text;

part_no          := Query1.ParamByName('part_no').AsString;
user_part_no := Query1.ParamByName('user_part_no').AsString;
upc_no          := Query1.ParamByName('upc_no').AsString;

Query1.SQL.Add('INSERT INTO qrs_table'');
Query1.SQL.Add('(sel_cd, upc_no, user_part_no, nrf_size_cd, '+
                 'nrf_color_cd, part_desc, color_desc, '+
Query1.SQL.Add('VALUES(:sel_cd, :upc_no, :user_part_no, :nrf_size, '+
                            ':nrf_color, :part_desc, :color_desc, '+
Query1.ParamByName('sel_cd').AsString           := sel_cd;
Query1.ParamByName('upc_no').AsString           := upc_no;
Query1.ParamByName('user_part_no').AsString := user_part_no;
Query1.ParamByName('nrf_size').AsString          := nrf_size;
Query1.ParamByName('nrf_color').AsString        := nrf_color;
Query1.ParamByName('part_desc').AsString      := part_desc;
Query1.ParamByName('color_desc').AsString    := color_desc;
Query1.ParamByName('size_desc').AsString      := size_desc;


This one's got me baffled...  

Is it that you cannot use the "SELECT <fields> INTO <vars>" syntax?
or am I missing something?

I get the same errors on the "INSERT" statement which leads me to
believe that I'm missing something...

Can anyone help me with this one?


David Sim
Revman Industries, Inc.

Tue, 23 Feb 1999 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. parameterized query problems...

2. Problem with parameterized SQL query in Delphi 2.0

3. Problems with parameterized queries in windows 95

4. Problems with parameterized queries in win95

5. Spurious RecordCount for certain parameterized queries

6. parameterized nested query

7. How to handle apostrophes inside SQL parameterized queries

8. Parameterized queries and "\" (backslash)

9. Using TUpdateSQL with parameterized queries

10. Parameterized Queries

11. Null values in parameterized queries

12. Cannot get parameterized queries to work for ORACLE


Powered by phpBB® Forum Software