Subject | Stored Procedure q (NewBie) |
---|---|
Author | Burak ÖZLER |
Post date | 2001-11-05T11:24:23Z |
Here is the procedure
CREATE PROCEDURE CARI_BORCUPDATE (
CARIID INTEGER,
BORC NUMERIC(17,2))
RETURNS (
OLDU SMALLINT)
AS
declare variable ESKIBORC NUMERIC(17,2);
begin
SELECT BORC
FROM CARI
WHERE CARIID = :CARIID
INTO :ESKIBORC;
if ISNULL(ESKIBORC) then ESKIBORC = 0;
ESKIBORC = ESKIBORC + :BORC;
Update Cari Set Borc = :ESKIBORC
where CariID = :CariID;
OLDU = 1;
SUSPEND;
end
if ESKIBORC returns NULL
Interbase can't make the calculation
ESKIBORC = ESKIBORC + :BORC;
so I have to make a NULL control but I know that there's no isnull
function in Interbase.
The Procedure above is a very simple procedure and I have to write
very complex procedures.
1- What is the easiest way to control Null's ?
2- How can I determine that the first select could find a record.?(I
tried WHEN SQLCODE but no success)
any example would be very valuable for me..
thanks.
Burak
CREATE PROCEDURE CARI_BORCUPDATE (
CARIID INTEGER,
BORC NUMERIC(17,2))
RETURNS (
OLDU SMALLINT)
AS
declare variable ESKIBORC NUMERIC(17,2);
begin
SELECT BORC
FROM CARI
WHERE CARIID = :CARIID
INTO :ESKIBORC;
if ISNULL(ESKIBORC) then ESKIBORC = 0;
ESKIBORC = ESKIBORC + :BORC;
Update Cari Set Borc = :ESKIBORC
where CariID = :CariID;
OLDU = 1;
SUSPEND;
end
if ESKIBORC returns NULL
Interbase can't make the calculation
ESKIBORC = ESKIBORC + :BORC;
so I have to make a NULL control but I know that there's no isnull
function in Interbase.
The Procedure above is a very simple procedure and I have to write
very complex procedures.
1- What is the easiest way to control Null's ?
2- How can I determine that the first select could find a record.?(I
tried WHEN SQLCODE but no success)
any example would be very valuable for me..
thanks.
Burak