473,408 Members | 1,784 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Parallel SQL (forking) in SQL stored procedures

How would I execute two independent SQL statements in the same stored
procedure? I have a business process that requires a number of long-
running procedures to be executed. The procedures themselves are not
related and can be run simultaneously. The pseudo-code would look
like this

call proc_1;
if variable_1 is 'GO' then
call long_proc_2 &
call long_proc_3 &
fi
if variable_2 is 'GO' then
call proc_4
fi

The & means start the procedure and move on to the next statement
without waiting for the return.

Is this possible with SQL stored procedures? What about C or Java?

Thanks!
Jun 27 '08 #1
4 4845
Ian
an**********@hotmail.com wrote:
How would I execute two independent SQL statements in the same stored
procedure? I have a business process that requires a number of long-
running procedures to be executed. The procedures themselves are not
related and can be run simultaneously. The pseudo-code would look
like this

call proc_1;
if variable_1 is 'GO' then
call long_proc_2 &
call long_proc_3 &
fi
if variable_2 is 'GO' then
call proc_4
fi

The & means start the procedure and move on to the next statement
without waiting for the return.

Is this possible with SQL stored procedures? What about C or Java?
No, not possible with SQL stored procedures.

C/Java could certainly do it, though.

Jun 27 '08 #2
Ian wrote:
an**********@hotmail.com wrote:
>How would I execute two independent SQL statements in the same stored
procedure? I have a business process that requires a number of long-
running procedures to be executed. The procedures themselves are not
related and can be run simultaneously. The pseudo-code would look
like this

call proc_1;
if variable_1 is 'GO' then
call long_proc_2 &
call long_proc_3 &
fi
if variable_2 is 'GO' then
call proc_4
fi

The & means start the procedure and move on to the next statement
without waiting for the return.

Is this possible with SQL stored procedures? What about C or Java?

No, not possible with SQL stored procedures.

C/Java could certainly do it, though.
You need multiple connections.

--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab
Jun 27 '08 #3
Ian
Serge Rielau wrote:
Ian wrote:
>an**********@hotmail.com wrote:
>>How would I execute two independent SQL statements in the same stored
procedure? I have a business process that requires a number of long-
running procedures to be executed. The procedures themselves are not
related and can be run simultaneously. The pseudo-code would look
like this

call proc_1;
if variable_1 is 'GO' then
call long_proc_2 &
call long_proc_3 &
fi
if variable_2 is 'GO' then
call proc_4
fi

The & means start the procedure and move on to the next statement
without waiting for the return.

Is this possible with SQL stored procedures? What about C or Java?

No, not possible with SQL stored procedures.

C/Java could certainly do it, though.
You need multiple connections.
Indeed. I didn't say it would be a good idea :-)
Jun 27 '08 #4
>Is this possible with SQL stored procedures? What about C or Java? <<

T-SQL is a simple one-pass compiler, so you are not going to do
anything this modern and fancy with it. It was never meant to be
development language, but just an extra tool to get around the
limitations of the early Sybase SQL engine. The old rule of thumb was
not to do a stored procedure longer than one page, including
comments.

Other programming languages can use multiple connections and call
SQL. Maybe Erlang has an SQL API now. You could also use WX2 or
Teradata, which are SQL engines that are naturally parallel.

That is about all I can think of right now.
Jun 27 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: M Wells | last post by:
Hi All, I'm wondering if anyone can tell me if it's possible to search for stored procedures by their contents? I tend to leave very descriptive notes in stored procedures and they're...
17
by: serge | last post by:
How can i delete all user stored procedures and all table triggers very fast in a single database? Thank you
9
by: Ralph Cramden | last post by:
I'm writing a VB6 app which calls several stored procedures on my SQL Server DB. The first stored procedure must complete its inserts before the second stored procedure can query the modified...
11
by: jrefactors | last post by:
I want to know the differences between SQL Server 2000 stored procedures and oracle stored procedures? Do they have different syntax? The concept should be the same that the stored procedures...
2
by: scott | last post by:
Hi, Just wondering what sort of problems and advantages people have found using stored procedures. I have an app developed in VB6 & VB.NET and our developers are starting to re-write some of the...
2
by: Kent Lewandowski | last post by:
hi all, Recently I wrote some stored procedures using java jdbc code (admittedly my first stab) and then tried to implement the same within java packages (for code reuse). I encountered...
5
by: Tim Marshall | last post by:
I was following the thread "Re: Access Treeview - Is it Safe Yet?" with interest and on reading the post describing Lauren Quantrell's SmartTree, I've run into something I don't understand: Stored...
45
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data from/to SQL Server? Why? Thanks Regards
28
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.