Parametrized SQL queries for PostgreSQL?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, I use Database Toolbox to fetch data from a Postgres database.
Is it possible to parametrize SQL query when using fetch?
conn = postgresql(...);
col4 = "foobar";
query = ...
"SELECT s.col1, s.col2, s.col3 " + ...
"FROM mystuff s " + ...
"WHERE s.col4 = '" + col4 + "'";
fetch_opts = databaseImportOptions(conn, query);
results = fetch(conn, query, fetch_opts);
close(conn);
clear conn query fetch_opts;
Is there a way to declare the col4 as a query parameter istead of concatenating the value into query string?
0 Kommentare
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!