Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Split Data

Status
Not open for further replies.

spicysudhi

Programmer
Nov 10, 2003
575
FR
hi,

my table has a numberic ID column. I am writing a procedure to which I am passing a set of IDs separated by commas (procedure IN parameter is varchar2 type).

Need is to delete all the records from the table for the matching IDs.

Example:

Parameter value (name: varIds) = '1,2,3,4,5'
When I use below statement, it gives error coz the variable is string.
Code:
Delete from myTable where ID in (varIds);
--
is there any way to handle this except doing a split of the string and processing individual IDs?

thanks.

regards,
Sudhi
 
Hi, Sudhi

Try

EXECUTE IMMEDIATE('Delete from myTable where ID in (varIds)') ;

Regards,



William Chadbourne
Oracle DBA
 

Actually it should be:

EXECUTE IMMEDIATE 'Delete from myTable where ID in ('||varIds||')';
[3eyes]




----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top