Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL question...

Re: PL/SQL question...

From: James Lorenzen <lorenzen_at_tiny.net>
Date: Wed, 27 May 1998 20:20:45 GMT
Message-ID: <lorenzen-ya02408000R2705981520420001@news.visi.com>


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 parts
Received on Wed May 27 1998 - 15:20:45 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US