If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > Using First in Stored Proc

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-08-04, 12:06
Chancetribe Chancetribe is offline
Registered User
 
Join Date: Sep 2004
Posts: 13
Using First in Stored Proc

Any idea why the following would not work as a stored procedure? RequisitionIDin is an input parameter that is an integer. I get an error on the ORDER BY that says that First cannot be used in this context.


SELECT FIRST 1 po.PONbr, pr.RequisitionID
INTO WorkLastPONbr, WorkRequisitionID
FROM PurchaseRequisition pr INNER JOIN PurchaseOrder po
ON pr.RequisitionID = po.RequisitionID
WHERE pr.ItemID = (SELECT ItemID
FROM PurchaseRequisition
WHERE RequisitionID = RequisitionIDin)
AND pr.RequisitionID < RequisitionIDin
ORDER BY pr.RequisitionID Desc;

This runs as a regular statement, but it will not work when trying to create a stored procedure with it.

Thanks in advance for any help.

Jeremy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On