Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Update

Update

From: AM <a.metzger_at_nmg.fr>
Date: 2000/04/18
Message-ID: <38FC09F6.295B83D3@nmg.fr>#1/1

Hi,

I have a table called 'test' like this :

 Nom                                                   Null ?   Type
 ----------------------------------------------------- --------


 SOURCE_NAME
VARCHAR2(80)
 TABLE_NAME
VARCHAR2(80)
 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 ...

Received on Tue Apr 18 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US