Dear Sirs,
I'm using NetExpress 3.11 by going to Firebird.
I would like to know if there is a possibility of using a variable in the where clause.
Regards,
Rogerio Barbosa
Dear Sirs,
I'm using NetExpress 3.11 by going to Firebird.
I would like to know if there is a possibility of using a variable in the where clause.
Regards,
Rogerio Barbosa
Dear Sirs,
I'm using NetExpress 3.11 by going to Firebird.
I would like to know if there is a possibility of using a variable in the where clause.
Regards,
Rogerio BarbosaYou can use a host variable in the WHERE clause as a value such as:
EXEC SQL
SELECT last_name
INTO :lname
FROM staff
WHERE staff_id=:staff-id
END-EXEC
If you wish to substitute the entire WHERE clause with a variable including the column name then you will have to use dynamic SQL when you prepare a statement and then execute it.
Please see docs here:
Dear Sirs,
I'm using NetExpress 3.11 by going to Firebird.
I would like to know if there is a possibility of using a variable in the where clause.
Regards,
Rogerio BarbosaDear Sirs,
I'm using NetExpress 3.11 by going to Firebird.
I would like to know if there is a possibility of using a variable in the where clause.
Regards,
Rogerio BarbosaDear Sirs,
I'm using NetExpress 3.11 by going to Firebird.
I would like to know if there is a possibility of using a variable in the where clause.
Regards,
Rogerio BarbosaDear Sirs,
I'm using NetExpress 3.11 by going to Firebird.
I would like to know if there is a possibility of using a variable in the where clause.
Regards,
Rogerio BarbosaIf you are returning data using a SELECT then the dynamic statement needs to be executed as a cursor instead of a singleton select.
This is documented here:
Example:
exec sql
DECLARE C1 CURSOR FOR dynamic_sql
end-exec
string "SELECT "
"A.CustomerID, A.CompanyName, A.ContactName "
"FROM dbo.Customers A WHERE (A.CustomerID = ?)"
into sql-text
exec sql prepare dynamic_sql from :sql-text end-exec
move "BLAUS" to Customers-CustomerID
exec sql
OPEN C1 USING :Customers-CustomerID
end-exec
exec sql fetch C1 into
:Customers-CustomerID
,:Customers-CompanyName
,:Customers-ContactName:Customers-ContactName-NULL
end-exec
Dear Sirs,
I'm using NetExpress 3.11 by going to Firebird.
I would like to know if there is a possibility of using a variable in the where clause.
Regards,
Rogerio BarbosaAlready have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.