Subject | what is wrong with this SP ? |
---|---|
Author | Marcos.Nobre@stj.gov.br |
Post date | 2000-04-25T13:47:08Z |
On my Windows IB6 I create this SP :
------------------------------------------------------------------------------------------
set term @;
create procedure nova_data (DataI date, Incremento integer)
returns (DataF date)
as
declare variable d1 date;
begin
if (DataI is null) then
d1 = CURRENT_DATE;
else
d1 = DataI;
DataF = d1 + Incremento;
suspend;
end
@
set term ;@
-------------------------------------------------------------------------------------------
When I do :
EXECUTE PROCEDURE nova_data( NULL, 10 ) -------> I receiving NULL;
EXECUTE PROCEDURE nova_data( cast('FEB-10-2000' as date), 10 ) -----> I
receiving ERROR;
EXECUTE PROCEDURE nova_data( 'FEB-10-2000', 10 ) --------> I receiving NULL;
Now trying on this :
--------------------------------------------
create procedure teste_data returns (DataF date)
as
begin
DataF = CURRENT_DATE;
suspend;
end
---------------------------------------------
EXECUTE PROCEDURE teste_data -------------> and have the same : NULL
SELECT * FROM teste_data -------------> today's date after 'SQL ERROR (Unknown
error)'
WHAT excataly IB6 doing (or I) ?
TIA,
MNobre
------------------------------------------------------------------------------------------
set term @;
create procedure nova_data (DataI date, Incremento integer)
returns (DataF date)
as
declare variable d1 date;
begin
if (DataI is null) then
d1 = CURRENT_DATE;
else
d1 = DataI;
DataF = d1 + Incremento;
suspend;
end
@
set term ;@
-------------------------------------------------------------------------------------------
When I do :
EXECUTE PROCEDURE nova_data( NULL, 10 ) -------> I receiving NULL;
EXECUTE PROCEDURE nova_data( cast('FEB-10-2000' as date), 10 ) -----> I
receiving ERROR;
EXECUTE PROCEDURE nova_data( 'FEB-10-2000', 10 ) --------> I receiving NULL;
Now trying on this :
--------------------------------------------
create procedure teste_data returns (DataF date)
as
begin
DataF = CURRENT_DATE;
suspend;
end
---------------------------------------------
EXECUTE PROCEDURE teste_data -------------> and have the same : NULL
SELECT * FROM teste_data -------------> today's date after 'SQL ERROR (Unknown
error)'
WHAT excataly IB6 doing (or I) ?
TIA,
MNobre