Download presentation
Presentation is loading. Please wait.
1
Dynamic SQL Konstantin Osipov, MySQL AB
2
About the speaker lives in Moscow works on the server
implemented the feature
3
What is this talk about? how Dynamic SQL works good practices
getting your feedback
4
Dynamic SQL syntax is syntax of SQL prepared statements:
PREPARE <name> FROM <text> EXECUTE <name> USING list> DEALLOCATE PREPARE <name>
5
Degree of Freedom Static SQL: @-user variables to input data
Stored Procedures SQL: stored procedure variables Prepared SQL: adds LIMIT ?, ? capability Dynamic SQL: 100% flexibility
6
Permissions, Scope Permissions: are the same as of the Stored Procedure dangerous in SUID procedures Scope: Dynamic SQL has its own scope no access to SP variables temporary tables are in the scope of SP
7
How it works
8
Dynamic SQL Dos administrative tasks CHECK, OPTIMIZE dynamic querying
IN (id-list), handling of hierarchical data
9
Dynamic SQL Dont's don't use it if you don't have to: risk of SQL injection it does not provide extra optimization Static SQL is re-optimized just as well it allows the same statements as in Stored Procedures
10
Dynamic SQL Limits not all statements
three step procedure: no EXECUTE IMMEDIATE no cursor support no access to Stored Procedure variables Stored Procedure variables can't be bound to placeholders can't be used in Functions and Triggers
11
Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.