How can I write variable in sub query
Afficher commentaires plus anciens
i try to write variable in sub query like this :
exec(conn,['select course_id from course where course_id not in' (['select course_id from transcript where student_id=' '''' aa2 '''']) ]);
not respond
Thank you.
Réponse acceptée
Plus de réponses (1)
the cyclist
le 16 Juin 2011
1 vote
Is aa2 a numeric variable, or a string? You might need to use the num2str() function.
I can't fully debug this right now, but in a case like this, I recommend building your string up piece by piece, outside the exec() function, to make sure the string you send as a query really looks like you expect it to. Looks to me that, for example, you do not really have the parentheses in there as part of the string, the way you want to for a subquery.
1 commentaire
sayer ali
le 16 Juin 2011
Catégories
En savoir plus sur Whos dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!