Kbase P122675: SQL-92: Sample JAVA Stored Procedure to INSERT a row containing a TIMESTAMP column.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  3/7/2007 |
|
Status: Unverified
GOAL:
SQL-92: Sample JAVA Stored Procedure to INSERT a row containing a TIMESTAMP column.
GOAL:
How to assign a Progress 4GL DATETIME field using SQL-92 TIMESTAMP data type?
GOAL:
How to insert a row into a Progress database table that includes a DATETIME field?
GOAL:
How to assign a Progress database DATETIME field using a java Stored Procedure?
FACT(s) (Environment):
OpenEdge 10.1x
FIX:
The following JAVA stored procedure inserts a row into a Progress OpenEdge 4GL database table that includes a DATETIME field. Notice that the SQL92 TIMESTAMP data type is used to assign this field because the 4GL DATETIME data type maps directly to the SQL92 TIMESTAMP data type:
DROP PROCEDURE InsertRow;
CREATE PROCEDURE InsertRow()
BEGIN
java.util.Date today = new java.util.Date();
java.sql.Timestamp v_TimeStamp = new java.sql.Timestamp(today.getTime());
SQLIStatement createStatement = new SQLIStatement ("INSERT INTO PUB.TableName(DatetimeFieldName) VALUES (?)");
createStatement.setParam (1, v_Timestamp);
createStatement.execute();
END;
COMMIT WORK;