Re: Oracle Freakishness

"Garry T. Williams" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <2099875.zcsOjrKGQl@vfr>
On 5-2-13 15:20:23 David E. Wheeler wrote:
> This query:
> 
>     $dbh->selectrow_hashref(q{
>         SELECT c.change_id
>              , COLLECT(t.tag) AS tags
>           FROM changes   c
>           LEFT JOIN tags t ON c.change_id = t.change_id
>          WHERE c.project = ?
>          GROUP BY c.change_id
>     }, undef, 'engine');
> 
> Generates this (useless) exception:
> 
>     ORA-00932: inconsistent datatypes: expected - got - (DBD ERROR:
> error possibly near <*> indicator at char 51 in '

Perhaps this is due to

    http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions031.htm#SQLRF06304 

    "COLLECT is an aggregate function that takes as its argument a
    column of any type and creates a nested table of the input type
    out of the rows selected. To get accurate results from this
    function you must use it within a CAST function."

Do you have to define a type and cast COLLECT() to that type?

-- 
Garry T. Williams
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.