-1

This my select p/l sql. this_select_count is a row count returned by the select. and my_fucntion is p/l sql function for get some value How can i count my select result and pass that count value in to the my_function as pram.

SELECT 
   t.NAME,
   my_function(this_select_count) my_value,
   t.ID
FROM view t
Duleep
  • 569
  • 5
  • 25
  • 49

2 Answers2

1

It's totally unclear (at least to me) from your question what you want to count, but if you want to pass the total rowcount returned by the select, you can do something like this:

SELECT t.name,
       my_function(count(*) over ()) as my_value,
       t.id
FROM view t;

If you need a different count, you will most want to adjust the over() part to only count rows for a specific ID or name.

  • sorry for my unclear question. i want to pass row count returned by the select. Thanks for you help this really help to me. again thanks lot :) – Duleep Nov 04 '13 at 09:23
0

You can assign the count to a variable and use it in the function. Examples are at How do I use variables in Oracle SQL Developer?

Community
  • 1
  • 1
Madhivanan
  • 13,470
  • 1
  • 24
  • 29