January 7, 2014 at 6:54 am
Is it possible to write the Sub Routine inside the Stored Procedure like below ?
The reason I would like the SubRoutines is I need to use the same Variables , temp tables between these procedures.
/*Main Procedure */
SubRoutineOrders :
input parameters
output parameters
end
SubRoutineOrderLine :
input parameters
output parameters
end
SubRoutinePurchaseOrders :
input parameters
output parameters
end
SubRoutinePurchaseOrderLines :
input parameters
output parameters
end
.....
January 7, 2014 at 7:08 am
Yes you can - stored procedures with input and output parameters can be nested within a calling stored procedure. Do you really need the code blocks configured as "subroutines"?
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
January 7, 2014 at 8:01 am
Do you have an example ? I don't necessarily want different Stored Procedures.
I need multiple SubRoutines within One Stored Procedure, so that they can share the Variables and Temp Tables.
January 7, 2014 at 8:13 am
I don't really need the code blocks configured as "subroutines". But there is no easy way to share the variables and Temp Tables between SP's.
January 7, 2014 at 8:17 am
skb 44459 (1/7/2014)
Do you have an example ? I don't necessarily want different Stored Procedures.I need multiple SubRoutines within One Stored Procedure, so that they can share the Variables and Temp Tables.
Can you post up one such "subroutine"? It would help folks to visualise what you are trying to do.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
January 7, 2014 at 11:11 am
Its not a SQL Program , it is a Progress Program.
DEFINE INPUT PARAMETER IpModule AS CHAR NO-UNDO.
DEFINE INPUT PARAMETER IpKeyValue AS CHAR NO-UNDO.
IF IpModule = "Order" then
do :
/* Create an TempTable Record */
Run GetOrder (IpKeyValue).
end.
Procedure getOrder :
Define input parameter IpOrder as char .
/* Insert into #temp (Parent, Child, Decription) */
for each OrderLine where Order = IpOrder :
Run GetOrderLine (inpur Order, Input Line) .
end.
end procedure.
Procedure getOrderLine :
Define input parameter IpOrder as char .
Define input parameter IpLine as int .
/* Insert into #temp (Parent, Child, Decription) */
end.
end procedure.
Procedure getShipments :
Define input parameter IpOrder as char .
Define input parameter IpLine as int .
/* Insert into #temp (Parent, Child, Decription) */
end.
end procedure.
Procedure getInvoices:
Define input parameter IpOrder as char .
Define input parameter IpLine as int .
/* Insert into #temp (Parent, Child, Decription) */
end procedure.
January 7, 2014 at 11:54 am
skb 44459 (1/7/2014)
Its not a SQL Program , it is a Progress Program....
What make of car do you drive?
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply