SPL - passing an argument of 'DATETIME' type
Posted in 2004
Topics: Stored Procedures & SPL, Data Types & Schema Design
Hello, Do you know is an SPL function argument can be of type 'DATETIME'? If not, does the 'datetime' value has to be passed as a VARCHAR? Thanks in advance for your reply! Cheers, Reyna _________________________________________________________ Reyna Sabina Phone: (305) 361-4324 NOAA/AOML/PHOD Fax: (305) 361-4392 4301 Rickenbacker Causeway Email: Reyna.Sabina@noaa.gov Miami, FL 33149-1087 "Things do not get better by being left alone." -Winston Churchill
Yes, you can pass a datatime as aparameter to a SPL procedure/function. Chucho! -----Original Message----- From: "Reyna Sabina" <Reyna.Sabina@noaa.gov> To: ids@iiug.org Date: Fri, 5 Nov 2004 14:34:11 -0500 (EST) Subject: SPL - passing an argument of 'DATETIME' type [3631] Hello, Do you know is an SPL function argument can be of type 'DATETIME'? If not, does the 'datetime' value has to be passed as a VARCHAR? Thanks in advance for your reply! Cheers, Reyna _________________________________________________________ Reyna Sabina Phone: (305) 361-4324 NOAA/AOML/PHOD Fax: (305) 361-4392 4301 Rickenbacker Causeway Email: Reyna.Sabina@noaa.gov Miami, FL 33149-1087 "Things do not get better by being left alone." -Winston Churchill Jean Sagi jeansagi@myrealbox.com jeansagi@yahoo.com
The DATETIME data type should work just fine with stored procedures and functions. Are you having a problem using them? Just a wild guess - remember to define the precision of the DATETIME data type (e.g. DATETIME YEAR TO MINUTE or DATETIME DAY TO SECOND). -- June Hunt
Right, syntax error: You need to add a qualifier to the datetime, YEAR TO
SECOND, YEAR TO MONTH, etc... whatever you need.
Consider this _procedure_ as an example:
CREATE PROCEDURE
aud_cpm_preart(
lc_clacam CHAR(1),
ll_codart LIKE cpm_preart.codart,
ll_codpre LIKE cpm_preart.codpre,
ll_codtar LIKE cpm_preart.codtar,
ll_codser LIKE cpm_preart.codser,
ll_viejo_previe LIKE cpm_preart.previe,
ll_nuevo_previe LIKE cpm_preart.previe,
ll_viejo_fecpre LIKE cpm_preart.fecpre,
ll_nuevo_fecpre LIKE cpm_preart.fecpre,
ll_viejo_prenue LIKE cpm_preart.prenue,
ll_nuevo_prenue LIKE cpm_preart.prenue,
ll_viejo_indact LIKE cpm_preart.indact,
ll_nuevo_indact LIKE cpm_preart.indact,
ll_viejo_usucre LIKE cpm_preart.usucre,
ll_nuevo_usucre LIKE cpm_preart.usucre,
ll_viejo_feccre LIKE cpm_preart.feccre,
ll_nuevo_feccre LIKE cpm_preart.feccre,
ll_viejo_usumod LIKE cpm_preart.usumod,
ll_nuevo_usumod LIKE cpm_preart.usumod,
ll_viejo_fecmod LIKE cpm_preart.fecmod,
ll_nuevo_fecmod LIKE cpm_preart.fecmod,
ll_usurea LIKE cpm_preart.usucre ,
ldt_fecrea DATETIME YEAR TO FRACTION(3) )
DEFINE li_sgte_cam INTEGER;
-----Original Message-----
From: "Reyna Sabina" <Reyna.Sabina@noaa.gov>
To: Jean Sagi <jeansagi@myrealbox.com>
Date: Fri, 5 Nov 2004 16:06:56 -0500 (EST)
Subject: Re: SPL - passing an argument of 'DATETIME' type [3631]
On Fri, 5 Nov 2004, Jean Sagi wrote:
>
> Yes, you can pass a datatime as aparameter to a SPL procedure/function.
>
> Chucho!
Thank You
I tried to pass it to a prototype function (just for
testing purpose) but got an error.
CREATE FUNCTION retdate (d DATETIME)# ^
# 201: A syntax error has occurred.
#
RETURNING DATE
DEFINE ret DATE;
DEFINE tmp DATETIME;
.
.
.
RETURN ret;
END FUNCTION
Also, can we use 'EXTEND' in an SPL function?
>
>
> -----Original Message-----
> From: "Reyna Sabina" <Reyna.Sabina@noaa.gov>
> To: ids@iiug.org
> Date: Fri, 5 Nov 2004 14:34:11 -0500 (EST)
> Subject: SPL - passing an argument of 'DATETIME' type [3631]
>
> Hello,
>
> Do you know is an SPL function argument can be
> of type 'DATETIME'? If not, does the 'datetime'
> value has to be passed as a VARCHAR?
>
> Thanks in advance for your reply!
>
> Cheers,
> Reyna
> _________________________________________________________
> Reyna Sabina Phone: (305) 361-4324
> NOAA/AOML/PHOD Fax: (305) 361-4392
> 4301 Rickenbacker Causeway Email: Reyna.Sabina@noaa.gov
> Miami, FL 33149-1087
>
> "Things do not get better by being left alone."
>
> -Winston Churchill
>
>
>
> Jean Sagi
> jeansagi@myrealbox.com
> jeansagi@yahoo.com
>
Jean Sagi
jeansagi@myrealbox.com
jeansagi@yahoo.com
On Fri, 5 Nov 2004, June C. Hunt wrote: > Reyna Sabina <reyna.sabina@noaa.gov> wrote: > > > > Do you know is an SPL function argument can be > > of type 'DATETIME'? If not, does the 'datetime' > > value has to be passed as a VARCHAR? > > > > The DATETIME data type should work just fine with stored procedures > and functions. Are you having a problem using them? Just a wild > guess - remember to define the precision of the DATETIME data type > (i.e. DATETIME YEAR TO MINUTE or DATETIME DAY TO SECOND). > Thanks, the SPL functions is working. When defining the function parameter I only had 'DATETIME' instead of 'DATETIME YEAR TO MINUTE' Cheers - Reyna