Dynamic Queries: passing values as column list, and inser values
Hi,
i am using mysql 5 as a backend to a ColdFusion 10 app.
What I am trying to do is pass variables into an insert statement.
like so:
INSTERT INTO #tableName#(#columnNames#)
VALUES(#colValues#)
In the above code #tablName# is coldfusion syntax for a variable.
When I dump the variables the values are correct
#colName# holds a list of column names like this (col1,col2,Col3)
#colValues# hold a list of variables that will be used by a query looping over this one supplying the actual values. Like this(#col1#,'#col2#', #col3#)
What is happening is that I am getting a mysql error that is a generic parsing error. it's indicating that the error is in last line of the query,
On the Coldfusion side,all variable names are correct and the correct case, They are scoped correctly where #col1# represents a numeric value and '#col2#' represents a text value.
So if anyone has any ideas, they would be greatly appreciated.
thanks
jbird
In researching this I have not found anything relating to passing variables like this nor building a dynamic query like this.
Subject
Written By
Posted
Dynamic Queries: passing values as column list, and inser values
January 20, 2013 07:46AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.