RE: Embedded SQL
Posted in 1995
CRAIG@CHEMISTRY.CHEM.UTAH.EDU — — source: Informix-list mailing list archive (1991-1998)
Have you checked out dynamic SQL? It seems to fit what you're looking for. For example, to achieve what you're trying to do, you could: sprintf(sql_stmt, "select %s from %s where 1=1", var_column, var_table); $prepare p_stmt from :sql_stmt; $declare c_stmt cursor for p_stmt; $open c_stmt; $fetch c_stmt into... I don't vouch for the syntax of the statements, but the idea is valid. --Craig (craig@chemistry.utah.edu) > > Is there a way to use variables in embedded sql commands in C/UNIX > environment? This is what I want to do > select :var_column_name from :var_table_name; > I know how to host variables but wanted to know if host variables > canbe used for the table and column names. >