Date
database parameter
Description
When you update data in the DataWindow painter, PowerBuilder
builds a SQL UPDATE statement in the background. The Date parameter
determines how PowerBuilder specifies a date datatype when it builds the
SQL UPDATE statement.
Applies to
JDB JDBC
ODBC
O90 Oracle9i
O10 Oracle 10g
ORA Oracle (for 11g and later)
Syntax
The syntax you use to specify the Date parameter 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 date
format.
In a PowerBuilder application script, 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 |
Date=' '''date_format''' ' |
Oracle syntax
PowerBuilder parses each set of four consecutive single quotes
(””) as a single quote when it builds the SQL UPDATE statement.
|
1 |
Date=' ''''date_format'''' ' |
|
Parameter |
Description |
|---|---|
|
‘
‘ |
JDBC and ODBC Type a single quote, followed by Oracle Type a single quote, followed by |
|
date_format |
The date format you want PowerBuilder to use when For more on display formats, see |
|
”’ ‘
”” |
JDBC and ODBC Type a backslash, followed by two Oracle Type four single quotes, followed |
Default value
The default value for Date 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 Date database |
|
ODBC |
If no value is specified for the Date database |
|
Oracle |
The default Oracle date format. For |
Examples
About these examples
Assume you are updating a table named Employee by setting the
Startdate column to 2006-04-23. This date is represented by the
following date format:
|
1 |
yyyy-mm-dd |
Example 1 (JDBC and ODBC syntax)
To specify that PowerBuilder should use this format for the date
datatype when it builds the SQL UPDATE statement:
-
Database profile
Type the following in the Date Format box on the Syntax page
in the Database Profile Setup dialog box:1yyyy-mm-dd -
Application
Type the following in code:
1SQLCA.DBParm="Date=' '''yyyy-mm-dd''' '"
What happens
PowerBuilder builds the following SQL UPDATE statement to update
the table:
|
1 2 |
UPDATE EMPLOYEE SET STARTDATE='2006-04-23' |
Example 2 (Oracle syntax)
To specify that PowerBuilder should use this format for the date
datatype when it builds the SQL UPDATE statement:
-
Database profile
Type the following in the Date format box on the Syntax page
in the Database Profile Setup dialog box:1yyyy-mm-dd -
Application
Type the following in code:
1SQLCA.DBParm="Date=' ''''yyyy-mm-dd'''' '"
What happens
PowerBuilder builds the following SQL UPDATE statement to update
the table:
|
1 2 |
UPDATE EMPLOYEE SET STARTDATE='2006-04-23' |
See also