Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

944: Cannot use "first" in this context.

28 views
Skip to first unread message

Henry

unread,
Dec 26, 2006, 10:03:31 AM12/26/06
to
Hello,

In my stored procedure, there is a sql:

select first 1 sales_emp_key, end_customer into t_sales_emp_key,
t_end_customer
from delivery_fact
where order_number = t_order_number and
item_number = t_del_item_num;

which caused problem. Below is the error message that was returned:

944: Cannot use "first" in this context.

Please help me. Thanks for your help.
I was trying to get only 1 sales_emp_key and end_customer_value for
each order's item.
Please let me know if there is a better way. Thanks again.

Carsten Haese

unread,
Dec 26, 2006, 10:36:28 AM12/26/06
to inform...@iiug.org

Declare a cursor and fetch one row from the cursor. Details left as an
exercise for the reader.

-Carsten


Rodrigo Oliveira

unread,
Dec 26, 2006, 10:38:28 AM12/26/06
to Henry, inform...@iiug.org
Yopu can't to use FIRTS, LOAD, UNLOAD and other statements into the stored procedure.
 
In this case, you can to create a CURSOR or a LOOP with BREAK.
 
Regards.
 
Rodrigo.


 
26 Dec 2006 07:03:31 -0800, Henry <ggk...@gmail.com>:
_______________________________________________
Informix-list mailing list
Inform...@iiug.org
http://www.iiug.org/mailman/listinfo/informix-list



--
Rodrigo Alexandre de Oliveira
rodrigo.al...@gmail.com
61 - 8411-2002

Art S. Kagel

unread,
Dec 26, 2006, 5:16:50 PM12/26/06
to Henry
Henry wrote:
> Hello,
>
> In my stored procedure, there is a sql:

Assuming that all of the sales_emp_key and end_customer values are the same
for the order, how about:

select min(sales_emp_key), min(end_customer)


into t_sales_emp_key, t_end_customer
from delivery_fact
where order_number = t_order_number and
item_number = t_del_item_num
;

Art S. Kagel

Henry

unread,
Dec 27, 2006, 8:50:10 AM12/27/06
to
Thanks to everyone here. I learn something new today. Your suggestion
is very good and i really appreciate your help. Thanks again. :)

0 new messages