Hi All,
I am facing problem in executing one dynamic query in PRO *C program
on linux. I want to update table
mytable by data MADURAI for a column mycolumn1 where primary key is
myPK.I want to use
EXECUTE IMMEDIATE with context.But it is not working.
Following is my piece of code. Please help. Thanks in advance.

int main()
{
EXEC SQL BEGIN DECLARE SECTION;
sql_context cntxt;
VARCHAR hDbName[32];
VARCHAR query[2000];
EXEC SQL END DECLARE SECTION;

EXEC SQL CONTEXT ALLOCATE :cntxt;

//Connected with database in another function passing context
as one argument. By using :-

connect_fun(cntxt,user,paswd);

strcpy((char *)query.arr,"UPDATE mytable SET
mycolumn1='MADURAI' WHERE myPK='11' ");
query.len=strlen("UPDATE mytable SET mycolumn1='MADURAI' WHERE
myPK='11' ");


EXEC SQL CONTEXT USE:cntxt;

//EXEC SQL AT :hDbName EXECUTE IMMEDIATE :query;
If I use this statement than ORA error is "statement handle not
prepared".

//EXEC SQL EXECUTE IMMEDIATE :query;
If I use this statement than ORA(1012) error is "not logged
on".

EXEC SQL AT :hDbName COMMIT;

return 0;

}


int connect_fun(sql_context cntxt,char *user, char *paswd)
{

EXEC SQL CONTEXT USE:cntxt;

EXEC SQL CONNECT :user IDENTIFIED BY aswd AT :hdbname USING
:hdbname;

return 0;
}