|
When you define a TIME, DATE, or TIMESTAMP column in your DDL, and
you run an INSERT statement, whether in SQL/Procedure Language or
from embedded SQL in an RPG program, the SQL will populate the above
type fields using the CURRENT_TIMESTAMP as a default value if you do
not specify the column in the list of values to populate.
Record format for file CUST:create table cust
(Nowdate date, nowtime time, cust# dec (9,0), custname char(50) )
The statement:
INSERT INTO CUST (Cust#, Custname) VALUES
( 123, 'David Livingston')
will result in a new record with values
('2013-05-24', '12:17:00', 123, 'David Livingston').
BUT if you name them, you have to supply the value.
RPG recognizes externally defined fields as if they were
program-described fields, not defined with a current timestamp. I
assume that embedded SQL has to carry over this into the
corresponding generated RPG code for externally-described files, in
general, if the column is brought specifically into play in the RPG
or embedded RPG, even if it is only implicitly pulled in with type.
I think if you run the above INSERT within a stored procedure it
will act the same way.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.