By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,806 Members | 1,465 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,806 IT Pros & Developers. It's quick & easy.

Mapping select results through a function

P: 1
I want to apply a function to each of the values returned by another select statement.

i.e if my fuction delete_subtree takes an integer and performs an operation (in this case deleting a node from a tree view), I want to do (this doesn't work)

select delete_subtree(select node from tree where subject ~ 'poker'));

to delete all records whose subject contains the term poker.

What's the magic incantation?
Jul 26 '07 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 534
... ... ...
my fuction delete_subtree takes an integer and performs an operation ...
this doesn't work
Expand|Select|Wrap|Line Numbers
  1. select delete_subtree
  2.   (select node from tree where subject ~ 'poker');
  3.  
... ... ...
As you said, your function takes an integer, but looking at your subquery I suspect it may also return nothing or any number of rows.
See if you can work with the function that takes a varchar, so you can pass something like 'poker' and it'll do the rest.
Aug 2 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.