Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL question...
It's been said before, this can be handled with the DBMS_SQL package.
The count() function worked because it "counts" not null instances of what is being counted. 'age' is not null, so it is counted. The min() function requires a number, 'age' is not a number, therefore it doesn't work.
The requirements for your application need to be defined further, there are many options to solving this. It depends on what is being done with the result and how often the columns change. If the columns do not change, a single sql statement could return the information for each column.
HTH
James
In article <356c2c5b.3791792_at_news.mts.net>, smaclennan_at_nospam.ism.ca wrote:
>Ok,
>
>If I need to loop through each column (each of which is an attribute),
>how can I substitute a string for the column name in a function? It
>works for COUNT(v_attribute) but not for MIN(v_attribute)...
>
>Here's an eg.
>declare
> v_attribute varchar2(10);
>
>BEGIN
>v_attribute:='age';
>
>select count(v_attribute) into v_temp from big_table; <==WORKS
>
>select min(v_attribute) into v_temp from big_table; <== Nope
>END;
>
>Thanks...
--
lorenzen_at_tiny.net | Life is complex; it has | real and imaginary partsReceived on Wed May 27 1998 - 15:20:45 CDT
![]() |
![]() |