Subject Re: multiple rows in singleton select
Author Svein Erling Tysvær
--- In firebird-support@yahoogroups.com, "tailuo2002" wrote:
> Hi,
>
> I'm working on a linux box running FB 1.5.2 , I'm using C language.
>
> The SQL is:
>
> char *sql="select a.phone,a.smscontent,a.mo_id
> from mo a inner join phones b on (a.phone=b.phone)
> where b.corp_id=? ";
>
> When app running, prepare is ok , but at isc_dsql_execute2, it reports:
> --> multiple rows in singleton select <--
>
> The sql is so simple , why it reports "multiple rows in singleton
> select"?
>
> I want to know if it is caused by wrong XSQLDA ?

This error message normally indicates that the result contains several
rows, when maximum allowed is one row. You get it if you use a dsql
component (which can return maximum one row) or if you do a subselect
that return more than one row

e.g.
select a.customer, (select b.itemsbought from boughtitems b where
a.customerid = b.customerid) from customer a

would cause an error if any customer bought more than one item.

I see you use isc_dsql_execute2, and that is the reason why you got
your error. I must admit that using IBO, I never look at these
functions, so I cannot tell you which call you should use - just try
to find something which indicates it is a cursor, and not dsql.

HTH,
Set