Working on project to convert a Microsoft Access database application to DB2 10.1. This my first with DB2.
1st I tried SQL Script
INSERT INTO "IBNserv"."ChkMe"("Clt")>>> [Column Clt Data Type TIME NOT NULL
VALUES CAST('12:14:00' AS TIME)
INSERT INTO "IBNserv"."ChkMe"("Clt") VALUES CAST('12.14.00' AS TIME)
Updated 1 rows.
Query execution time => 47 ms
2nd I tried SP
CREATE PROCEDURE SP_Time ()
DYNAMIC RESULT SETS 1
DECLARE H SMALLINT;DECLARE M SMALLINT;DECLARE S SMALLINT;
SET H=12;SET M=14;SET S=00;
INSERT INTO "IBNserv"."ChkMe"("Clt")
VALUES CAST('H:M:S' AS TIME);
DB2ADMIN.SP_TIME - Deploy for debug started.
DB2ADMIN.SP_TIME - Create stored procedure completed.
DB2ADMIN.SP_TIME - Deploy for debug successful.
3rd I tried to Run SP & following code is the result.
The syntax of the string representation of a datetime value is incorrect.. SQLCODE=-180,
Run of routine failed.
- Roll back completed successfully.
What is the correct string representation of a TIME value? I want to use variable H (0 to 23) &
Variable M (0 to 59) .Variable S will always be 0.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!