Fujitsu J2X0-1634-01EN Computer Accessories User Manual


 
[Figure: Converting data from character string type to time interval type (year and month)]
An example of a time operation executed by converting the character string data type to the time interval type (date
and time) is given below.
Example 2:
In this example, the process time is updated to a value reduced by 1 hour and 30 minutes for data in
the DAILY_ORDER table whose ORDERQTY is less than 10. Also, "1:30" has been specified for
character string type host variable OTIME.
UPDATE STOCKS.DAILY_ORDER
SET PROCESS_TIME = PROCESS_TIME - CAST(:OTIME AS INTERVAL HOUR TO MINUTE)
WHERE ORDERQTY < 10
[Figure: Converting data from character string type to time interval type (date and time)]
An example of converting the numeric value data type to the character string type and adding to a character string to it
is given below.
Example 3:
In this example, PRODNO and PRICE are fetched from the ORDER table for data for CUSTOMER 61,
and $ is prefixed to the price.
SELECT PRODNO, '$' || CAST(PRICE AS CHARACTER(6))
FROM STOCKS.ORDER WHERE CUSTOMER = 61
118