Reputation: 1
CREATE OR REPLACE FUNCTION customerGetByLargestSpend()
RETURNS TABLE(
customerID INTEGER,
firstName VARCHAR(20),
Surname VARCHAR(40),
totalBookings BIGINT,
totalSpend Numeric
)
ERROR: syntax error at end of input
LINE 8: )
^
SQL state: 42601
Character: 213
Not sure why this is happening.Any help would be very appreciated. thanks
Upvotes: 0
Views: 114
Reputation: 424983
The function is defined to return a row set, but does not return anything.
The parser expects to find something that returns rows, eg a select
statement.
For example:
CREATE OR REPLACE FUNCTION customerGetByLargestSpend()
RETURNS TABLE(
customerID INTEGER,
firstName VARCHAR(20),
Surname VARCHAR(40),
totalBookings BIGINT,
totalSpend Numeric
)
AS $$ SELECT .... $$
LANGUAGE SQL
Upvotes: 1