0

i have a records in my table

testing=# select * from employee;
 employee_id | first_name | last_name | manager_id
-------------+------------+-----------+------------
           1 | Sandeep    | Jain      |
           2 | Abhishek   | Kelenia   |          1
           3 | Harsh      | Aggarwal  |          1
           4 | Raju       | Kumar     |          2
           5 | Nikhil     | Aggarwal  |          2
           6 | Anshul     | Aggarwal  |          2
           7 | Virat      | Kohli     |          3
           8 | Rohit      | Sharma    |          3
(8 rows)

i have written a function to delete record from table.

CREATE OR REPLACE FUNCTION testing(first_name varchar(255))
RETURNS INTEGER AS
$BODY$
DECLARE emp_id INTEGER;

BEGIN
 SELECT id into emp_id from links e where name = first_name;
 
 DELETE FROM links WHERE id = emp_id;

 return emp_id;

END

$BODY$
LANGUAGE plpgsql;

but now i want to delete multiple records by passing array parameters.

जलजनक
  • 3,072
  • 2
  • 24
  • 30
manikandan
  • 61
  • 1
  • 6

0 Answers0