Hello Robbert-Jan,

Private functions not exposed to the outside is one of the things you can
do with packages.

Mind you, the error message explicitly tells me there’s a mismatch for
routine ADD_ORDER_TO_INVOICE

Also mind you, the package ALREADY EXISTS with the exact same definition,
I just added a space somewhere and tried executing this statement.

With regards,

Martijn Tonies
Upscene Productions




Hi Martijn,
Maybe it is too obvious, but it looks like your body has four routines and your 
header only three (CHECK_INVOICE_EXISTS is missing), hence the signutare 
mismatch.
Kind regards,
Robert

From: Martijn Tonies (Upscene Productions) 
Sent: Monday, October 27, 2014 12:54 PM
To: firebird-devel@lists.sourceforge.net 
Subject: [Firebird-devel] Beta 1: recreating package fails with 
"signaturemismatch" error

Hi,

I noticed this in a recent nightly build last Saturday, it’s still there in 
Beta 1.

I have a package, with a routine, when I tried modifying the body, it returns 
an error:

----8<----
unsuccessful metadata update
RECREATE PACKAGE BODY C_INVOICE failed
Procedure ADD_ORDER_TO_INVOICE has a signature mismatch on package body 
C_INVOICE
while executing:
RECREATE PACKAGE BODY C_INVOICE AS
begin
  function CHECK_INVOICE_EXISTS(InvoiceID T_KEY_INT_REQUIRED) returns boolean as
  begin
    if (not exists(select * from invoices where id = :InvoiceID))
    then exception object_does_not_exist using ('Invoice', InvoiceID);
    else return True;
  end
      
  function INVOICE_ORDER(OrderID T_KEY_INT_REQUIRED) returns T_KEY_INT_REQUIRED 
as
  declare variable CustomerID T_KEY_INT_OPTIONAL;
  declare variable InvoiceID T_KEY_INT_REQUIRED;  
  begin              
    CustomerID = C_ORDER.GET_CUSTOMER_ID(OrderID);
    InvoiceID = CREATE_INVOICE(CustomerID);
    execute procedure ADD_ORDER_TO_INVOICE(InvoiceID, OrderID);
    return InvoiceID;
  end
  function CREATE_INVOICE(CustomerID T_KEY_INT_REQUIRED) returns 
T_KEY_INT_REQUIRED as
  declare variable InvoiceID T_KEY_INT_REQUIRED;
  begin
    insert into invoices (Customer_ID)
    values (:CustomerID)
    returning ID into :InvoiceID;
    return InvoiceID;
  end
  procedure ADD_ORDER_TO_INVOICE(InvoiceID T_KEY_INT_REQUIRED, OrderID 
T_KEY_INT_REQUIRED) as
  begin
    CHECK_INVOICE_EXISTS(InvoiceID);
    insert into invoice_order(Invoice_ID, Order_ID)
    values (:InvoiceID, :OrderID);
  end  
end

----8<----

This is the package header:

---8<---
begin
  function INVOICE_ORDER(OrderID T_KEY_INT_REQUIRED) returns T_KEY_INT_REQUIRED;
  function CREATE_INVOICE(CustomerID T_KEY_INT_REQUIRED) returns 
T_KEY_INT_REQUIRED;
  procedure ADD_ORDER_TO_INVOICE(InvoiceID T_KEY_INT_REQUIRED, OrderID 
T_KEY_INT_REQUIRED);
end
----8<---



I have no idea what’s wrong, do you?

With regards,

Martijn Tonies
Upscene Productions



--------------------------------------------------------------------------------
------------------------------------------------------------------------------



--------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel



--------------------------------------------------------------------------------
------------------------------------------------------------------------------



--------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel
------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to