AnsweredAssumed Answered

SQL Query Syntax

Question asked by RGoyette on Aug 10, 2010

Title

SQL Query Syntax

Post

I want to build a SQL query that will import records, but only those that have an instrument ID matching the one selected in my local database.  I have a variable defined:

$INSTR_ID = Select Beamline::INST_ID  that reflects the instrument id I have selected in the local database, and the one I want to match in the ORACLE database.

I thought that the following syntax would work.

"SELECT * FROM prpsl.PRPSL_BY_INSTR_V
WHERE "&$INSTR_ID&" IN (SELECT INSTR_ID FROM prpsl.PRPSL_BY_INSTR_V)"

where prpsl.PRPSL_BY_INSTR_V is the view on the ORACLE database and INSTR_ID is the field in that view that I want to match.

But the problem is it does not work.  Can anyone give me a clue as to what I am doing wrong?

Outcomes