Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Update
Hi,
I have a table called 'test' like this :
Nom Null ? Type ----------------------------------------------------- --------
START_DATE DATE END_DATE DATE
I have a Pro*C/C++ function :
Query :: Update ( bool type, char* tableName, char* dateEnd )
{
// Déclarations SQL
EXEC SQL BEGIN DECLARE SECTION;
char sqlstmt[255];
char _tableName[80];
char _dateEnd[80];
EXEC SQL END DECLARE SECTION;
strcpy ( _tableName, tableName );
strcpy ( _dateEnd, dateEnd );
// Construction de la requête SQL
// Valide SqlError comme évènement d'erreur
EXEC SQL WHENEVER SQLERROR DO DynSqlError("Query error:");
EXEC SQL WHENEVER NOTFOUND DO Test();
// Construction de la requête
sprintf ( sqlstmt, "update %s set end_date=TO_DATE(':first',
'DD/MM/YYYY HH24:MI:SS') where table_name=':second'", TableName ); //
Name of table I want to update : TableName
printf ( "\n%s\n", sqlstmt ); printf ( "\nv1:%s", (char*)_dateEnd ); printf ( "\nv2:%s\n", _tableName );
EXEC SQL PREPARE T FROM :sqlstmt;
EXEC SQL EXECUTE T USING :_dateEnd, :_tableName;
EXEC SQL COMMIT;
}
In the table 'test' I have :
SOURCE_NAME TABLE_NAME START_DATE END_DATE
table1 table2 11/04/00
I called this function with :
query->Update ( false, "table1", "11/04/2000 16:03:00" ). The name of
the table is in the object Query and the Attribute is TableName.
Why this doesn't work ???? I have : "no result found" ....
Please help me, I have no more idea ...
![]() |
![]() |