1878.5.4
by Brian Aker
Update documentation. |
1 |
Dynamic SQL
|
1900.2.4
by Stewart Smith
fix more docs warnings: underline/overline too short |
2 |
===========
|
1878.5.4
by Brian Aker
Update documentation. |
3 |
|
4 |
In Drizzle you can use the EXECUTE command along with user defined variables |
|
5 |
to create SQL in a dynamic manner on the server. An exmaple of this is: |
|
6 |
||
7 |
SET @var= "SELECT 1"; |
|
8 |
EXECUTE @var; |
|
9 |
||
10 |
You can also omit the variable and just insert the SQL directly: |
|
11 |
||
12 |
EXECUTE "SELECT 1"; |
|
1921.4.1
by Brian Aker
Adding in support for EXECUTE to have WITH NO RETURN. |
13 |
|
14 |
By adding WITH NO RETURN you can have EXECUTE then no errors will be |
|
15 |
generated and no data will be returned by the execution of the statement. |
|
1921.4.2
by Brian Aker
Adding in concurrent execute support. |
16 |
|
17 |
If you want to launch the query in a separate session, you can do that with |
|
18 |
the following: |
|
19 |
EXECUTE "SELECT 1" CONCURRENT; |
|
20 |
||
21 |
The query will run in a new session and will execute as the user that |
|
22 |
launched it. It can be killed via KILL and the system limit on total number |
|
23 |
of sessions will be enforced. |