Hi Vertica SME,
Is it possible to create a function in vertica something like this?
- How to declare pre-defined variable inside the procedure and function?
- Is it possible to make a cursor for SQL statement, and how?
- How to pass variables inside the function or procedure?
Code is something like this, below:
create or replace function (arg1 numeric) return numeric
declare
itr number;
name varchar (60);
emp_tbl CURSOR FOR
SELECT emp_id, full_name, dept_name
FROM employees;
begin
loop
fetch emp_tbl into name;
exit when not found;
v_stmt := 'insert into employees2 (emp_id, name, dept) select emp_id, '
end loop;
end;