Subject Re: Using First in Stored Procedure
Author Muthu Annamalai
Ok, how I get top 3 values from a single column. I don't how to loop
through the column, can you show the code for it

Thanks

Muthu Annamalai

--- In firebird-support@yahoogroups.com, "Nigel Weeks" <nweeks@...>
wrote:
>
> That's because you've only selecting one field, and you've got
three fields
> to accept values.
> If you remove the 'first 3', you can see the problem.
> SELECT RECEIPT.RECEIPTNUMBER (one field)
> FROM RECEIPT
> WHERE RECEIPT.CUSTOMERID = :CUSTOMERID
> INTO :RECEIPT1, :RECEIPT2, :RECEIPT3; (three destination fields)
>
> If you want to populate the receipt1,2,3 fields, you'll need to do
it in a
> loop, assigning one at a time.
>
> Nige.
>
> -----Original Message-----
> From: firebird-support@yahoogroups.com
> [mailto:firebird-support@yahoogroups.com]On Behalf Of Muthu
Annamalai
> Sent: Thursday, 29 June 2006 9:19 AM
> To: firebird-support@yahoogroups.com
> Subject: [firebird-support] Using First in Stored Procedure
>
>
> Hi,
>
> I am having problem in using First. Here is my SP
>
> SELECT FIRST 3 RECEIPT.RECEIPTNUMBER
> FROM RECEIPT
> WHERE RECEIPT.CUSTOMERID = :CUSTOMERID
> INTO :RECEIPT1, :RECEIPT2, :RECEIPT3;
>
> But I am getting the following error
>
> count of column list and variable list do not match.
> Dynamic SQL Error.
> SQL error code = -313.
> count of column list and variable list do not match.
>
> I also need to get the latest 3 records
>
> Any help is highly appreciated
>
> Thanks
>
> Muthu Annamalai
>
>
>
>
>
> __________ NOD32 1.1631 (20060628) Information __________
>
> This message was checked by NOD32 antivirus system.
> http://www.eset.com
>
>
> [Non-text portions of this message have been removed]
>