Article View: borland.public.interbase.sql
Article #11242Re: Stored proc.
From: Henry Olive
Date: Thu, 28 Nov 2002 19:41
Date: Thu, 28 Nov 2002 19:41
32 lines
1734 bytes
1734 bytes
I think i couldn't explain my problem.
Try to explain again.
How can i tell to a s.proc that
if a variable=0 then A_table_field is null ? ( blank )
if a variable=1 then A_table_field is not null ? ( not blank )
Please look at between BEGIN and FOR in below SP.
CREATE PROCEDURE CHECKRPT ( PAYM SMALLINT )
RETURNS (
CUSTNO INTEGER,
TOTAL DOUBLE PRECISION,
DUEDATE TIMESTAMP,
PSTATE VARCHAR(8),
CUSTNAME VARCHAR(40)
) AS BEGIN
IF PAYM=0 THEN C.PAYMENT=NULL
IF PAYM=1 THEN C.PAYMENT <> NULL
FOR
SELECT DISTINCT C.CUSTNO, C.TOTAL,
C.DUEDATE, C.PSTATE, D.CUSTNAME
FROM CHECK C , CUSTOMERS D
WHERE (C.CUSTNO=D.CUSTNO) AND ( C.PAYMENT=:PAYM )
ORDER BY C.DUEDATE, C.CUSTNO
INTO :CUSTNO, :TOTAL, :DUEDATE, :PSTATE, :CUSTNAME
DO
SUSPEND;
END
Technical Details
Message-ID:
<3de6712b@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<3de3c125@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114a0e,eeb00b0c9b1e6578 X-Google-Attributes: gid114a0e,public X-Google-ArrivalTime: 2002-11-28 12:08:03 PST From: "Henry Olive" <zed@zedltd.com> Newsgroups: borland.public.interbase.sql References: <3de3c125@newsgroups.borland.com> Subject: Re: Stored proc. Date: Thu, 28 Nov 2002 21:41:15 +0200 Lines: 35 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 NNTP-Posting-Host: 195.175.163.123 Message-ID: <3de6712b@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1038512427 195.175.163.123 (28 Nov 2002 11:40:27 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail