External Language Routines

SQL allows us to use procedures and functions written in other languages like C, C++ .

create procedure dept_count_proc(in dept_name varchar(20), out count integer)
language C
external name '/usr/avi/bin/dept_count_proc'
create function dept_count(dept_name varchar(20))
returns integer
language C
external name '/usr/avi/bin/dept_count'

The advantage of using external languages is that they have more efficient implementations of various operations and have more expressive power.

However, the code needed to implement the function must be loaded into the database system and executed in the database system's address space. This involves the risks of accidental database corruption and security issues, such as allowing users unauthorized access to data.

Last updated