DateTime database parameter
Description
When you update data in the DataWindow painter, PowerBuilder builds
a SQL UPDATE statement
in the background. The DateTime parameter determines how PowerBuilder specifies
a DateTime datatype when it builds the SQL UPDATE statement.
(A DateTime datatype contains both a date value and a time value.)
Controls
-
JDB JDBC
-
ODBC
-
O90 Oracle9i
-
O10 Oracle 10g
-
ORA Oracle 11g
Syntax
The syntax you use to specify the DateTime differs slightly
depending on the database.
The Database Profile Setup dialog box inserts special characters
(quotes and backslashes) where needed, so you can specify just the
DateTime format.
In code, you must use the following syntax:
[JDBC and ODBC syntax]
PowerBuilder parses the backslash followed by two single quotes
(”’) as a single quote when it builds
the SQL UPDATE statement.
1 |
DateTime=' '''<span>DateTime_format</span>''' ' |
[Oracle syntax]
PowerBuilder parses each set of four consecutive single quotes
(””) as a single quote when
it builds the SQL UPDATE statement.
1 |
DateTime=' ''''<span>DateTime_format</span>'''' ' |
Parameter |
Description |
---|---|
‘ ”’ ‘ ”” |
JDBC and ODBC syntax Type a single quote, followed by one space, followed by a Oracle syntax Type a single quote, followed by one space, followed by four |
DateTime_format |
The DateTime format you want PowerBuilder to For more on display formats, see the Users |
”’ ‘ ”” ‘ |
JDBC and ODBC syntax Type a backslash, followed by two single quotes, followed Oracle syntax Type four single quotes, followed by one space, followed by |
Default
The default value for DateTime depends on the DBMS you are
accessing, as summarized in the following table:
DBMS |
Date default value |
---|---|
JDBC |
If no value is specified for the DateTime |
ODBC |
If no value is specified for the DateTime |
Oracle |
The default Oracle DateTime format. For information, see your Oracle documentation. |
Examples
About these examples
Assume you are updating a table named Files by setting the
Timestamp column to 4/2/06 3:45 pm. This DateTime
is represented by the following DateTime format:
1 |
m/d/yy h:mm am/pm |
Example 1 (JDBC, ODBC, and OLE DB syntax)
To specify that PowerBuilder should use this format for the
DateTime datatype when it builds the SQL UPDATE statement:
-
Database
profileType the following in the DateTime Format box on the Syntax
page in the Database Profile Setup dialog box:1m/d/yy h:mm am/pm -
Application
Type the following in code:
1SQLCA.DbParameter="DateTime=' ''m/d/yy h:mm am/pm''' '"
What happens PowerBuilder builds
the following SQL UPDATE statement
to update the table:
1 |
UPDATE FILES |
1 |
SET TIMESTAMP='4/2/06 3:45 pm' |
Example 2 (Oracle syntax)
To specify that PowerBuilder should use this format for the
DateTime datatype when it builds the SQL UPDATE statement:
-
Database
profileType the following in the DateTime Format box on the Syntax
page in the Database Profile Setup dialog box:1m/d/yy h:mm am/pm -
Application
Type the following in code:
1SQLCA.DbParameter="DateTime=' ''''m/d/yy h:mm am/pm'''' '"
What happens PowerBuilder builds
the following SQL UPDATE statement
to update the table:
1 |
UPDATE FILES |
1 |
SET TIMESTAMP='4/2/06 3:45 pm' |