Erro: invalid input syntax for integer: "ERLON PAULO ANDRADE"
      CONTEXT:  PL/pgSQL function "fun_tri_erp_venda_ins" line 11 at SQL
statement

Glauber,

pelo erro que o postgres esta retornando, parece que o tipo do campo
ven_nom_cli não corresponde a rscliente.cli_nom.

Rudinei Dias



2008/7/22 Glauber Almeida <[EMAIL PROTECTED]>:

>
> Bom pessoal, estou com um problema em uma trigger e não consigo achar o que
> esta errado.
>
> Funcionalidade:
> Na inclusão da venda deve selecionar o cliente na tabela de clientes e
> duplicar os dados (nome do cliente, número do cpf/cnpj) na tabela de venda.
>
> Trigger: tri_erp_venda_ins
> Type: before
> For each: Row
> On event: Insert
>
> $body$
> declare
> rscliente erp_cliente%rowtype;
>
> begin
>        select cli_cod, cli_nom, cli_num_cpf_cnpj into rscliente from
> erp_cliente
> where cli_cod = new.cli_cod;
>        if not rscliente.cli_cod is null then
>             new.ven_nom_cli := rscliente.cli_nom;
>             new.ven_num_cpf_cnpj := rscliente.cli_num_cpf_cnpj;
>        else
>              new.cli_cod:=1;
>              new.ven_nom_cli := 'CONSUMIDOR FINAL';
>              new.ven_num_cpf_cnpj := '1234567890';
>        end  if;
> end;
>
> end;
> $body$
>
>
> Erro: invalid input syntax for integer: "ERLON PAULO ANDRADE"
>       CONTEXT:  PL/pgSQL function "fun_tri_erp_venda_ins" line 11 at SQL
> statement
>
> Ao inserir na tabela de vendas um código de cliente existente na tabela de
> cliente esta ocorrendo o erro acima.
>
>
>
> --
> View this message in context:
> http://www.nabble.com/Erro-em-trigger-tp18597325p18597325.html
> Sent from the PostgreSQL - Brasil mailing list archive at Nabble.com.
>
> _______________________________________________
> pgbr-geral mailing list
> [email protected]
> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a