Embedded SQL & Stored Procedures

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/11

flashcard set

Earn XP

Description and Tags

Last updated 11:21 AM on 5/4/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

12 Terms

1
New cards
Embedded SQL
SQL statements contained within an application written in a host programming language such as C, C++, Java, or ASP.NET.
2
New cards
Host language
Any programming language that contains embedded SQL.
3
New cards
Steps to build an embedded-SQL program
(1) Programmer writes embedded SQL inside host code, (2) Pre-processor transforms it into DBMS- and language-specific procedure calls, (3) Host compiler compiles the program, (4) Linker produces the executable plus an "access plan" module.
4
New cards
Access plan
The compiled module containing the instructions needed to run embedded SQL code at runtime.
5
New cards
Main weakness of embedded SQL
Executables can be decompiled, exposing table names and dictionary structure; SQL errors are not caught at compile time and may surface at run-time.
6
New cards
Stored procedure
Business logic stored on the database server in the form of SQL code (or a DBMS-specific procedural language) that can be called by applications.
7
New cards
Two main advantages of stored procedures
(1) Reduce network traffic and improve performance (SQL is not transmitted across the network), (2) Reduce code duplication, lowering errors and maintenance cost.
8
New cards
Stored procedure syntax (MySQL)
CREATE PROCEDURE name(parameter_list) BEGIN SQL_statements; END;
9
New cards
IN parameter
A value supplied by the caller into the stored procedure.
10
New cards
OUT parameter
A value returned from the stored procedure to the caller.
11
New cards
How to invoke a stored procedure manually
Use CALL procedure_name(arg1, arg2, …);
12
New cards
Why prefer stored procedures over inline SQL strings in app code
Centralizes business logic, improves security (less SQL injection surface), reduces network traffic, easier to maintain.