Skip to content
Advertisement

DELETE By Procedure With String Input – Oracle

I am writing a procedure to delete some records of z_names table by IDs from the input as string (and I need to seprate them by special character (comma ,)).

Sample Input: '1,4'

z_names table:

ID NAME
1 jim
2 john
3 jack
4 alex

After running this procedure, the record with ID 1 and 4 (jim and alex) must be deleted.

I have lots of errors while was writing this procedure.

Advertisement

Answer

You’ don’t need dynamic SQL.

Sample data:

Procedure:

Testing:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement