> For the complete documentation index, see [llms.txt](https://vikram-bajaj.gitbook.io/cs-gy-6083-principles-of-database-systems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vikram-bajaj.gitbook.io/cs-gy-6083-principles-of-database-systems/sql/advanced-sql/functions-and-procedures/external-language-routines.md).

# 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.
