Subject How To: Write a Store Proc. for the following
Author Namit Nathwani
Hi all

I am pretty new to RDBMS's and come from a Visual FoxPro background. I
would like to write a Stored Procedure that I can use the results in Report
Manager in such a manner:

SELECT NarrationField FROM MY_STOREDPROCEDURE(:iID, :cFlag)

I will be sending 2 parameters 1st will be the ID to which the record has
to belong and 2nd a Flag so that I can do a CASE statement in the stored
proc. to execute the related SELECT statement. The resulting cursor I will
then convert to a narration using another table meant to help generate
narrations, something like this pseudo / FoxPro code:

PARAMETERS tiID, tcFlag

lcRetVal

DO CASE
CASE tcFlag = "X"
SELECT xc.fld1, xc.fld2, xc.fld3 FROM xchild xc WHERE
xc.iPID = tiID INTO CURSOR xrow

SELECT n.NarrTemplate FROM NarrMaster n WHERE n =
"XCHILDTEMPLATE" INTO CURSOR xnarr

now xnarr.NarrTemplate will contain something like this
"'Bill no. ' + xrow.fld1 + ' Bill dt. ' + xrow.fld2 + 'so on'"

lcRetVal = translated xnarr.NarrTemplate in VFP I would
assign it to a variable and macro substitute it.

CASE tcFlag = "Y"
...
...
OTHERWISE
lcRetVal = "Unknown Flag can't create narrations"
ENDCASE

RETURN lcRetVal


Hoping this is possible or another alternative to get it done.

Please advise.




Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
namitbn@...
___________________________________________

----------


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.659 / Virus Database: 423 - Release Date: 15/04/2004


[Non-text portions of this message have been removed]