1 Feb 2020

  • February 01, 2020
  • Amitraj
Embedded SQL


Embedded SQL is a method of inserting inline SQL statements or queries into the code of a programming language, which is known as a host language. Because the host language cannot parse SQL, the inserted SQL is parsed by an embedded SQL preprocessor.

Embedded SQL is a robust and convenient method of combining the computing power of a programming language with SQL's specialized data management and manipulation capabilities.



-> sqlca.h -  Header file to be included.

-> It must use special variables known as host variables to move data between application and a database.



Two types of host variables:-

1. Input host variables - Transfer data to database.
2. Output host variables - receives data from database.

-> Host variables are ordinary programming language variables.

-> They must be defined with in a special section known as a declare section.


EXEC SQL BEGIN  DECLARE SECTION
char EmployeeID [5];
double Salary;
EXEC SQL END DECLARE SECTION






-> Embedded SQL is not supported by all relational database management systems (RDBMS). Oracle DB and PostgreSQL provide embedded SQL support. MySQL, Sybase and SQL Server 2008 do not, although support was provided by earlier versions of SQL Server (2000 and 2005).

-> The C programming language is commonly used for embedded SQL implementation.

Translate

Popular Posts