# Can I create a function in CRATEDB that select \* from table

**URL:** <https://community.cratedb.com/t/can-i-create-a-function-in-cratedb-that-select-from-table/930>\
**Category:** SQL\
**Created:** [December 7, 2021, 5:46pm UTC](https://community.cratedb.com/t/can-i-create-a-function-in-cratedb-that-select-from-table/930 "2021-12-07T17:46:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![greg\_lovelace](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/greg_lovelace/32/469_2.png) [@greg\_lovelace](https://community.cratedb.com/u/greg_lovelace)\
**Post date:** [December 7, 2021, 5:46pm UTC](https://community.cratedb.com/t/can-i-create-a-function-in-cratedb-that-select-from-table/930/1 "2021-12-07T17:46:56Z")

</div>

I tried creating this FUNCTION and get the error;

```auto
SQL Error [42601]: Unterminated dollar quote started at position 0 in SQL $BODY$. Expected terminating $$

```

Has anyone tried creating function that acts like a stored procured in CrateDB?

```sql
create or REPLACE function databasnamee.GET_DATA_FUNC_TABLE()
returns table 
( 
    v_id character varying, vi_firstname character varying
)

```

```sql
LANGUAGE 'PLPGSQL'

AS 
$BODY$
begin
return QUERY
    select ID,firstname from databasename.functiontest; 
end;
$BODY$;

```

---

<div class="post-metadata">

**Author:** ![jayeff](https://sea2.discourse-cdn.com/flex020/user_avatar/community.cratedb.com/jayeff/32/271_2.png) [@jayeff](https://community.cratedb.com/u/jayeff)\
**Post date:** [December 7, 2021, 6:54pm UTC](https://community.cratedb.com/t/can-i-create-a-function-in-cratedb-that-select-from-table/930/2 "2021-12-07T18:54:12Z")

</div>

Hi @greg_lovelace,

CrateDB only supports JavaScript for user defined functions

> **[User-defined functions](https://crate.io/docs/crate/reference/en/4.6/general/user-defined-functions.html#supported-languages)**
>
> Table of contents CREATE OR REPLACE, Supported types, Overloading, Determinism, DROP FUNCTION, Supported languages- JavaScript- JavaScript supported types, Working with NUMBERS, Working with Array methods... CREATE OR REPLACE: CrateDB supports...
