RES: Problem with function parameters

From: "Alejandro Michelin Salomon \( Adinet \)" <alejmsg(at)adinet(dot)com(dot)uy>
To: "'Richard Huxton'" <dev(at)archonet(dot)com>, "Pgsql-General" <pgsql-general(at)postgresql(dot)org>
Subject: RES: Problem with function parameters
Date: 2006-12-01 18:32:58
Message-ID: !~!UENERkVCMDkAAQACAAAAAAAAAAAAAAAAABgAAAAAAAAAhx491Ki2tUS42D/aMPFg1MKAAAAQAAAA9fFpd1/wJUyIZC+ABE9XjgEAAAAA@adinet.com.uy
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Richard Huxton wrote:
-->-----Mensagem original-----
-->De: Richard Huxton [mailto:dev(at)archonet(dot)com]
-->Enviada em: sexta-feira, 1 de dezembro de 2006 12:24
-->Para: Alejandro Michelin Salomon ( Adinet )
-->Cc: Pgsql-General
-->Assunto: Re: [GENERAL] Problem with function parameters
-->
-->
-->Alejandro Michelin Salomon ( Adinet ) wrote:
-->> Hi :
-->>
-->> I have installed Pg 8.08
-->>
-->> I create this function :
-->> CREATE OR REPLACE FUNCTION CALCULO_VALOR_LIQUIDO_HELPDESK(
-->> nTipoDesconto SMALLINT,
-->>
-->> nTipoComissao SMALLINT,
-->
-->> When i test this function, i call the function with this
-->parameters :
-->>
-->> SELECT CALCULO_VALOR_LIQUIDO_HELPDESK( 0, 1, 10, 10, 1000 );
-->>
-->> This is the error that happens:
-->>
-->> ERROR: function calculo_valor_liquido_helpdesk(integer, integer,
-->> integer, integer, integer) does not exist SQL state: 42883
-->> Hint: No function matches the given name and argument
-->types. You may need to
-->> add explicit type casts.
-->>
-->> I dont now what the two first parameters are see as
-->integer. When 0
-->> and 1 are true smallint values.
-->
-->"0" and "1" end up as literal integers, since you've not told it
-->otherwise. You have two options:
-->1. Cast your parameters when you call the function
--> select calculo_valor_...(0::smallint, 1::smallint, ...)
-->2. Define your function to take integers
-->
-->I'd choose #2, you're not gaining anything by having
-->smallint parameters.
-->
-->--
--> Richard Huxton
--> Archonet Ltd
-->

I change the parameters to integer and is ok now.

Thanks for your help.

Alejandro Michelin Salomon

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John McCawley 2006-12-01 18:36:59 Re: Separation of clients' data within a database
Previous Message Merlin Moncure 2006-12-01 18:21:03 Re: porducing documentation from postgres